Index: /temp/trunk/html/install/index.php
===================================================================
--- /temp/trunk/html/install/index.php	(revision 1328)
+++ /temp/trunk/html/install/index.php	(revision 1328)
@@ -0,0 +1,450 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->arrDB_TYPE = array(
+			1 => 'PostgreSQL',
+			// 2 => 'mySQL'	// Ì¤ÂÐ±þ
+		);
+		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objWebParam = new SC_FormParam();
+$objDBParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+$objWebParam = lfInitWebParam($objWebParam);
+$objDBParam = lfInitDBParam($objDBParam);
+
+//¥Õ¥©¡¼¥àÇÛÎó¤Î¼èÆÀ
+$objWebParam->setParam($_POST);
+$objDBParam->setParam($_POST);
+
+switch($_POST['mode']) {
+// ¤è¤¦¤³¤½
+case 'welcome':
+	$objPage = lfDispStep0($objPage);
+	break;
+// ¥¢¥¯¥»¥¹¸¢¸Â¤Î¥Á¥§¥Ã¥¯
+case 'step0':
+	$objPage = lfDispStep0_1($objPage);
+	break;	
+// ¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+case 'step0_1':
+	$objPage = lfDispStep1($objPage);
+	break;	
+// WEB¥µ¥¤¥È¤ÎÀßÄê
+case 'step1':
+	//ÆþÎÏÃÍ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckWEBError($objWebParam);
+	if(count($objPage->arrErr) == 0) {
+		$objPage = lfDispStep2($objPage);
+	} else {
+		$objPage = lfDispStep1($objPage);
+	}
+	break;
+// ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀßÄê
+case 'step2':
+	//ÆþÎÏÃÍ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckDBError($objDBParam);
+	if(count($objPage->arrErr) == 0) {
+		$objPage = lfDispStep3($objPage);
+	} else {
+		$objPage = lfDispStep2($objPage);
+	}
+	break;
+// ¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
+case 'step3':
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objDBParam->getHashArray();
+	// ¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
+	$objPage->arrErr = lfExecuteSQL("./create_table.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+	if(count($objPage->arrErr) == 0) {
+		$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+	} else {
+		$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+	}
+
+	// ¥Ó¥å¡¼¤ÎºîÀ®
+	if(count($objPage->arrErr) == 0) {
+		// ¥Ó¥å¡¼¤ÎºîÀ®
+		$objPage->arrErr = lfExecuteSQL("./create_view.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Ó¥å¡¼¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Ó¥å¡¼¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ½é´ü¥Ç¡¼¥¿¤ÎºîÀ®
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./insert_data.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§½é´ü¥Ç¡¼¥¿¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§½é´ü¥Ç¡¼¥¿¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./column_comment.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./table_comment.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}
+	
+	if(count($objPage->arrErr) == 0) {
+		lfMakeConfigFile();
+		$objPage = lfDispComplete($objPage);
+	} else {
+		$objPage = lfDispStep3($objPage);
+	}
+	break;
+case 'return_step0':
+	$objPage = lfDispStep0($objPage);
+	break;	
+case 'return_step1':
+	$objPage = lfDispStep1($objPage);
+	break;
+case 'return_step2':
+	$objPage = lfDispStep2($objPage);
+	break;
+case 'return_welcome':
+default:
+	$objPage = lfDispWelcome($objPage);
+	break;
+}
+
+//¥Õ¥©¡¼¥àÍÑ¤Î¥Ñ¥é¥á¡¼¥¿¤òÊÖ¤¹
+$objPage->arrForm = $objWebParam->getFormParamList();
+$objPage->arrForm = array_merge($objPage->arrForm, $objDBParam->getFormParamList());
+
+$objView->assignobj($objPage);
+$objView->display('install/install_frame.tpl');
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ¤è¤¦¤³¤½²èÌÌ¤ÎÉ½¼¨
+function lfDispWelcome($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'install/welcome.tpl';
+	$objPage->tpl_mode = 'welcome';
+	return $objPage;
+}
+
+// STEP0²èÌÌ¤ÎÉ½¼¨(¥Õ¥¡¥¤¥ë¸¢¸Â¥Á¥§¥Ã¥¯) 
+function lfDispStep0($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'install/step0.tpl';
+	$objPage->tpl_mode = 'step0';
+	
+	// ¥×¥í¥°¥é¥à¤Ç½ñ¹þ¤ß¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥ì¥¯¥È¥ê
+	$arrWriteFile = array(
+		"html/install.inc",
+		"html/user_data",
+		"html/upload",
+		"data/Smarty/templates_c",
+		"data/update",
+		"data/logs",
+	);
+	
+	$mess = "";
+	$err_file = false;
+	foreach($arrWriteFile as $val) {
+		$path = "../../" . $val;		
+		if(file_exists($path)) {
+			$mode = lfGetFileMode("../../" . $val);
+			
+			// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç
+			if(is_dir($path)) {
+				if($mode == "777") {
+					$mess.= ">> ¡û¡§$val($mode) ¤ÏÌäÂê¤¢¤ê¤Þ¤»¤ó¡£<br>";					
+				} else {
+					$mess.= ">> ¡ß¡§$val($mode) ¤Ë¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â¤òÉÕÍ¿¤·¤Æ²¼¤µ¤¤¡£<br>";
+					$err_file = true;										
+				}
+			} else {
+				if($mode == "666") {
+					$mess.= ">> ¡û¡§$val($mode) ¤ÏÌäÂê¤¢¤ê¤Þ¤»¤ó¡£<br>";					
+				} else {
+					$mess.= ">> ¡ß¡§$val($mode) ¤Ë¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â¤òÉÕÍ¿¤·¤Æ²¼¤µ¤¤¡£<br>";
+					$err_file = true;							
+				}
+			}	
+			
+		} else {
+			$mess.= ">> ¡ß¡§$val ¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£<br>";
+			$err_file = true;
+		}
+	}
+	
+	$objPage->mess = $mess;
+	$objPage->err_file = $err_file;
+
+	return $objPage;
+}
+
+
+// STEP0_1²èÌÌ¤ÎÉ½¼¨(¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼) 
+function lfDispStep0_1($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'install/step0_1.tpl';
+	$objPage->tpl_mode = 'step0_1';	
+	$objPage->copy_mess = lfCopyDir("./user_data/", "../../html/user_data/", $objPage->copy_mess);
+	return $objPage;
+}
+
+function lfGetFileMode($path) {
+	$mode = substr(sprintf('%o', fileperms($path)), -3);
+	return $mode;
+}
+
+// STEP1²èÌÌ¤ÎÉ½¼¨
+function lfDispStep1($objPage) {
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objDBParam->getHashArray();
+	$objPage->tpl_mainpage = 'install/step1.tpl';
+	$objPage->tpl_mode = 'step1';
+	return $objPage;
+}
+
+// STEP2²èÌÌ¤ÎÉ½¼¨
+function lfDispStep2($objPage) {
+	global $objWebParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	$objPage->tpl_mainpage = 'install/step2.tpl';
+	$objPage->tpl_mode = 'step2';
+	return $objPage;
+}
+
+// STEP3²èÌÌ¤ÎÉ½¼¨
+function lfDispStep3($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'install/step3.tpl';
+	$objPage->tpl_mode = 'step3';
+	return $objPage;
+}
+
+// ´°Î»²èÌÌ¤ÎÉ½¼¨
+function lfDispComplete($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'install/complete.tpl';
+	$objPage->tpl_mode = 'complete';
+	return $objPage;
+}
+
+// WEB¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+function lfInitWebParam($objWebParam) {
+	
+	$install_dir = ereg_replace("html/", "", $_SERVER['DOCUMENT_ROOT']);
+	$normal_url = "http://" . $_SERVER['HTTP_HOST'] . "/";
+	$secure_url = "https://" . $_SERVER['HTTP_HOST'] . "/";
+	$domain = ereg_replace("^[a-zA-Z0-9_~=&\?\/-]+\.", "", $_SERVER['HTTP_HOST']);
+		
+	$objWebParam->addParam("¥¤¥ó¥¹¥È¡¼¥ë¥Ç¥£¥ì¥¯¥È¥ê", "install_dir", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $install_dir);
+	$objWebParam->addParam("URL(ÄÌ¾ï)", "normal_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $normal_url);
+	$objWebParam->addParam("URL(¥»¥­¥å¥¢)", "secure_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $secure_url);
+	$objWebParam->addParam("¥É¥á¥¤¥ó", "domain", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $domain);	
+	
+	return $objWebParam;
+}
+
+// WEB¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+function lfInitDBParam($objDBParam) {
+	
+	$db_server = "127.0.0.1";
+	$db_name = "eccube_db";
+	$db_user = "eccube_db_user";
+	
+	$objDBParam->addParam("DB¤Î¼ïÎà", "db_type", INT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objDBParam->addParam("DB¥µ¡¼¥Ð", "db_server", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_server);
+	$objDBParam->addParam("DBÌ¾", "db_name", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_name);
+	$objDBParam->addParam("DB¥æ¡¼¥¶", "db_user", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_user);
+	$objDBParam->addParam("DB¥Ñ¥¹¥ï¡¼¥É", "db_password", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"));	
+	return $objDBParam;
+}
+
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckWebError($objFormParam) {
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	return $objErr->arrErr;
+}
+
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckDBError($objFormParam) {
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if(count($objErr->arrErr) == 0) {
+		// ÀÜÂ³³ÎÇ§
+		$dsn = "pgsql://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server']."/".$arrRet['db_name'];
+		$objDB = DB::connect($dsn);
+		// ÀÜÂ³¥¨¥é¡¼
+		if(PEAR::isError($objDB)) {
+			$objErr->arrErr['all'] = ">> " . $objDB->message;
+			gfPrintLog($objDB->userinfo);
+		}
+	}		
+	return $objErr->arrErr;
+}
+
+// SQLÊ¸¤Î¼Â¹Ô
+function lfExecuteSQL($filepath, $db_user, $db_password, $db_server, $db_name) {
+	$arrErr = array();
+	
+	if(!file_exists($filepath)) {
+		$arrErr['all'] = ">> ¥¹¥¯¥ê¥×¥È¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó";
+	} else {
+  		if($fp = fopen($filepath,"r")) {
+			$sql = fread($fp, filesize($filepath));
+			fclose($fp);
+		}
+			
+		$dsn = "pgsql://".$db_user.":".$db_password."@".$db_server."/".$db_name;
+		$objDB = DB::connect($dsn);
+		// ÀÜÂ³¥¨¥é¡¼
+		if(!PEAR::isError($objDB)) {
+			$ret = $objDB->query($sql);
+			if(PEAR::isError($ret)) {
+				$arrErr['all'] = ">> " . $ret->message;
+				gfPrintLog($ret->userinfo);
+			}
+		} else {
+			$arrErr['all'] = ">> " . $objDB->message;
+			gfPrintLog($objDB->userinfo);
+		}
+	}
+	return $arrErr;
+}
+
+// ÀßÄê¥Õ¥¡¥¤¥ë¤ÎºîÀ®
+function lfMakeConfigFile() {
+	global $objWebParam;
+	global $objDBParam;
+	
+	$filepath = $objWebParam->getValue('install_dir') . "/html/install.inc";
+	$domain = $objWebParam->getValue('domain');
+	if(!ereg("^\.", $domain)) {
+		$domain = "." . $domain;
+	}
+	
+	$root_dir = $objWebParam->getValue('install_dir');
+	if (!ereg("/$", $root_dir)) {
+		$root_dir = $root_dir . "/";
+	}
+	
+	$config_data = 
+	"<?php\n".
+	"    define ('ECCUBE_INSTALL', 'ON');\n" .
+	"    define ('ROOT_DIR', '" . $root_dir . "');\n" . 
+	"    define ('SITE_URL', '" . $objWebParam->getValue('normal_url') . "');\n" .
+	"    define ('SSL_URL', '" . $objWebParam->getValue('secure_url') . "');\n" .
+	"    define ('DOMAIN_NAME', '" . $domain . "');\n" .
+	"    define ('DB_USER', '" . $objDBParam->getValue('db_user') . "');\n" . 
+	"    define ('DB_PASSWORD', '" . $objDBParam->getValue('db_password') . "');\n" .
+	"    define ('DB_SERVER', '" . $objDBParam->getValue('db_server') . "');\n" .
+	"    define ('DB_NAME', '" . $objDBParam->getValue('db_name') . "');\n" .
+	"?>";
+	
+	if($fp = fopen($filepath,"w")) {
+		fwrite($fp, $config_data);
+		fclose($fp);
+	}
+}
+
+// ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Î¥Õ¥¡¥¤¥ë¤òºÆµ¢Åª¤Ë¥³¥Ô¡¼
+function lfCopyDir($src, $des, $mess, $override = false){
+	if(!is_dir($src)){
+		return false;
+	}
+
+	$oldmask = umask(0);
+	$mod= stat($src);
+	
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+	if(!file_exists($des)) {
+		mkdir($des, $mod[2]);
+	}
+	
+	$fileArray=glob( $src."*" );
+	foreach( $fileArray as $key => $data_ ){
+		// CVS´ÉÍý¥Õ¥¡¥¤¥ë¤Ï¥³¥Ô¡¼¤·¤Ê¤¤
+		if(ereg("/CVS/Entries", $data_)) {
+			break;
+		}
+		if(ereg("/CVS/Repository", $data_)) {
+			break;
+		}
+		if(ereg("/CVS/Root", $data_)) {
+			break;
+		}
+		
+		mb_ereg("^(.*[\/])(.*)",$data_, $matches);
+		$data=$matches[2];
+		if( is_dir( $data_ ) ){
+			$mess = lfCopyDir( $data_.'/', $des.$data.'/', $mess);
+		}else{
+			if(!$override && file_exists($des.$data)) {
+				$mess.= $des.$data . "¡§¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤¹\n";
+			} else {
+				if(copy( $data_, $des.$data)) {
+					$mess.= $des.$data . "¡§¥³¥Ô¡¼À®¸ù\n";
+				} else {
+					$mess.= $des.$data . "¡§¥³¥Ô¡¼¼ºÇÔ\n";
+				}
+			}
+			$mod=stat($data_ );
+		}
+	}
+	umask($oldmask);
+	return $mess;
+}
+?>
Index: /temp/trunk/html/install/zip_install.php
===================================================================
--- /temp/trunk/html/install/zip_install.php	(revision 1328)
+++ /temp/trunk/html/install/zip_install.php	(revision 1328)
@@ -0,0 +1,91 @@
+<?php
+
+require_once("../require.php");
+
+define("ZIP_CSV_LINE_MAX", 8192);
+define("IMAGE_MAX", 680);	// ²èÁü¤ÎÉ½¼¨¸Ä¿ô
+
+$path = ROOT_DIR . "html/install/KEN_ALL.CSV";
+
+$objQuery = new SC_Query();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$fp = fopen($path, "r");
+
+// °ìÉô¤ÎIE¤Ï256¥Ð¥¤¥È°Ê¾å¼õ¤±¼è¤Ã¤Æ¤«¤éÉ½¼¨¤ò³«»Ï¤¹¤ë¡£
+for($i = 0; $i < 256; $i++) {
+	print(" ");
+}
+print("\n");
+flush();
+
+if(!$fp) {
+	sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+} else {
+	print("<img src='/img/install/main_w.jpg'><br>");
+	flush();
+	
+	// CSV¤Î·ï¿ô¤ò¿ô¤¨¤ë
+	$line = 0;
+	while(!feof($fp)) {
+		fgets($fp, ZIP_CSV_LINE_MAX);
+		$line++;
+	}
+	
+	print("<img src='/img/install/space_w.gif'>");
+	flush();
+		
+	// ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤òÌá¤¹
+	fseek($fp, 0);
+	
+	// ²èÁü¤ò°ì¸ÄÉ½¼¨¤¹¤ë·ï¿ô¤òµá¤á¤ë¡£
+	$disp_line = intval($line / IMAGE_MAX);
+	
+	// ´û¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤ò¿ô¤¨¤ë
+	$end_cnt = $objQuery->count("mtb_zip");
+	
+	$cnt = 1;
+	$img_cnt = 0;
+	while (!feof($fp)) {
+		$arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX);
+		
+		// ¤¹¤Ç¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤òÈô¤Ð¤¹¡£
+		if($cnt > $end_cnt) {
+			$sqlval['code'] = $arrCSV[0];
+			$sqlval['old_zipcode'] = $arrCSV[1];
+			$sqlval['zipcode'] = $arrCSV[2];
+			$sqlval['state_kana'] = $arrCSV[3];
+			$sqlval['city_kana'] = $arrCSV[4];
+			$sqlval['town_kana'] = $arrCSV[5];
+			$sqlval['state'] = $arrCSV[6];
+			$sqlval['city'] = $arrCSV[7];
+			$sqlval['town'] = $arrCSV[8];
+			$sqlval['flg1'] = $arrCSV[9];
+			$sqlval['flg2'] = $arrCSV[10];
+			$sqlval['flg3'] = $arrCSV[11];
+			$sqlval['flg4'] = $arrCSV[12];
+			$sqlval['flg5'] = $arrCSV[13];
+			$sqlval['flg6'] = $arrCSV[14];	
+			$objQuery->insert("mtb_zip", $sqlval);
+		}
+		
+		$cnt++;
+		// $disp_line·ï¤´¤È¤Ë¿ÊÄ½É½¼¨¤¹¤ë
+		if($cnt % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
+			print("<img src='/img/install/graph_1_w.gif'>");
+			flush();
+			$img_cnt++;
+		}
+	}
+	
+	print($cnt - 1 . "/" . $line);
+	
+	fclose($fp);
+	print("<img src='/img/install/space_w.gif'>");
+}
+
+
+?>
Index: /temp/trunk/html/install/user_data/__default.php
===================================================================
--- /temp/trunk/html/install/user_data/__default.php	(revision 1328)
+++ /temp/trunk/html/install/user_data/__default.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'] . "require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage);
+
+// ²èÌÌ¤ÎÉ½¼¨
+ $objView->assignobj($objPage);
+ $objView->display(SITE_FRAME);
+ 
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/trunk/html/install/user_data/js/site.js
===================================================================
--- /temp/trunk/html/install/user_data/js/site.js	(revision 1328)
+++ /temp/trunk/html/install/user_data/js/site.js	(revision 1328)
@@ -0,0 +1,231 @@
+// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+function fnIsopener() {
+    var ua = navigator.userAgent;
+    if( !!window.opener ) {
+        if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) {
+            return !window.opener.closed;
+        } else {
+        	return typeof window.opener.document == 'object';
+        }
+	} else {
+		return false;
+	}
+}
+
+// Í¹ÊØÈÖ¹æÆþÎÏ¸Æ¤Ó½Ð¤·
+function fnCallAddress(php_url, tagname1, tagname2, input1, input2) {
+	zip1 = document.form1[tagname1].value;
+	zip2 = document.form1[tagname2].value;
+	
+	if(zip1.length == 3 && zip2.length == 4) {
+		url = php_url + "?zip1=" + zip1 + "&zip2=" + zip2 + "&input1=" + input1 + "&input2=" + input2;
+		window.open(url,"nomenu","width=500,height=350,scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+	} else {
+		alert("Í¹ÊØÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£");
+	}
+}
+
+// Í¹ÊØÈÖ¹æ¤«¤é¸¡º÷¤·¤¿½»½ê¤òÅÏ¤¹¡£
+function fnPutAddress(input1, input2) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		if(document.form1['state'].value != "") {
+			// ¹àÌÜ¤ËÃÍ¤òÆþÎÏ¤¹¤ë¡£
+			state_id = document.form1['state'].value;
+			town = document.form1['city'].value + document.form1['town'].value;
+			window.opener.document.form1[input1].selectedIndex = state_id;
+			window.opener.document.form1[input2].value = town;
+		}
+	} else {
+		window.close();
+	}		
+}
+
+function fnOpenNoMenu(URL) {
+	window.open(URL,"nomenu","scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+}
+
+// ¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë
+function fnSetFocus(name) {
+	if(document.form1[name]) {
+		document.form1[name].focus();
+	}
+}
+
+// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤Ë¹àÌÜ¤ò³ä¤êÅö¤Æ¤ë¡£
+function fnSetSelect(name1, name2, val) {
+	sele1 = document.form1[name1]; 
+	sele2 = document.form1[name2];
+	
+	if(sele1 && sele2) {
+		index=sele1.selectedIndex;
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤Î¥¯¥ê¥¢	
+		count=sele2.options.length
+		for(i = count; i >= 0; i--) {
+			sele2.options[i]=null;
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ËÃÍ¤ò³ä¤êÅö¤Æ¤ë
+		len = lists[index].length
+		for(i = 0; i < len; i++) {
+			sele2.options[i]=new Option(lists[index][i], vals[index][i]);
+			if(val != "" && vals[index][i] == val) {
+				sele2.options[i].selected = true;
+			}
+		}
+	}
+}
+
+// Enter¥­¡¼ÆþÎÏ¤ò¥­¥ã¥ó¥»¥ë¤¹¤ë¡£(IE¤ËÂÐ±þ)
+function fnCancelEnter()
+{
+	if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
+		if (window.event.keyCode == 13)
+		{
+			return false;
+		}
+	}
+	return true;
+}
+
+// ¥â¡¼¥É¤È¥­¡¼¤ò»ØÄê¤·¤ÆSUBMIT¤ò¹Ô¤¦¡£
+function fnModeSubmit(mode, keyname, keyid) {
+
+	switch(mode) {
+	case 'delete':
+		if(!window.confirm('ÆþÎÏÆâÍÆ¤òºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+			return;
+		}
+		break;
+	case 'confirm':
+		if(!window.confirm('ÆþÎÏÆâÍÆ¤òÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+			return;
+		}
+		break;
+	case 'delete_all':
+		if(!window.confirm('¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+			return;
+		}
+		break;
+	default:
+		break;
+	}
+	document.form1['mode'].value = mode;
+	if(keyname != "" && keyid != "") {
+		document.form1[keyname].value = keyid;
+	}
+	document.form1.submit();
+
+}
+
+function fnFormModeSubmit(form, mode, keyname, keyid) {
+	document.forms[form]['mode'].value = mode;
+	if(keyname != "" && keyid != "") {
+		document.forms[form][keyname].value = keyid;
+	}
+	document.forms[form].submit();
+}
+
+function fnChangeAction(url) {
+	document.form1.action = url;
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+function fnNaviPage(pageno) {
+	document.form1['pageno'].value = pageno;
+	document.form1.submit();
+}
+
+// ¥Ý¥¤¥ó¥ÈÆþÎÏÀ©¸Â
+function fnCheckInputPoint() {
+	if(document.form1['point_check']) {
+		list = new Array(
+						'use_point'
+						);
+	
+		if(!document.form1['point_check'][0].checked) {
+			color = "#dddddd";
+			flag = true;
+		} else {
+			color = "";
+			flag = false;
+		}
+		
+		len = list.length
+		for(i = 0; i < len; i++) {
+			if(document.form1[list[i]]) {
+				document.form1[list[i]].disabled = flag;
+				document.form1[list[i]].style.backgroundColor = color;
+			}
+		}
+	}
+}
+
+// ÊÌ¤Î¤ªÆÏ¤±ÀèÆþÎÏÀ©¸Â
+function fnCheckInputDeliv() {
+	list = new Array(
+					'deliv_name01',
+					'deliv_name02',
+					'deliv_kana01',
+					'deliv_kana02',
+					'deliv_pref',
+					'deliv_zip01',
+					'deliv_zip02',
+					'deliv_addr01',
+					'deliv_addr02',
+					'deliv_tel01',
+					'deliv_tel02',
+					'deliv_tel03'
+					);
+
+	if(!document.form1['deliv_check'].checked) {
+		color = "#dddddd";
+		flag = true;
+	} else {
+		color = "";
+		flag = false;
+	}
+	
+	len = list.length
+	for(i = 0; i < len; i++) {
+		if(document.form1[list[i]]) {
+			document.form1[list[i]].disabled = flag;
+			document.form1[list[i]].style.backgroundColor = color;
+		}
+	}
+}
+
+
+// ¥í¥°¥¤¥ó»þ¤ÎÆþÎÏ¥Á¥§¥Ã¥¯
+function fnCheckLogin(formname) {
+	var lstitem = new Array();
+	lstitem[0] = 'login_email';
+	lstitem[1] = 'login_pass';
+
+	var max = lstitem.length;
+	var errflg = false;
+	var cnt = 0;
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.forms[formname][lstitem[cnt]].value == "") {
+			errflg = true;
+			break;
+		}
+	}
+	
+	// É¬¿Ü¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç	
+	if(errflg == true) {
+		alert('¥á¡¼¥ë¥¢¥É¥ì¥¹/¥Ñ¥¹¥ï¡¼¥É¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£');
+		return false;
+	}
+}
+
+// »þ´Ö¤Î·×Â¬
+function fnPassTime(){
+	end_time = new Date();
+	time = end_time.getTime() - start_time.getTime();
+	alert((time/1000));
+}
+start_time = new Date();
Index: /temp/trunk/html/install/user_data/js/css.js
===================================================================
--- /temp/trunk/html/install/user_data/js/css.js	(revision 1328)
+++ /temp/trunk/html/install/user_data/js/css.js	(revision 1328)
@@ -0,0 +1,79 @@
+gCssUA = navigator.userAgent.toUpperCase();
+gCssBrw = navigator.appName.toUpperCase();
+
+with (document) {
+		write("<style type=\"text/css\"><!--");
+
+
+//WIN-IE
+	if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
+		write(".fs10 {font-size: 62.5%; line-height: 150%; letter-spacing:1px;}");
+		write(".fs12 {font-size: 75%; line-height: 150%; letter-spacing:1.5px;}");
+		write(".fs14 {font-size: 87.5%; line-height: 150%; letter-spacing:2px;}");
+		write(".fs18 {font-size: 117.5%; line-height: 130%; letter-spacing:2.5px;}");
+		write(".fs22 {font-size: 137.5%; line-height: 130%; letter-spacing:3px;}");
+		write(".fs24 {font-size: 150%; line-height: 130%; letter-spacing:3px;}");
+		write(".fs30 {font-size: 187.5%; line-height: 125%; letter-spacing:3.5px;}");
+		write(".fs10n {font-size: 62.5%; letter-spacing:1px;}");
+		write(".fs12n {font-size: 75%; letter-spacing:1.5px;}");
+		write(".fs14n {font-size: 87.5%; letter-spacing:2px;}");
+		write(".fs18n {font-size: 117.5%; letter-spacing:2.5px;}");
+		write(".fs22n {font-size: 137.5%; letter-spacing:1px;}");
+		write(".fs24n {font-size: 150%; letter-spacing:1px;}");
+		write(".fs30n {font-size: 187.5%; letter-spacing:1px;}");
+	}
+
+//WIN-NN
+	if (gCssUA.indexOf("WIN") != -1 && gCssBrw.indexOf("NETSCAPE") != -1) {
+		write(".fs10 {font-size:72%; line-height:130%;}");
+		write(".fs12 {font-size: 75%; line-height: 150%;}");
+		write(".fs14 {font-size: 87.5%; line-height: 140%;}");
+		write(".fs18 {font-size: 117.5%; line-height: 130%;}");
+		write(".fs22 {font-size: 137.5%; line-height: 130%;}");
+		write(".fs24 {font-size: 150%; line-height: 130%;}");
+		write(".fs30 {font-size: 187.5%; line-height: 120%;}");
+		write(".fs10n {font-size:72%;}");
+		write(".fs12n {font-size: 75%;}");
+		write(".fs14n {font-size: 87.5%;}");
+		write(".fs18n {font-size: 117.5%;}");
+		write(".fs22n {font-size: 137.5%;}");
+		write(".fs24n {font-size: 150%;}");
+		write(".fs30n {font-size: 187.5%;}");
+	}
+
+//WIN-NN4.x
+	if ( navigator.appName == "Netscape" && navigator.appVersion.substr(0,2) == "4." ) {
+		write(".fs10 {font-size:90%; line-height: 130%;}");
+		write(".fs12 {font-size: 100%; line-height: 140%;}");
+		write(".fs14 {font-size: 110%; line-height: 135%;}");
+		write(".fs18 {font-size: 130%; line-height: 175%;}");
+		write(".fs24 {font-size: 190%; line-height: 240%;}");
+		write(".fs30 {font-size: 240%; line-height: 285%;}");
+		write(".fs10n {font-size:90%;}");
+		write(".fs12n {font-size: 100%;}");
+		write(".fs14n {font-size: 110%;}");
+		write(".fs18n {font-size: 130%;}");
+		write(".fs24n {font-size: 190%;}");
+		write(".fs30n {font-size: 240%;}");
+	}
+
+//MAC
+	if (gCssUA.indexOf("MAC") != -1) {
+		write(".fs10 {font-size: 10px; line-height: 14px;}");
+		write(".fs12 {font-size: 12px; line-height: 18px;}");
+		write(".fs14 {font-size: 14px; line-height: 18px;}");
+		write(".fs18 {font-size: 18px; line-height: 23px;}");
+		write(".fs22 {font-size: 22px; line-height: 27px;}");
+		write(".fs24 {font-size: 24px; line-height: 30px;}");
+		write(".fs30 {font-size: 30px; line-height: 35px;}");
+		write(".fs10n {font-size: 10px;}");
+		write(".fs12n {font-size: 12px;}");
+		write(".fs14n {font-size: 14px;}");
+		write(".fs18n {font-size: 18px;}");
+		write(".fs22n {font-size: 22px;}");
+		write(".fs24n {font-size: 24px;}");
+		write(".fs30n {font-size: 30px;}");
+	}
+
+	write("--></style>");
+}
Index: /temp/trunk/html/install/user_data/js/win_op.js
===================================================================
--- /temp/trunk/html/install/user_data/js/win_op.js	(revision 1328)
+++ /temp/trunk/html/install/user_data/js/win_op.js	(revision 1328)
@@ -0,0 +1,38 @@
+<!--
+	function win01(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+	
+<!--
+	function win02(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+
+<!--
+	function win03(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=yes,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+
+<!--
+	function ChangeParent()
+	{
+		window.opener.location.href="../contact/index.php";
+	}
+//-->
+
+
+<!--//
+function CloseChild()
+{
+	window.close();
+}
+//-->
Index: /temp/trunk/html/install/user_data/js/navi.js
===================================================================
--- /temp/trunk/html/install/user_data/js/navi.js	(revision 1328)
+++ /temp/trunk/html/install/user_data/js/navi.js	(revision 1328)
@@ -0,0 +1,32 @@
+	var preLoadFlag = "false";
+
+	function preLoadImg(){
+		arrImgList = new Array (
+			"/img/header/entry_on.gif","/img/header/contact_on.gif","/img/header/cartin_on.gif",
+			"/img/header/fashion_on.gif","/img/header/jewely_on.gif","/img/header/electronic_on.gif","/img/header/pc_on.gif","/img/header/beauty_on.gif","/img/header/tv_on.gif","/img/header/login_on.gif",
+			"/img/left/shopping_on.gif","/img/left/flow_on.gif","/img/left/faq_on.gif","/img/left/mailmagazine_on.gif","/img/left/point_on.gif","/img/left/fax_on.gif","/img/left/order_on.gif",
+			"/img/right_product/detail_on.gif","/img/right_product/review_on.gif","/img/right_product/cart_on.gif",
+			"/img/top/backnumber_on.jpg","/img/top/diary01_on.gif","/img/top/diary02_on.gif","/img/top/more_on.gif",
+			"/img/button/fortop_on.gif","/img/button/back_on.gif","/img/button/back02_on.gif","/img/button/back03_on.gif","/img/button/next_on.gif","/img/button/close_on.gif","/img/button/confirm_on.gif","/img/button/entry_on.gif","/img/button/next_on.gif","/img/button/reji_on.gif","/img/button/send_on.gif","/img/button/top_on.gif",
+			"/img/right_mailmagazine/entry_on.gif","/img/right_mailmagazine/release_on.gif",
+			"/img/shopping/complete_on.gif","/img/shopping/loan_on.gif","/img/login/log_on.gif",
+			"/img/fotter/movement_on.gif","/img/fotter/privacy_on.gif","/img/fotter/tokado_on.gif"
+		);
+		arrPreLoad = new Array();
+		for (i in arrImgList) {
+			arrPreLoad[i] = new Image();
+			arrPreLoad[i].src = arrImgList[i];
+		}
+		preLoadFlag = "true";
+	}
+
+	function chgImg(fileName,imgName){
+		if (preLoadFlag == "true") {
+			document.images[imgName].src = fileName;
+		}
+	}
+
+
+function chgImgImageSubmit(fileName,imgObj){
+	imgObj.src = fileName;
+}
Index: /temp/trunk/html/rss/index.php
===================================================================
--- /temp/trunk/html/rss/index.php	(revision 1328)
+++ /temp/trunk/html/rss/index.php	(revision 1328)
@@ -0,0 +1,77 @@
+<?php
+//¶¦ÄÌÉôÉÊ¤ÎÆÉ¤ß¹þ¤ß
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "rss/index.tpl";
+		$this->encode = "UTF-8";
+		$this->description = "¿·Ãå¾ðÊó";
+	}
+}
+
+$objQuery = new SC_Query();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+//¿·Ãå¾ðÊó¤ò¼èÆÀ
+$arrNews = lfGetNews($objQuery);
+
+//¥­¥ã¥Ã¥·¥å¤·¤Ê¤¤(Ç°¤Î¤¿¤á)
+header("Paragrama: no-cache");
+
+//XML¥Æ¥­¥¹¥È(¤³¤ì¤¬¤Ê¤¤¤ÈÀµ¾ï¤ËRSS¤È¤·¤ÆÇ§¼±¤·¤Æ¤¯¤ì¤Ê¤¤¥Ä¡¼¥ë¤¬¤¢¤ë¤¿¤á)
+header("Content-type: application/xml");
+
+//¿·Ãå¾ðÊó¤ò¥»¥Ã¥È
+$objPage->arrNews = $arrNews;		
+
+//Å¹Ì¾¤ò¥»¥Ã¥È
+$objPage->site_title = $arrNews[0]['shop_name'];
+
+//ÂåÉ½Email¥¢¥É¥ì¥¹¤ò¥»¥Ã¥È
+$objPage->email = $arrNews[0]['email'];
+
+//DESCRIPTION¤ò¥»¥Ã¥È
+$objPage->description = $objPage->description;
+
+//XML¥Õ¥¡¥¤¥ë¤Î¥¨¥ó¥³¡¼¥É¤ò¥»¥Ã¥È
+$objPage->encode = $objPage->encode;
+
+//¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ
+$objView->assignobj($objPage);
+
+//²èÌÌÉ½¼¨
+$objView->display($objPage->tpl_mainpage);
+
+//******************************************************************************************/
+/*
+ * ´Ø¿ôÌ¾:lfGetNews
+ * ÀâÌÀ¡¡:¿·Ãå¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô£±:$objQuery		DBÁàºî¥¯¥é¥¹
+ * Ìá¤êÃÍ:$arrNews		¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹
+ */
+function lfGetNews($objQuery){
+	$col = "";
+	$col .= "     news_id ";								//¿·Ãå¾ðÊóID
+	$col .= "     ,news_title ";								//¿·Ãå¾ðÊó¥¿¥¤¥È¥ë
+	$col .= "     ,news_comment ";							//¿·Ãå¾ðÊóËÜÊ¸
+	$col .= "     ,to_char(news_date, 'YYYY') AS YEAR ";	//ÆüÉÕ(Ç¯)
+	$col .= "     ,to_char(news_date, 'MM') AS MONTH ";		//ÆüÉÕ(·î)
+	$col .= "     ,to_char(news_date, 'DD') AS DAY ";		//ÆüÉÕ(Æü)
+	$col .= "     ,to_char(news_date, 'HH24') AS HOUR ";	//ÆüÉÕ(»þ´Ö)
+	$col .= "     ,to_char(news_date, 'MI') AS MINUTE ";	//ÆüÉÕ(Ê¬)
+	$col .= "     ,to_char(news_date, 'SS') AS SECOND ";		//ÆüÉÕ(ÉÃ)
+	$col .= "     ,news_url ";								//¿·Ãå¾ðÊóURL
+	$col .= "     ,news_select ";							//¿·Ãå¾ðÊó¤Î¶èÊ¬(1:URL¡¢2:ËÜÊ¸)
+	$col .= "     ,(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";	//Å¹Ì¾
+	$col .= "     ,(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";			//ÂåÉ½Email¥¢¥É¥ì¥¹
+	$from = "dtb_news";
+	$where = "delete = '0'";
+	$order = "rank DESC";
+	$objQuery->setorder($order);
+	$arrNews = $objQuery->select($col,$from,$where);
+	return $arrNews;
+}
+    
+?>
Index: /temp/trunk/html/flow/index.php
===================================================================
--- /temp/trunk/html/flow/index.php	(revision 1328)
+++ /temp/trunk/html/flow/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/flow/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'flow/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'flow';				
+		$this->tpl_title = '¤ªÇã¤¤Êª¤ÎÎ®¤ì';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/input_zip.php
===================================================================
--- /temp/trunk/html/input_zip.php	(revision 1328)
+++ /temp/trunk/html/input_zip.php	(revision 1328)
@@ -0,0 +1,75 @@
+<?php
+require_once("./require.php");
+
+class LC_Page {
+	var $tpl_state;
+	var $tpl_city;
+	var $tpl_town;
+	var $tpl_onload;
+	var $tpl_message;
+	function CPage() {
+		$this->tpl_message = "½»½ê¤ò¸¡º÷¤·¤Æ¤¤¤Þ¤¹¡£";
+	}
+}
+
+$conn = new SC_DBconn(ZIP_DSN);
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+$arrErr = fnErrorCheck();
+
+// ÆþÎÏ¥¨¥é¡¼¤Î¾ì¹ç¤Ï½ªÎ»
+if(count($arrErr) > 0) {
+	$objPage->tpl_start = "window.close();";
+}
+
+// Í¹ÊØÈÖ¹æ¸¡º÷Ê¸ºîÀ®
+$zipcode = $_GET['zip1'].$_GET['zip2'];
+$zipcode = mb_convert_kana($zipcode ,"n");
+$sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
+
+$data_list = $conn->getAll($sqlse, array($zipcode));
+
+// ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃÍ¤òÈ¿Å¾¤µ¤»¤ë¡£
+$arrREV_PREF = array_flip($arrPref);
+
+$objPage->tpl_state = $arrREV_PREF[$data_list[0]['state']];
+$objPage->tpl_city = $data_list[0]['city'];
+$town =  $data_list[0]['town'];
+/*
+	ÁíÌ³¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
+	°Ê²¼¤Î¤è¤¦¤ÊÊ¸»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç	ÂÐºö¤¹¤ë¡£
+	¡¦¡Ê£±¢·£±£¹ÃúÌÜ¡Ë
+	¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
+*/
+$town = ereg_replace("¡Ê.*¡Ë$","",$town);
+$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
+$objPage->tpl_town = $town;
+
+// Í¹ÊØÈÖ¹æ¤¬È¯¸«¤µ¤ì¤¿¾ì¹ç
+if(count($data_list) > 0) {
+	$func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');";
+	$objPage->tpl_onload = "$func";
+	$objPage->tpl_start = "window.close();";
+} else {
+	$objPage->tpl_message = "³ºÅö¤¹¤ë½»½ê¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£";
+}
+
+/* ¥Ú¡¼¥¸¤ÎÉ½¼¨¡¡*/
+$objView->assignobj($objPage);
+$objView->display("input_zip.tpl");
+
+/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
+function fnErrorCheck() {
+	// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ÇÛÎó¤Î½é´ü²½
+	$objErr = new SC_CheckError();
+	
+	// Í¹ÊØÈÖ¹æ
+	$objErr->doFunc( array("Í¹ÊØÈÖ¹æ1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK" ) );
+	$objErr->doFunc( array("Í¹ÊØÈÖ¹æ2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK" ) );
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/order/index.php
===================================================================
--- /temp/trunk/html/order/index.php	(revision 1328)
+++ /temp/trunk/html/order/index.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/order/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'order/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'order';	
+		$this->tpl_title = 'ÆÃÄê¾¦¼è°úË¡¤Ë´Ø¤¹¤ëË¡Î§';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$arrRet = $objQuery->getall("SELECT * FROM dtb_baseinfo",array());
+$objPage->arrRet = $arrRet[0];
+$objPage->arrPref = $arrPref;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/room/index.php
===================================================================
--- /temp/trunk/html/room/index.php	(revision 1328)
+++ /temp/trunk/html/room/index.php	(revision 1328)
@@ -0,0 +1,48 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../css/sub.css" type="text/css" media="all" />
+<link rel="stylesheet" href="../css/layout/answer/index.css" type="text/css" media="all" />
+<script type="text/javascript" src="../js/css.js"></script>
+<script type="text/javascript" src="../js/navi.js"></script>
+<script type="text/javascript" src="../js/win_op.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-ËÌ¤µ¤ó¤Î¾®Éô²°</title>
+</head>
+	
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../css/common.css" type="text/css" />
+</noscript>
+<a name="top" id="top"></a><div id="layout">
+
+
+<!--¢§CONTENTS-->
+<div id="maintitle"><img src="../img/room/title.jpg" width="570" height="40" alt="ËÌ¤µ¤ó¤Î¾®Éô²°" /></div>
+<table width="500" cellspacing="0" cellpadding="0" summary=" " id="frame">
+	<tr>
+		<td class="fs12">¤É¤¦¤â!½é¤á¤Þ¤·¤Æ¡£<br />
+		º£²ó¤è¤ê¥Û¡¼¥à¥Ú¡¼¥¸¤Î¥ê¥Ë¥å¡¼¥¢¥ë¤ËºÝ¤·¡¢¤³¤Î¡ØËÌ¤µ¤ó¤Î¾®Éô²°¡Ù¤ÎÃ´Åö¤Ë¤Ê¤ê¤Þ¤·¤¿ÆÃÇÉ°÷M¤Ç¤¹¡ª¡ª<br />
+		¤³¤ì¤«¤é¡¢ÉÔÄê´üÅª¤Ë¤Ê¤ë¤«¤È»×¤¦¤Î¤Ç¤¹¤¬¡¦¡¦¡¦¡¦¡¢¤¦¤Á¤Î¼ÒÄ¹¡ÖËÌ¤µ¤ó¡×¤ò¥ì¥Ý¡¼¥È¤·¤Æ¤¤¤­¤¿¤¤¤È»×¤¤¤Þ¤¹!!<br />
+		¤É¤¦¤¾µ¹¤·¤¯¤ª´ê¤¤¤·¤Þ¤¹¡£¡¦¡¦¡¦!<br />
+		¤µ¤Æ¤µ¤Æ¡¢Âè°ì²óÌÜ¤Î¥ì¥Ý¡¼¥È¤Ç¤¹¤¬¡¢Á´¹ñ³ÆÃÏ¡¢¤½¤·¤ÆÀ¤³¦³ÆÃÏ¤òÈô¤Ó¤Þ¤ï¤Ã¤Æ¤¤¤ë¼ÒÄ¹¤Ç¤¹¤¬¡¢ÀèÆü¡¢ËÌ³¤Æ»¤Ø¹Ô¤Ã¤Æ¤³¤é¤ì¤¿¤è¤¦¤Ç¤¹¡£<br />
+		¤½¤ÎÌÜÅª¤Ï¡¦¡¦¡¦¡¦¡¦¡¦¡¢¡Ø³ª¡Ù!!<br />
+		¤½¤¦¤Ç¤¹!ËÌ³¤Æ»¤Î¿©ÉÊ¤òÃµ¤·¤Ë¹Ô¤Ã¤Æ¤³¤é¤ì¤Æ¤Þ¤·¤¿!!<br />
+		¤³¤Î»þ´ü¤ÎËÌ³¤Æ»¡¦¡¦¡¦¡Ö´¨¤¤¤ó¤À¤í¤¦¤Ê¤¡¡¼¡×¤È»×¤ï¤ì¤Æ¤¤¤¿¤è¤¦¤Ç¤¹¤¬¡¢¤½¤ì¤Û¤É¤Î´¨¤µ¤Ç¤â¤Ê¤«¤Ã¤¿¤è¤¦¤Ç¾¯¤·Çï»ÒÈ´¤±¤·¤Æ¤¤¤¿¤è¤¦¤Ç¤¹¤¬¡¦¡¦¡¦¡¦¡¦¤Ç¤âËÌ³¤Æ»¤Ç¤¹¡£¤ä¤Ï¤ê´¨¤«¤Ã¤¿!!<br />
+		º£²ó¤Ï¡¢ËÌ³¤Æ»¤ÎÆÃ»ºÊª¤òÃµ¤·¤Ë¤È¸À¤¦¤³¤È¤Ç¡¢³ª¤ò¸«¤Ë¹Ô¤­¤Þ¤·¤¿¡£<br />
+		¤ä¤Ï¤êËÜ¾ì¤Î³ª¤Ç¤¹!!¤É¤ì¤âÎ©ÇÉ¤Ê¤â¤Î¤Ð¤«¤ê!!<br />
+		¡Ö¤³¤³¤Î³ª¤ò¤ªµÒÍÍ¤Î¿©Âî¤Ø¤ªÆÏ¤±¤·¤è¤¦!!¡×¤È¸À¤¦¤³¤È¤Ç¡¢¾¦ÃÌ¤Ë¤â¤¤¤Ä¤â¤Ë¤â¤Þ¤·¤ÆÇ®¤¬Æþ¤Ã¤Æ¤Þ¤·¤¿¡£<br />
+		¤â¤Á¤í¤ó¡¢¤ª¤¤¤·¤¤³ª¤â¤´ÃÚÁö¤Ë¤Ê¤ê¡¢º£²ó¤Î½ÐÄ¥¤âÂçÀ®¸ù¤Î¤è¤¦¤Ç¤·¤¿!!<br />
+		³§¤µ¤ó¤â¡¢ËÌ¤µ¤ó¸·Áª¤ÎËÌ³¤Æ»¤Î¡Ø³ª¡Ù¡¢À§Èó¤È¤â¤´¾ÞÌ£²¼¤µ¤¤!!¡¦¡¦¡¦</td>
+	</tr>
+</table>
+<div id="button"><a href="javascript:window.close()" onmouseOver="chgImg('../img/button/close_on.gif','close');" onmouseOut="chgImg('../img/button/close.gif','close');"><img src="../img/button/close.gif" width="150" height="30" alt="ÊÄ¤¸¤ë" name="close" id="close" /></a></div> 
+<!--¢¥CONTENTS-->
+</div>
+
+</body>
+</html>
Index: /temp/trunk/html/js/admin.js
===================================================================
--- /temp/trunk/html/js/admin.js	(revision 1328)
+++ /temp/trunk/html/js/admin.js	(revision 1328)
@@ -0,0 +1,407 @@
+
+// ´ÉÍý¼Ô¥á¥ó¥Ð¡¼¤òÄÉ²Ã¤¹¤ë¡£
+function fnRegistMember() {
+	// É¬¿Ü¹àÌÜ¤ÎÌ¾Á°¡¢¥í¥°¥¤¥óID¡¢¥Ñ¥¹¥ï¡¼¥É¡¢¸¢¸Â
+	var lstitem = new Array();
+	lstitem[0] = 'name';
+	lstitem[1] = 'login_id';
+	lstitem[2] = 'password';
+	lstitem[3] = 'authority';
+	
+	var max = lstitem.length;
+	var errflg = false;
+	var cnt = 0;
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.form1[lstitem[cnt]].value == "") {
+			errflg = true;
+			break;
+		}
+	}
+	
+	// É¬¿Ü¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç	
+	if(errflg == true) {
+		alert('É¬¿Ü¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£');
+		return false;
+	} else {
+		if(window.confirm('ÆâÍÆ¤òÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+			return true;
+		} else {  
+			return false;
+		}
+	}
+}
+
+//¿Æ¥¦¥£¥ó¥É¥¦¤Î¥Ú¡¼¥¸¤òÊÑ¹¹¤¹¤ë¡£
+function fnUpdateParent(url) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		window.opener.location.href = url;
+	} else {
+		window.close();
+	}		
+}
+
+// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¥Ý¥¹¥È¤µ¤»¤ë¡£
+function fnSubmitParent() {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		window.opener.document.form1.submit();
+	} else {
+		window.close();
+	}		
+}
+
+//»ØÄê¤µ¤ì¤¿id¤Îºï½ü¤ò¹Ô¤¦¥Ú¡¼¥¸¤ò¼Â¹Ô¤¹¤ë¡£
+function fnDeleteMember(id, pageno) {
+	url = "./delete.php?id=" + id + "&pageno=" + pageno;
+	if(window.confirm('ÅÐÏ¿ÆâÍÆ¤òºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		location.href = url;
+	}
+}
+
+// ¥é¥¸¥ª¥Ü¥¿¥ó¥Á¥§¥Ã¥¯¾õÂÖ¤òÊÝÂ¸
+var lstsave = "";
+
+// ¥é¥¸¥ª¥Ü¥¿¥ó¤Î¥Á¥§¥Ã¥¯¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
+function fnGetRadioChecked() {
+	var max;
+	var cnt;
+	var names = "";
+	var startname = "";
+	var ret;
+	max = document.form1.elements.length;
+	lstsave = Array(max);
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.form1.elements[cnt].type == 'radio') {
+			name = document.form1.elements[cnt].name;
+			/* radio¥Ü¥¿¥ó¤ÏÆ±¤¸Ì¾Á°¤¬£²²óÂ³¤±¤Æ¸¡½Ð¤µ¤ì¤ë¤Î¤Ç¡¢
+			   ºÇ½é¤ÎÌ¾Á°¤Î¸¡½Ð¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎÈ½Äê */
+			// 1²óÌÜ¤Î¸¡½Ð
+			if(startname != name) {
+				startname = name;	
+				ret = document.form1.elements[cnt].checked;
+				if(ret == true){
+					// ²ÔÆ¯¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¡£
+					lstsave[name] = 1;
+				}	
+			// 2²óÌÜ¤Î¸¡½Ð
+			} else {
+				ret = document.form1.elements[cnt].checked;
+				if(ret == true){
+					// Èó²ÔÆ¯¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¡£
+					lstsave[name] = 0;
+				}
+			}
+		}
+	}
+}
+
+// ¥é¥¸¥ª¥Ü¥¿¥ó¤ËÊÑ¹¹¤¬¤¢¤Ã¤¿¤«È½Äê¤¹¤ë¡£
+function fnChangeRadio(name, no, id, pageno) {
+	// ºÇ½é¤Î¼èÆÀ¾õÂÖ¤«¤éÊÑ¹¹¤¢¤ê¤Î¾ì¹ç
+	if(lstsave[name] != no) {
+		// DBÈ¿±Ç¥Ú¡¼¥¸¼Â¹Ô
+		url = "./check.php?id=" + id + "&no=" + no + "&pageno=" + pageno;
+		location.href = url;
+	}
+}
+
+// ´ÉÍý¼Ô¥á¥ó¥Ð¡¼¥Ú¡¼¥¸¤ÎÀÚÂØ
+function fnMemberPage(pageno) {
+	location.href = "./index.php?pageno=" + pageno;
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+function fnNaviSearchPage(pageno, mode) {
+	document.form1['search_pageno'].value = pageno;
+	document.form1['mode'].value = mode;
+	document.form1.submit();
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë(form2)
+function fnNaviSearchPage2(pageno) {
+	document.form2['search_pageno'].value = pageno;
+	document.form2['mode'].value = 'search';
+	document.form2.submit();
+}
+
+// ÃÍ¤òÂåÆþ¤·¤Æ»ØÄê¥Ú¡¼¥¸¤Ësubmit
+function fnSetvalAndSubmit( fname, key, val ) {
+	fm = document[fname];
+	fm[key].value = val;
+	fm.submit();
+}
+
+// ¹àÌÜ¤ËÆþ¤Ã¤¿ÃÍ¤ò¥¯¥ê¥¢¤¹¤ë¡£
+function fnClearText(name) {
+	document.form1[name].value = "";
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÄÉ²Ã
+function fnAddCat(cat_id) {
+	if(window.confirm('¥«¥Æ¥´¥ê¤òÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		document.form1['mode'].value = 'edit';
+		document.form1['cat_id'].value = cat_id;
+	}
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÊÔ½¸
+function fnEditCat(parent_id, cat_id) {
+	document.form1['mode'].value = 'pre_edit';
+	document.form1['parent_id'].value = parent_id;
+	document.form1['edit_cat_id'].value = cat_id;
+	document.form1.submit();
+}
+
+// ÁªÂò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯
+function fnCheckCat(obj) {
+	val = obj[obj.selectedIndex].value;
+	if (val == ""){
+		alert ("¿Æ¥«¥Æ¥´¥ê¤ÏÁªÂò¤Ç¤­¤Þ¤»¤ó");
+		obj.selectedIndex = 0;
+	}
+}
+
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤éÅÐÏ¿¥Ú¡¼¥¸¤ØÌá¤ë
+function fnReturnPage() {
+	document.form1['mode'].value = 'return';
+	document.form1.submit();
+}
+
+// µ¬³ÊÊ¬ÎàÅÐÏ¿¤Ø°ÜÆ°
+function fnClassCatPage(class_id) {
+	location.href =  "./classcategory.php?class_id=" + class_id;
+}
+
+function fnSetFormValue(name, val) {
+	document.form1[name].value = val;
+}
+
+function fnListCheck(list) {
+	len = list.length;
+	for(cnt = 0; cnt < len; cnt++) {
+		document.form1[list[cnt]].checked = true;
+	}
+}
+
+function fnAllCheck() {
+	cnt = 1;
+	name = "check:" + cnt;
+	while (document.form1[name]) {
+		document.form1[name].checked = true;
+		cnt++;
+		name = "check:" + cnt;
+	}
+}
+
+function fnAllUnCheck() {
+	cnt = 1;
+	name = "check:" + cnt;
+	while (document.form1[name]) {
+		document.form1[name].checked = false;
+		cnt++;
+		name = "check:" + cnt;
+	}
+}
+
+//»ØÄê¤µ¤ì¤¿id¤Îºï½ü¤ò¹Ô¤¦¥Ú¡¼¥¸¤ò¼Â¹Ô¤¹¤ë¡£
+function fnDelete(url) {
+	if(window.confirm('ÅÐÏ¿ÆâÍÆ¤òºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		location.href = url;
+	}
+}
+
+//ÇÛÁ÷ÎÁ¶â¤ò¼«Æ°ÆþÎÏ
+function fnSetDelivFee(max) {
+	for(cnt = 1; cnt <= max; cnt++) {
+		name = "fee" + cnt;
+		document.form1[name].value = document.form1['fee_all'].value;
+	}
+}
+
+// ºß¸Ë¿ôÀ©¸ÂÈ½Äê
+function fnCheckStockLimit(icolor) {
+	if(document.form1['stock_unlimited']) {
+		list = new Array(
+			'stock'
+			);
+		if(document.form1['stock_unlimited'].checked) {
+			fnChangeDisabled(list, icolor);
+			document.form1['stock'].value = "";
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+// ºß¸Ë¿ôÀ©¸ÂÈ½Äê
+function fnCheckStockNoLimit(no, icolor) {
+	$check_key = "stock_unlimited:"+no;
+	$input_key = "stock:"+no;
+	
+	list = new Array($input_key	);
+	if(document.form1[$check_key].checked) {
+		fnChangeDisabled(list, icolor);
+		document.form1[$input_key].value = "";
+	} else {
+		fnChangeDisabled(list, '');
+	}
+}
+
+// ¹ØÆþÀ©¸Â¿ôÈ½Äê
+function fnCheckSaleLimit(icolor) {
+	list = new Array(
+		'sale_limit'
+		);	
+	if(document.form1['sale_unlimited'].checked) {
+		fnChangeDisabled(list, icolor);
+		document.form1['sale_limit'].value = "";
+	} else {
+		fnChangeDisabled(list, '');
+	}
+}
+
+// ºß¸Ë¿ôÈ½Äê
+function fnCheckAllStockLimit(max, icolor) {
+	for(no = 1; no <= max; no++) {
+		$check_key = "stock_unlimited:"+no;
+		$input_key = "stock:"+no;
+		
+		list = new Array($input_key);
+	
+		if(document.form1[$check_key].checked) {
+			fnChangeDisabled(list, icolor);
+			document.form1[$input_key].value = "";
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+// Form»ØÄê¤ÎSubmit 
+function fnFormSubmit(form) {
+	document.forms[form].submit();
+}
+
+// ³ÎÇ§¥á¥Ã¥»¡¼¥¸
+function fnConfirm() {
+	if(window.confirm('¤³¤ÎÆâÍÆ¤ÇÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		return true;
+	}
+	return false;
+}
+
+//ºï½ü³ÎÇ§¥á¥Ã¥»¡¼¥¸
+function fnDeleteConfirm() {
+	if(window.confirm('ºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		return true;
+	}
+	return false;
+}
+
+//¥á¥ë¥Þ¥¬·Á¼°ÊÑ¹¹³ÎÇ§¥á¥Ã¥»¡¼¥¸
+function fnmerumagaupdateConfirm() {
+	if(window.confirm("´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£\n¥á¥ë¥Þ¥¬¤Î¼ïÎà¤¬ÊÑ¹¹¤µ¤ì¤Þ¤¹¡£µ¹¤·¤¤¤Ç¤¹¤«¡©")){
+		return true;
+	}
+	return false;
+}
+
+// ¥Õ¥©¡¼¥à¤ËÂåÆþ¤·¤Æ¤«¤é¥µ¥Ö¥ß¥Ã¥È¤¹¤ë¡£
+function fnInsertValAndSubmit( fm, ele, val, msg ){
+	
+	if ( msg ){
+		ret = window.confirm(msg);
+	} else {
+		ret = true;
+	}
+	if( ret ){
+		fm[ele].value = val;
+		fm.submit();
+		return false;
+	}
+	return false;
+}
+
+// ¼«Ê¬°Ê³°¤ÎÍ×ÁÇ¤òÍ­¸ú¡¦Ìµ¸ú¤Ë¤¹¤ë
+function fnSetDisabled ( f_name, e_name, flag ) {
+	fm = document[f_name];
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < fm.elements.length; cnt++) {
+		if( fm[cnt].name != e_name && fm[cnt].name != 'subm' && fm[cnt].name != 'mode') {
+			fm[cnt].disabled = flag;
+			if ( flag == true ){
+				fm[cnt].style.backgroundColor = "#cccccc";
+			} else {
+				fm[cnt].style.backgroundColor = "#ffffff";
+			}
+		}
+	}
+}
+
+
+//¥ê¥¹¥È¥Ü¥Ã¥¯¥¹Æâ¤Î¹àÌÜ¤ò°ÜÆ°¤¹¤ë
+function fnMoveCat(sel1, sel2, mode_name) {
+	var fm = document.form1;
+	for(i = 0; i < fm[sel1].length; i++) {
+		if(fm[sel1].options[i].selected) {
+			if(fm[sel2].value != "") {
+				fm[sel2].value += "-" + fm[sel1].options[i].value;
+			} else {
+				fm[sel2].value = fm[sel1].options[i].value;
+			}
+		}
+	}
+	fm["mode"].value = mode_name;
+	fm.submit();
+}
+
+//¥ê¥¹¥È¥Ü¥Ã¥¯¥¹Æâ¤Î¹àÌÜ¤òºï½ü¤¹¤ë
+function fnDelListContents(sel1, sel2, mode_name) {
+	fm = document.form1;
+	for(j = 0; j < fm[sel1].length; j++) {
+		if(fm[sel1].options[i].selected) {
+			fm[sel2].value = fm[sel2].value.replace(fm[sel1].options[i].value, "");
+		}
+	}
+	
+	fm["mode"].value = mode_name;
+	fm.submit();
+}
+
+//°ì¹ÔÌÜ¤Î²Á³Ê¤ò°Ê²¼¤Î¹Ô¤Ë¥³¥Ô¡¼¤¹¤ë
+function fnCopyValue(length, icolor) {
+	fm = document.form1;
+	for(i = 1; i <= length; i++) {
+		fm['product_code:' + i].value = fm['product_code:1'].value;
+		fm['stock:' + i].value = fm['stock:1'].value;
+		fm['price01:' + i].value = fm['price01:1'].value;
+		fm['price02:' + i].value = fm['price02:1'].value;
+		fm['stock_unlimited:' + i].checked = fm['stock_unlimited:1'].checked;
+		fm['stock:' + i].disabled = fm['stock:1'].disabled;		
+		fm['stock:' + i].style.backgroundColor = fm['stock:1'].style.backgroundColor;
+	}	
+}
+
+// ¥¿¥°¤ÎÉ½¼¨ÈóÉ½¼¨ÀÚ¤êÂØ¤¨
+function fnDispChange(disp_id, inner_id, disp_flg){
+	disp_state = document.getElementById(disp_id).style.display;
+	
+	if (disp_state == "") {
+		document.form1[disp_flg].value="none";
+		document.getElementById(disp_id).style.display="none";
+		document.getElementById(inner_id).innerHTML = "<<É½¼¨";
+	}else{
+		document.form1[disp_flg].value="";
+		document.getElementById(disp_id).style.display="";
+		document.getElementById(inner_id).innerHTML = ">>ÈóÉ½¼¨"; 
+	}
+	
+}
+
+
+
+	
Index: /temp/trunk/html/js/css.js
===================================================================
--- /temp/trunk/html/js/css.js	(revision 1328)
+++ /temp/trunk/html/js/css.js	(revision 1328)
@@ -0,0 +1,83 @@
+gCssUA = navigator.userAgent.toUpperCase();
+gCssBrw = navigator.appName.toUpperCase();
+
+with (document) {
+		write("<style type=\"text/css\"><!--");
+
+
+//WIN-IE
+	if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
+		write(".fs10 {font-size: 62.5%; line-height: 150%; letter-spacing:1px;}");
+		write(".fs12 {font-size: 75%; line-height: 150%; letter-spacing:1.5px;}");
+		write(".fs14 {font-size: 87.5%; line-height: 150%; letter-spacing:2px;}");
+		write(".fs18 {font-size: 117.5%; line-height: 130%; letter-spacing:2.5px;}");
+		write(".fs22 {font-size: 137.5%; line-height: 130%; letter-spacing:3px;}");
+		write(".fs24 {font-size: 150%; line-height: 130%; letter-spacing:3px;}");
+		write(".fs30 {font-size: 187.5%; line-height: 125%; letter-spacing:3.5px;}");
+		write(".fs10n {font-size: 62.5%; letter-spacing:1px;}");
+		write(".fs12n {font-size: 75%; letter-spacing:1.5px;}");
+		write(".fs14n {font-size: 87.5%; letter-spacing:2px;}");
+		write(".fs18n {font-size: 117.5%; letter-spacing:2.5px;}");
+		write(".fs22n {font-size: 137.5%; letter-spacing:1px;}");
+		write(".fs24n {font-size: 150%; letter-spacing:1px;}");
+		write(".fs30n {font-size: 187.5%; letter-spacing:1px;}");
+		write(".fs12st {font-size: 75%; line-height: 150%; letter-spacing:1.5px; font-weight: bold;}");
+	}
+
+//WIN-NN
+	if (gCssUA.indexOf("WIN") != -1 && gCssBrw.indexOf("NETSCAPE") != -1) {
+		write(".fs10 {font-size:72%; line-height:130%;}");
+		write(".fs12 {font-size: 75%; line-height: 150%;}");
+		write(".fs14 {font-size: 87.5%; line-height: 140%;}");
+		write(".fs18 {font-size: 117.5%; line-height: 130%;}");
+		write(".fs22 {font-size: 137.5%; line-height: 130%;}");
+		write(".fs24 {font-size: 150%; line-height: 130%;}");
+		write(".fs30 {font-size: 187.5%; line-height: 120%;}");
+		write(".fs10n {font-size:72%;}");
+		write(".fs12n {font-size: 75%;}");
+		write(".fs14n {font-size: 87.5%;}");
+		write(".fs18n {font-size: 117.5%;}");
+		write(".fs22n {font-size: 137.5%;}");
+		write(".fs24n {font-size: 150%;}");
+		write(".fs30n {font-size: 187.5%;}");
+		write(".fs12st {font-size: 75%; line-height: 150%; font-weight: bold;}");
+	}
+
+//WIN-NN4.x
+	if ( navigator.appName == "Netscape" && navigator.appVersion.substr(0,2) == "4." ) {
+		write(".fs10 {font-size:90%; line-height: 130%;}");
+		write(".fs12 {font-size: 100%; line-height: 140%;}");
+		write(".fs14 {font-size: 110%; line-height: 135%;}");
+		write(".fs18 {font-size: 130%; line-height: 175%;}");
+		write(".fs24 {font-size: 190%; line-height: 240%;}");
+		write(".fs30 {font-size: 240%; line-height: 285%;}");
+		write(".fs10n {font-size:90%;}");
+		write(".fs12n {font-size: 100%;}");
+		write(".fs14n {font-size: 110%;}");
+		write(".fs18n {font-size: 130%;}");
+		write(".fs24n {font-size: 190%;}");
+		write(".fs30n {font-size: 240%;}");
+		write(".fs12st {font-size: 100%; line-height: 140%; font-weight: bold;}");
+	}
+
+//MAC
+	if (gCssUA.indexOf("MAC") != -1) {
+		write(".fs10 {font-size: 10px; line-height: 14px;}");
+		write(".fs12 {font-size: 12px; line-height: 18px;}");
+		write(".fs14 {font-size: 14px; line-height: 18px;}");
+		write(".fs18 {font-size: 18px; line-height: 23px;}");
+		write(".fs22 {font-size: 22px; line-height: 27px;}");
+		write(".fs24 {font-size: 24px; line-height: 30px;}");
+		write(".fs30 {font-size: 30px; line-height: 35px;}");
+		write(".fs10n {font-size: 10px;}");
+		write(".fs12n {font-size: 12px;}");
+		write(".fs14n {font-size: 14px;}");
+		write(".fs18n {font-size: 18px;}");
+		write(".fs22n {font-size: 22px;}");
+		write(".fs24n {font-size: 24px;}");
+		write(".fs30n {font-size: 30px;}");
+		write(".fs12st {font-size: 12px; line-height: 18px; font-weight: bold;}");
+	}
+
+	write("--></style>");
+}
Index: /temp/trunk/html/js/win_op.js
===================================================================
--- /temp/trunk/html/js/win_op.js	(revision 1328)
+++ /temp/trunk/html/js/win_op.js	(revision 1328)
@@ -0,0 +1,38 @@
+<!--
+	function win01(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+	
+<!--
+	function win02(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+
+<!--
+	function win03(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=yes,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+
+<!--
+	function ChangeParent()
+	{
+		window.opener.location.href="../contact/index.php";
+	}
+//-->
+
+
+<!--//
+function CloseChild()
+{
+	window.close();
+}
+//-->
Index: /temp/trunk/html/js/flash.js
===================================================================
--- /temp/trunk/html/js/flash.js	(revision 1328)
+++ /temp/trunk/html/js/flash.js	(revision 1328)
@@ -0,0 +1,99 @@
+
+// **************  ÀßÄêÉôÊ¬ *******************
+
+	// Flash¥Õ¥¡¥¤¥ë¤Ø¤ÎÁêÂÐ¥Ñ¥¹
+	var flashFilePath = "swf/index.swf";
+
+	// Flash²£Éý
+	var flashWidth = "400";
+
+	// Flash½ÄÉý
+	var flashHeight = "279";
+
+	// Flash¤ÎÉ¬Í×¥Ð¡¼¥¸¥ç¥ó
+	var reqVersion = 6;
+
+	// Flash¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤ËÉ½¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸
+	var noFlashMsg =
+		"<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" summary=\" \">"
+		+"<tr><td colspan=\"3\"><img src=\"./img/flash/image_flash01.jpg\" width=\"400\" height=\"174\" alt=\"\"></td></tr>"
+		+"<tr>"
+		+"<td><img src=\"./img/flash/image_flash02.jpg\" width=\"140\" height=\"22\" alt=\"\"></td>"
+		+"<td><a href=\"http://www.macromedia.com/shockwave/download/download.cgi?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&amp;Lang=Japanese\" target=\"_blank\"><img src=\"./img/flash/download.gif\" width=\"205\" height=\"22\" alt=\"\" border=\"0\"></a></td>"
+		+"<td><img src=\"./img/flash/image_flash03.jpg\" width=\"55\" height=\"22\" alt=\"\"></td></tr>"
+		+"</tr>"
+		+"<tr><td colspan=\"3\"><img src=\"./img/flash/image_flash04.jpg\" width=\"400\" height=\"84\" alt=\"\"></td></tr>"
+		+"</table>";
+
+
+// ************** ¥á¥¤¥ó *********************
+
+	var maxVersion = 7;
+	var actualVersion = 0;
+	var jsVersion = 1.0;
+	var noflashflag;
+	var flash2Installed = false;
+	var flash3Installed = false;
+	var flash4Installed = false;
+	var flash5Installed = false;
+	var flash6Installed = false;
+	var flash7Installed = false;
+	var rightVersion = false;
+	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
+	jsVersion = 1.1;
+
+	if(isIE && isWin){
+		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
+		document.write('on error resume next \n');
+		document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
+		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
+		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
+		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
+		document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
+		document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
+		document.write('</SCR' + 'IPT\> \n');
+	}
+
+
+
+
+	function detectFlash() {
+		
+		if (navigator.plugins) {
+			if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+				var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
+				var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
+				flash2Installed = flashVersion == 2;
+				flash3Installed = flashVersion == 3;
+				flash4Installed = flashVersion == 4;
+				flash5Installed = flashVersion == 5;
+				flash6Installed = flashVersion == 6;
+				flash6Installed = flashVersion >= 7;
+			}
+		}
+
+		for (var i = 2; i <= maxVersion; i++) {  
+			if (eval("flash" + i + "Installed") == true) actualVersion = i;
+		}
+
+		if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
+
+		if (actualVersion >= reqVersion) {
+			rightVersion = true;
+			document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"" + flashWidth + "\" height=\"" + flashHeight + "\">");
+			document.write("<param name=\"movie\" value=\"" + flashFilePath + "\">");
+			document.write("<param name=\"quality\" value=\"high\">");
+			document.write("<param name=\"bgcolor\" value=\"#ffffff\">");
+			document.write("<param name=\"loop\" value=\"false\">");
+			document.write("<embed src=\"" + flashFilePath + "\" quality=\"high\" bgcolor=\"#ffffff\" loop=\"false\"  width=\"" + flashWidth + "\" height=\"" + flashHeight + "\" type=\"application/x-shockwave-flash\" pluginspage=\"http://wsww.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" Name=\"opening\"></embed>");
+			document.write("</object>");
+		} else {
+			document.write(noFlashMsg);
+		}
+	}
+
+
+
+	detectFlash();
Index: /temp/trunk/html/js/navi.js
===================================================================
--- /temp/trunk/html/js/navi.js	(revision 1328)
+++ /temp/trunk/html/js/navi.js	(revision 1328)
@@ -0,0 +1,27 @@
+	var preLoadFlag = "false";
+
+	function preLoadImg(){
+		arrImgList = new Array (
+			"/img/header/basis_on.jpg","/img/header/product_on.jpg","/img/header/customer_on.jpg","/img/header/order_on.jpg",
+			"/img/header/sales_on.jpg","/img/header/mail_on.jpg","/img/header/contents_on.jpg",
+			"/img/header/mainpage_on.gif","/img/header/seitecheck_on.gif","/img/header/logout_on.gif",
+			"/img/contents/btn_search_on.jpg","/img/contents/btn_regist_on.jpg",
+			"/img/contents/btn_csv_on.jpg","/img/contents/arrow_left.jpg","/img/contents/arrow_right.jpg"
+		);
+		arrPreLoad = new Array();
+		for (i in arrImgList) {
+			arrPreLoad[i] = new Image();
+			arrPreLoad[i].src = arrImgList[i];
+		}
+		preLoadFlag = "true";
+	}
+
+	function chgImg(fileName,imgName){
+		if (preLoadFlag == "true") {
+			document.images[imgName].src = fileName;
+		}
+	}
+	
+	function chgImgImageSubmit(fileName,imgObj){
+	imgObj.src = fileName;
+}
Index: /temp/trunk/html/js/dragdrop.js
===================================================================
--- /temp/trunk/html/js/dragdrop.js	(revision 1328)
+++ /temp/trunk/html/js/dragdrop.js	(revision 1328)
@@ -0,0 +1,196 @@
+var obj;
+var offsetX;
+var offsetY;
+var arrObj;
+var objParam;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Param() {
+	this.ITEM_MAX = 3;		
+}
+
+// ¥µ¥¤¥º´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Size() {
+	this.id = '';
+	this.left = 0;
+	this.top = 0;
+	this.width = 0;
+	this.height = 0;
+	this.obj;
+};
+
+// ¥ª¥ó¥í¡¼¥É½èÍý
+onload=function () {
+	// ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+	objParam = new SC_Param();
+	
+	// WIN-IE
+	if (document.all) {
+		objlist = document.all.tags("div");
+	// WIN-NN,WIN-FF   
+	} else if (document.getElementsByTagName) {
+		objlist = document.getElementsByTagName("div");
+	} else {
+		return;
+	}
+	
+	arrObj = new Array();
+	for (i = 0; i < objlist.length; i++) {
+		id = objlist[i].id;
+		arrObj[id] = new SC_Size();
+		arrObj[id].id = id;
+		arrObj[id].obj = objlist[id];
+		arrObj[id].left = objlist[id].style.left;
+		arrObj[id].top = objlist[id].style.top;
+		arrObj[id].width = objlist[id].style.width;
+		arrObj[id].height = objlist[id].style.height;
+		arrObj[id].left = Number(arrObj[id].left.replace(/px/, ''));
+		arrObj[id].top = Number(arrObj[id].top.replace(/px/, ''));
+		arrObj[id].width = Number(arrObj[id].width.replace(/px/, ''));
+		arrObj[id].height = Number(arrObj[id].height.replace(/px/, ''));
+		arrObj[id].right = Number(arrObj[id].left) + Number(arrObj[id].width);
+		arrObj[id].bottom =Number(arrObj[id].top) + Number(arrObj[id].height);
+	}
+	
+	// MouseDown¥¤¥Ù¥ó¥È½èÍý¤ÎÆþ¤ìÂØ¤¨
+	objlist['item0'].onmousedown = onMouseDown;
+	objlist['item1'].onmousedown = onMouseDown;
+	objlist['item2'].onmousedown = onMouseDown;
+	
+	document.onmousemove = onMouseMove;
+	document.onmouseup = onMouseUp;
+}
+
+// MouseDown¥¤¥Ù¥ó¥È
+function onMouseDown(e) {
+   obj = this;
+   // WIN-IE
+   if (document.all) {
+      offsetX = event.offsetX + 2;
+      offsetY = event.offsetY + 2;
+   // WIN-NN,WIN-FF
+   } else if (obj.getElementsByTagName) {
+      offsetX = e.pageX - parseInt(obj.style.left);
+      offsetY = e.pageY - parseInt(obj.style.top);
+   }
+   return false;
+}
+
+// MouseMove¥¤¥Ù¥ó¥È
+function onMouseMove(e) {
+	if (!obj) {
+		return true;
+	}	
+	// WIN-IE
+	if (document.all) {
+		x = event.clientX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = document.body.clientWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		y = event.clientY - offsetY;
+		if(y <= 0) {
+			y = 0;
+		}
+		top_max = document.body.clientHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;		
+	// WIN-NN,WIN-FF
+	} else if (obj.getElementsByTagName) {
+		x = e.pageX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = window.innerWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		
+		y = e.pageY - offsetY;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(y <= 0) {
+			y = 0;
+			obj.style.top = 0;
+		}
+		top_max = window.innerHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;
+	}
+	
+	if(isInFlame('flame0', obj)) {
+		document.getElementById('td1').style.backgroundColor = '#fffadd';
+	} else {
+		document.getElementById('td1').style.backgroundColor = '#ffffff';
+	}
+	return false;
+}
+
+// MouseUp¥¤¥Ù¥ó¥È
+function onMouseUp(e) {
+	if (!obj) {
+		return true;
+	}
+	
+	if(!isInFlame('flame0', obj)) {
+		// WIN-IE
+		if (document.all) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		// WIN-NN,WIN-FF
+		} else if (obj.getElementsByTagName) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		}
+	}	
+	document.getElementById('td1').style.backgroundColor = '#ffffff';	
+	obj = null;
+}
+
+// ¥Õ¥ì¡¼¥àÆâ¤Ë¥¢¥¤¥Æ¥à¤¬Â¸ºß¤¹¤ë¤«È½Äê¤¹¤ë¡¡
+function isInFlame(flame_id, item) {
+	top_val = item.style.top;
+	top_val = Number(top_val.replace(/px/, ''));
+	bottom_val = top_val + arrObj[item.id].height;
+	left_val = item.style.left;
+	left_val = Number(left_val.replace(/px/, ''))
+	right_val = left_val + arrObj[item.id].width;		
+	if(
+		top_val > arrObj[flame_id].top &&
+		bottom_val < arrObj[flame_id].bottom &&
+		left_val > arrObj[flame_id].left &&
+		right_val < arrObj[flame_id].right
+		) {
+		return true;
+	}
+	return false;
+}
+
+// Á÷¿®Á°¤Î½èÍý
+function preSubmit() {
+	for(i = 0; i < 3; i++) {
+		id = 'item' + i;
+		obj = arrObj[id].obj;
+		if(isInFlame ('flame0', obj)) {
+			document.form1[obj.id].value = "in";
+		} else {
+			document.form1[obj.id].value = "out";
+		}
+	}
+}
+
+
+
Index: /temp/trunk/html/js/site.js
===================================================================
--- /temp/trunk/html/js/site.js	(revision 1328)
+++ /temp/trunk/html/js/site.js	(revision 1328)
@@ -0,0 +1,345 @@
+// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+function fnIsopener() {
+    var ua = navigator.userAgent;
+    if( !!window.opener ) {
+        if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) {
+            return !window.opener.closed;
+        } else {
+        	return typeof window.opener.document == 'object';
+        }
+	} else {
+		return false;
+	}
+}
+
+// Í¹ÊØÈÖ¹æÆþÎÏ¸Æ¤Ó½Ð¤·
+function fnCallAddress(php_url, tagname1, tagname2, input1, input2) {
+	zip1 = document.form1[tagname1].value;
+	zip2 = document.form1[tagname2].value;
+	
+	if(zip1.length == 3 && zip2.length == 4) {
+		url = php_url + "?zip1=" + zip1 + "&zip2=" + zip2 + "&input1=" + input1 + "&input2=" + input2;
+		window.open(url,"nomenu","width=500,height=350,scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+	} else {
+		alert("Í¹ÊØÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£");
+	}
+}
+
+// Í¹ÊØÈÖ¹æ¤«¤é¸¡º÷¤·¤¿½»½ê¤òÅÏ¤¹¡£
+function fnPutAddress(input1, input2) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		if(document.form1['state'].value != "") {
+			// ¹àÌÜ¤ËÃÍ¤òÆþÎÏ¤¹¤ë¡£
+			state_id = document.form1['state'].value;
+			town = document.form1['city'].value + document.form1['town'].value;
+			window.opener.document.form1[input1].selectedIndex = state_id;
+			window.opener.document.form1[input2].value = town;
+		}
+	} else {
+		window.close();
+	}		
+}
+
+function fnOpenNoMenu(URL) {
+	window.open(URL,"nomenu","scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+}
+
+function fnOpenWindow(URL,name,width,height) {
+	window.open(URL,name,"width="+width+",height="+height+",scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,status=no");
+}
+
+// ¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë
+function fnSetFocus(name) {
+	if(document.form1[name]) {
+		document.form1[name].focus();
+	}
+}
+
+// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤Ë¹àÌÜ¤ò³ä¤êÅö¤Æ¤ë¡£
+function fnSetSelect(name1, name2, val) {
+	sele1 = document.form1[name1]; 
+	sele2 = document.form1[name2];
+	
+	if(sele1 && sele2) {
+		index=sele1.selectedIndex;
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤Î¥¯¥ê¥¢	
+		count=sele2.options.length
+		for(i = count; i >= 0; i--) {
+			sele2.options[i]=null;
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ËÃÍ¤ò³ä¤êÅö¤Æ¤ë
+		len = lists[index].length
+		for(i = 0; i < len; i++) {
+			sele2.options[i]=new Option(lists[index][i], vals[index][i]);
+			if(val != "" && vals[index][i] == val) {
+				sele2.options[i].selected = true;
+			}
+		}
+	}
+}
+
+// Enter¥­¡¼ÆþÎÏ¤ò¥­¥ã¥ó¥»¥ë¤¹¤ë¡£(IE¤ËÂÐ±þ)
+function fnCancelEnter()
+{
+	if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
+		if (window.event.keyCode == 13)
+		{
+			return false;
+		}
+	}
+	return true;
+}
+
+// ¥â¡¼¥É¤È¥­¡¼¤ò»ØÄê¤·¤ÆSUBMIT¤ò¹Ô¤¦¡£
+function fnModeSubmit(mode, keyname, keyid) {
+	switch(mode) {
+	case 'delete_category':
+		if(!window.confirm('ÁªÂò¤·¤¿¥«¥Æ¥´¥ê¤È¥«¥Æ¥´¥êÆâ¤Î¤¹¤Ù¤Æ¤Î¥«¥Æ¥´¥ê¤òºï½ü¤·¤Þ¤¹')){
+			return;
+		}
+		break;
+	case 'delete':
+		if(!window.confirm('°ìÅÙºï½ü¤·¤¿¥Ç¡¼¥¿¤Ï¡¢¸µ¤ËÌá¤»¤Þ¤»¤ó¡£\nºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«¡©')){
+			return;
+		}
+		break;
+	case 'confirm':
+		if(!window.confirm('ÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«')){
+			return;
+		}
+		break;
+	case 'delete_all':
+		if(!window.confirm('¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«')){
+			return;
+		}
+		break;
+	default:
+		break;
+	}
+	document.form1['mode'].value = mode;
+	if(keyname != "" && keyid != "") {
+		document.form1[keyname].value = keyid;
+	}
+	document.form1.submit();
+
+}
+
+function fnFormModeSubmit(form, mode, keyname, keyid) {
+	switch(mode) {
+	case 'delete':
+		if(!window.confirm('°ìÅÙºï½ü¤·¤¿¥Ç¡¼¥¿¤Ï¡¢¸µ¤ËÌá¤»¤Þ¤»¤ó¡£\nºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«¡©')){
+			return;
+		}
+		break;
+	case 'confirm':
+		if(!window.confirm('ÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«')){
+			return;
+		}
+		break;		
+	default:
+		break;
+	}
+	document.forms[form]['mode'].value = mode;
+	if(keyname != "" && keyid != "") {
+		document.forms[form][keyname].value = keyid;
+	}
+	document.forms[form].submit();
+}
+
+function fnSetFormSubmit(form, key, val) {
+	document.forms[form][key].value = val;
+	document.forms[form].submit();
+	return false;
+}
+
+function fnChangeAction(url) {
+	document.form1.action = url;
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+function fnNaviPage(pageno) {
+	document.form1['pageno'].value = pageno;
+	document.form1.submit();
+}
+
+function fnSearchPageNavi(pageno) {
+	document.form1['pageno'].value = pageno;
+	document.form1['mode'].value = 'search';
+	document.form1.submit();
+	}
+
+	function fnSubmit(){
+	document.form1.submit();
+}
+
+// ¥Ý¥¤¥ó¥ÈÆþÎÏÀ©¸Â
+function fnCheckInputPoint() {
+	if(document.form1['point_check']) {
+		list = new Array(
+						'use_point'
+						);
+	
+		if(!document.form1['point_check'][0].checked) {
+			color = "#dddddd";
+			flag = true;
+		} else {
+			color = "";
+			flag = false;
+		}
+		
+		len = list.length
+		for(i = 0; i < len; i++) {
+			if(document.form1[list[i]]) {
+				document.form1[list[i]].disabled = flag;
+				document.form1[list[i]].style.backgroundColor = color;
+			}
+		}
+	}
+}
+
+// ÊÌ¤Î¤ªÆÏ¤±ÀèÆþÎÏÀ©¸Â
+function fnCheckInputDeliv() {
+	if(document.form1['deliv_check']) {
+		list = new Array(
+						'deliv_name01',
+						'deliv_name02',
+						'deliv_kana01',
+						'deliv_kana02',
+						'deliv_pref',
+						'deliv_zip01',
+						'deliv_zip02',
+						'deliv_addr01',
+						'deliv_addr02',
+						'deliv_tel01',
+						'deliv_tel02',
+						'deliv_tel03'
+						);
+	
+		if(!document.form1['deliv_check'].checked) {
+			fnChangeDisabled(list, '#dddddd');
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+
+// ¹ØÆþ»þ²ñ°÷ÅÐÏ¿ÆþÎÏÀ©¸Â
+function fnCheckInputMember() {
+	if(document.form1['member_check']) {
+		list = new Array(
+						'password',
+						'password_confirm',
+						'reminder',
+						'reminder_answer'
+						);
+
+		if(!document.form1['member_check'].checked) {
+			fnChangeDisabled(list, '#dddddd');
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+// ºÇ½é¤ËÀßÄê¤µ¤ì¤Æ¤¤¤¿¿§¤òÊÝÂ¸¤·¤Æ¤ª¤¯
+var g_savecolor = new Array();
+
+function fnChangeDisabled(list, color) {
+	len = list.length;
+	
+	for(i = 0; i < len; i++) {
+		if(document.form1[list[i]]) {
+			if(color == "") {
+				// Í­¸ú¤Ë¤¹¤ë
+				document.form1[list[i]].disabled = false;
+				document.form1[list[i]].style.backgroundColor = g_savecolor[list[i]];
+			} else {
+				// Ìµ¸ú¤Ë¤¹¤ë
+				document.form1[list[i]].disabled = true;
+				g_savecolor[list[i]] = document.form1[list[i]].style.backgroundColor;
+				document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0";	
+			}			
+		}
+	}
+}
+
+
+// ¥í¥°¥¤¥ó»þ¤ÎÆþÎÏ¥Á¥§¥Ã¥¯
+function fnCheckLogin(formname) {
+	var lstitem = new Array();
+	
+	if(formname == 'login_mypage'){
+	lstitem[0] = 'mypage_login_email';
+	lstitem[1] = 'mypage_login_pass';
+	}else{
+	lstitem[0] = 'login_email';
+	lstitem[1] = 'login_pass';
+	}
+	var max = lstitem.length;
+	var errflg = false;
+	var cnt = 0;
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.forms[formname][lstitem[cnt]].value == "") {
+			errflg = true;
+			break;
+		}
+	}
+	
+	// É¬¿Ü¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç	
+	if(errflg == true) {
+		alert('¥á¡¼¥ë¥¢¥É¥ì¥¹/¥Ñ¥¹¥ï¡¼¥É¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£');
+		return false;
+	}
+}
+	
+// »þ´Ö¤Î·×Â¬
+function fnPassTime(){
+	end_time = new Date();
+	time = end_time.getTime() - start_time.getTime();
+	alert((time/1000));
+}
+start_time = new Date();
+
+//¿Æ¥¦¥£¥ó¥É¥¦¤Î¥Ú¡¼¥¸¤òÊÑ¹¹¤¹¤ë¡£
+function fnUpdateParent(url) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		window.opener.location.href = url;
+	} else {
+		window.close();
+	}		
+}
+
+//ÆÃÄê¤Î¥­¡¼¤òSUBMIT¤¹¤ë¡£
+function fnKeySubmit(keyname, keyid) {
+	if(keyname != "" && keyid != "") {
+		document.form1[keyname].value = keyid;
+	}
+	document.form1.submit();
+}
+
+//Ê¸»ú¿ô¤ò¥«¥¦¥ó¥È¤¹¤ë¡£
+//°ú¿ô?¡§¥Õ¥©¡¼¥àÌ¾¾Î
+//°ú¿ô?¡§Ê¸»ú¿ô¥«¥¦¥ó¥ÈÂÐ¾Ý
+//°ú¿ô?¡§¥«¥¦¥ó¥È·ë²Ì³ÊÇ¼ÂÐ¾Ý
+function fnCharCount(form,sch,cnt) {
+	document.forms[form][cnt].value= document.forms[form][sch].value.length;
+}
+
+
+// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤Î¥µ¥¤¥º¤òÊÑ¹¹¤¹¤ë
+function ChangeSize(button, TextArea, Max, Min, row_tmp){
+	
+	if(TextArea.rows <= Min){
+		TextArea.rows=Max; button.value="¾®¤µ¤¯¤¹¤ë"; row_tmp.value=Max;
+	}else{
+		TextArea.rows =Min; button.value="Âç¤­¤¯¤¹¤ë"; row_tmp.value=Min;
+	}
+}
+
Index: /temp/trunk/html/error.php
===================================================================
--- /temp/trunk/html/error.php	(revision 1328)
+++ /temp/trunk/html/error.php	(revision 1328)
@@ -0,0 +1,22 @@
+<?php
+
+require_once("./require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'error.tpl';
+		$this->tpl_title = '¥¨¥é¡¼';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/test/iketest/CKSPayment.php
===================================================================
--- /temp/trunk/html/test/iketest/CKSPayment.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/CKSPayment.php	(revision 1328)
@@ -0,0 +1,139 @@
+<?php
+######################################################
+# Veritrans CVS Merchant Development Kit.
+# CKSPayment.php Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î
+#       ¥ì¥¹¥Ý¥ó¥¹¤ò½èÍý¤¹¤ë¥µ¥ó¥×¥ë
+#       << ¥µ¡¼¥¯¥ë K ¥µ¥ó¥¯¥¹ÍÑ¥µ¥ó¥×¥ë >>
+######################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+require_once("../../require.php");
+require("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+require_once($PHPLIB_PATH . "Transaction.php");
+require_once($PHPLIB_PATH . "Config.php");
+require_once($PHPLIB_PATH . "Log.php");
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_title = "¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£";
+		$this->tpl_mainpage = 'test/iketest/CKSPayment.tpl';
+	}
+}
+
+$objPage = new LC_Page;
+$objView = new SC_SiteView;
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(CKSPayment.php)½èÍý³«»Ï... >>>');
+
+# »ÙÊ§¥Ú¡¼¥¸¤«¤é¤Î¥Ñ¥é¥á¡¼¥¿¤ò¼èÆÀ
+$query = $t->getQuery($ENCODE);
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿²þãâ¥Á¥§¥Ã¥¯
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $query['REQ_ORDER']);
+
+if(strlen($hash) <= 0 || $hash != $query['REQ_ORDER_SIG']) {
+	//½ðÌ¾¥¨¥é¡¼¤òÉ½¼¨¤·¤Æ½ªÎ»
+	sfDispSiteError(E_SIGN_ERROR);
+}
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤ò¥Ç¥³¡¼¥É
+$orders = $t->URLDecode($ENCODE, $query['REQ_ORDER']);
+
+#-----------------------------------------------
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸($request)¤Ë¥Ñ¥é¥á¡¼¥¿¤ò¥»¥Ã¥È¢­
+#-----------------------------------------------
+$request = array(
+    # ¸À¸ìÁªÂò
+    #REQ_ACCEPT_LANGUAGE => ACCEPT_LANGUAGE_JA,
+    # ¼è°ú¥³¥Þ¥ó¥É¡§ entry(ÅÐÏ¿)
+    #REQ_COMMAND => CMD_ENTRY,
+    # ¼è°ú ID
+    REQ_ORDER_ID => $orders[REQ_ORDER_ID],
+    # CVS¥¿¥¤¥×(CircleKSunks)
+    REQ_CVS_TYPE => "04",
+    # ¶â³Û
+    REQ_AMOUNT => $orders[REQ_AMOUNT],
+    # »ÙÊ§´ü¸Â
+    REQ_PAY_LIMIT => $orders[REQ_PAY_LIMIT],
+    # »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+    # ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+    REQ_NAME1 => $t->jCode($query[REQ_NAME1], ENCODE_UTF8),
+    REQ_NAME2 => $t->jCode($query[REQ_NAME2], ENCODE_UTF8),
+    # ÅÅÏÃÈÖ¹æ
+    REQ_TEL_NO => $query[REQ_TEL_NO]
+);
+
+
+#------------------------------------------------
+# ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¼è°ú¤òÅê¤²¤ë
+# ¼è°ú·ë²Ì¤Ï result ¤Ë¥­¡¼¤ÈÃÍ¤Î¥Ú¥¢¤Ç³ÊÇ¼¤µ¤ì¤ë
+#------------------------------------------------
+$result = $t->doTransaction(CMD_ENTRY, $request);
+
+# ¥ì¥¹¥Ý¥ó¥¹ÃÍ¤ò¼èÆÀ¤¹¤ë
+$MStatus = $result[RES_MSTATUS];
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+    $objPage->aux_msg = $t->jCode($result[RES_AUX_MSG], $ENCODE);
+}
+else {
+    $objPage->MErrMsg = $t->jCode($result[RES_MERRMSG], $ENCODE);
+    $objPage->MErrLoc = $result[RES_MERRLOC];
+}
+$objPage->MStatus = $MStatus;
+$objPage->action_code = $result[RES_ACTION_CODE];
+$objPage->order_id = $result[RES_ORDER_ID];
+$objPage->order_ctl_id = $result[RES_ORDER_CTL_ID];
+$objPage->txn_version = $result[RES_TXN_VERSION];
+$objPage->merch_txn = $result[RES_MERCH_TXN];
+$objPage->cust_txn = $result[RES_CUST_TXN];
+$objPage->receipt_no = $result[RES_RECEIPT_NO];
+$objPage->haraikomi_url = $result[RES_HARAIKOMI_URL];
+$objPage->err_code = $result[RES_ERR_CODE];
+$objPage->payment_type = $result[RES_PAYMENT_TYPE];
+$objPage->ref_code = $result[RES_REF_CODE];
+
+# ¶â³Û¤È»ÙÊ§´ü¸Â¤¬¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹ÅÅÊ¸¤Ë´Þ¤Þ¤ì¤Ê¤¤¤¿¤á
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤«¤é¼èÆÀ¤¹¤ë
+$objPage->amount = $request[REQ_AMOUNT];
+$objPage->pay_limit = $request[REQ_PAY_LIMIT];
+
+# ¥µ¡¼¥¯¥ë K ¥µ¥ó¥¯¥¹·ÈÂÓÍÑ URL À¸À®
+$objPage->mobile_url = preg_replace("/https:\/\/.+?\/JLPcon/",
+                           "https://w2.kessai.info/JLM/JLMcon",
+                           $objPage->haraikomi_url);
+#$result{'mobile-url'} = 
+
+
+# »ÙÊ§·ë²Ì¤Ë¤è¤êÀ®¸ù¡¦¼ºÇÔ¥Ú¡¼¥¸¤òÉ½¼¨
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus != 'success') {
+	$objPage->tpl_title = "¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£";
+	$objPage->tpl_mainpage = "test/iketest/error.tpl";
+}
+
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(CKSPayment.php)½èÍý½ªÎ». >>>');
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/test/iketest/SEJInvoice.php
===================================================================
--- /temp/trunk/html/test/iketest/SEJInvoice.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/SEJInvoice.php	(revision 1328)
@@ -0,0 +1,189 @@
+<?php
+##################################################
+# Veritrans CVS Merchant Development Kit.
+# SEJInvoice.php¡¡Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ø
+#       ÀÜÂ³¤¹¤ë¤¿¤á¤Î¥µ¥ó¥×¥ë
+#       << ¥»¥Ö¥ó¥¤¥ì¥Ö¥óÍÑ¥µ¥ó¥×¥ë >>
+##################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+include_once("Cart.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥«¡¼¥È¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$cart = new Cart;
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(SEJInvoice.php)½èÍý³«»Ï... >>>');
+
+# ¥À¥ß¡¼¼è°úID¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$order_id = "sj-" . $cart->getOrderId();
+
+# ¥À¥ß¡¼¶â³Û¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$amount = $cart->getPrice();
+
+# ¥À¥ß¡¼»ÙÊ§´ü¸Â¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$pay_limit = $cart->getPayLimit();
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿ÇÛÎó¤ÎºîÀ®
+$params = array(
+    REQ_ORDER_ID => $order_id,
+    REQ_AMOUNT => $amount,
+    REQ_PAY_LIMIT => $pay_limit
+);
+
+# URL ¥¨¥ó¥³¡¼¥É¤ò¹Ô¤¦
+$params_str = $t->URLEncode($ENCODE, $params);
+
+# ¥Ú¡¼¥¸²þ¤¶¤ó¤òËÉ»ß¤¹¤ë¤¿¤á¤Ë¥Ï¥Ã¥·¥å¤ò·×»»¤¹¤ë
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $params_str);
+
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER = ' . $params_str);
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER_SIG = ' . $hash);
+
+# ²èÌÌ¤ò½ÐÎÏ
+?>
+<script language="javascript">
+<!--
+function disableSubmit(form) {
+  var elements = form.elements;
+  for (var i = 0; i < elements.length; i++) {
+    if (elements[i].type == 'submit') {
+      elements[i].disabled = true;
+    }
+  }
+}
+//-->
+</script>
+<html>
+<head>
+  <title>¤ªÇã¤¤¾å¤²¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>" />
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <hr />
+  <h1>¤ªÇã¤¤¾å¤²¾ðÊó</h1>
+  <p>
+    ¼è°úID:&nbsp;<strong><?=$order_id?></strong>
+  </p>
+  <p>
+    ²Á³Ê:&nbsp;<strong><?=$amount?></strong>&nbsp;±ß
+  </p>
+  <p>
+    ¤ª»ÙÊ§´ü¸Â:&nbsp;<strong><?=$pay_limit?></strong>
+  </p>
+  <h3>¤ªµÒÍÍ¾ðÊó</h3>
+  <form action="<?=$PAY_URL_SEJ?>" method="POST"
+                                   onsubmit="disableSubmit(this)">
+    <table>
+      <tr>
+        <td>À«¡§</td>
+        <td><input type="text" name="REQ_NAME1" /></td>
+      </tr>
+      <tr>
+        <td>Ì¾¡§</td>
+        <td><input type="text" name="REQ_NAME2" /></td>
+      </tr>
+      <tr>
+        <td>ÅÅÏÃÈÖ¹æ¡§</td>
+        <td><input type="text" name="REQ_TEL_NO" /></td>
+      </tr>
+    </table>
+    <input type="hidden" name="REQ_ORDER" value="<?=$params_str?>" />
+    <input type="hidden" name="REQ_ORDER_SIG" value="<?=$hash?>" />
+    <p><input type="submit" value=" ¿½¹þ " /></p>
+  </form>
+  <hr />
+  <h3>É¬¤º²¼µ­¤Î»ö¹à¤òWeb¥Ú¡¼¥¸¤Î¤É¤³¤«¤Ëµ­ºÜ¤·¤Æ¤¯¤À¤µ¤¤¡£</h3>
+  <table>
+    <tr>
+      <td>³ô¼°²ñ¼Ò¡¡¥»¥Ö¥ó¡¦¥¤¥ì¥Ö¥ó¡¦¥¸¥ã¥Ñ¥ó¤ÏÊ§¹þ°ÍÍêÉ¼¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¾¦ÉÊÅù¤Î¹ØÆþ³Û¾ðÊó¤ò</td>
+    </tr>
+    <tr>
+      <td>¸ÜµÒ¤Î¥×¥é¥¤¥Ð¥·¡¼¤ËÇÛÎ¸¤Î¾å¡¢´ÉÍý¡¦Åý·×¾å¤ÎÌÜÅª¤Ë¤ª¤¤¤Æ¸Ä¿Í¤òÆÃÄê¤Ç¤­¤Ê¤¤ÍÍ¼°¤Ë¤ÆÍøÍÑ¤·¤Þ¤¹¡£</td>
+    </tr>
+  </table>
+  <table>
+    <tr>
+      <td>£±¡¥£±¡¡É¬¿Ü¤Î·ÇºÜ¾ò¹à </td>
+    </tr>
+    <tr>
+      <td>¡Ê£±¡Ë³ô¼°²ñ¼Ò¥»¥Ö¥ó¡Ý¥¤¥ì¥Ö¥ó¡¦¥¸¥ã¥Ñ¥ó¤¬¥»¥Ö¥ó¡Ý¥¤¥ì¥Ö¥óÅ¹¤òÄÌ¤¸¤Æ¡¢¸ÜµÒ¤Î¾¦ÉÊÅù¹ØÆþÂå¶â¤ÎÂåÍý¼õÎÎ¶ÈÌ³¤ò¹Ô¤Ã¤Æ¤¤¤ë¤³¤È </td>
+    </tr>
+    <tr>
+      <td>¡Ê£²¡Ë²ÃÌÁÅ¹¤Î½»½ê¡¢¾¦¹æ¤Þ¤¿¤ÏÌ¾¾Î¡¢¤Ê¤é¤Ó¤ËÂåÉ½¼Ô¤Î»áÌ¾ </td>
+    </tr>
+    <tr>
+      <td>¡Ê£³¡Ë¸ÜµÒ¤Ë¤è¤ë¥»¥Ö¥ó¡Ý¥¤¥ì¥Ö¥óÅ¹¤Ç¤Î¿½¹þ¤ß¤Î¼è¾Ã¤È¾¦ÉÊÅù¤Î¹ØÆþ¤Þ¤¿¤Ï¥µ¡¼¥Ó¥¹Äó¶¡¤ÎµñÀä¤Ë´Ø¤¹¤ë¾ò¹à </td>
+    </tr>
+    <tr>
+      <td>¡Ê£´¡ËÊ§¹þ°ÍÍêÉ¼Åù¤Ë¤è¤ë¥»¥Ö¥ó¡¼¥¤¥ì¥Ö¥óÅ¹¤Ë¤ª¤±¤ë»ÙÊ§¤ÏÆüËÜ¹ñÆâ¤Ë¤ª¤¤¤Æ±ß²ß¤Ç¹Ô¤¦»ö </td>
+    </tr>
+    <tr>
+      <td>¡Ê£µ¡Ë¾¦ÉÊÅù¤ÎÆâÍÆ¡¢°úÅÏ¾ò·ï¡¢²Á³Ê¡¢»ÙÊ§¤ª¤è¤Ó¿½¹þ¤ß¤Î¼è¾Ã¾ò·ï¤½¤ÎÂ¾¼è°ú¾ò·ï </td>
+    </tr>
+    <tr>
+      <td>¡Ê£¶¡Ë¾¦ÉÊÅù¤Ë¤Ä¤¤¤Æ¤ÎÌä¤¤¹ç¤ï¤»Áë¸ý¡¢Ï¢ÍíÀè¤Ê¤é¤Ó¤ËÅÅ»Ò¥á¡¼¥ë¥¢¥É¥ì¥¹ </td>
+    </tr>
+    <tr>
+      <td>¡Ê£·¡Ë¾¦ÉÊÅù¤ËÂÐ¤¹¤ë¥¯¥ì¡¼¥àÅù¤ÎÏ¢ÍíÀè </td>
+    </tr>
+    <tr>
+      <td>¡Ê£¸¡Ë¾¦ÉÊÅù¤ÎÊÖÉÊ¡¢¥¯¡¼¥ê¥ó¥°¥ª¥Õ¤ËÉ¬Í×¤È¤µ¤ì¤ë¼êÂ³¤­ </td>
+    </tr>
+    <tr>
+      <td>¡Ê£¹¡ËÂ»³²Çå½þÀÕÇ¤¤ÎÀ©¸Â </td>
+    </tr>
+    <tr>
+      <td>£±¡¥£²¿ä¾©¤Î·ÇºÜ¾ò¹à </td>
+    </tr>
+    <tr>
+      <td>¸ÜµÒ¤ËÂÐ¤·¤Æ¡¢°Ê²¼¤Î·ï³°·ÀÌó¾ò·ï¤ò¥·¥ç¥Ã¥×¤Î¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥Û¡¼¥à¥Ú¡¼¥¸¾å¤Þ¤¿¤ÏÂ¾¤Î¥Þ¥ë¥Á¥á¥Ç¥£¥¢¤ÇÌÀ¼¨¤¹¤ë¤³¤È¤ò¿ä¾©¤¹¤ë¤¬Ë¾¤Þ¤·¤¤¡£ </td>
+    </tr>
+    <tr>
+      <td>¡Ê£±¡Ë¸ÜµÒ¤Ï¡¢¶ËÎÏÀ®¿Í¤È¤¹¤ë¤³¤È¡¢µÚ¤Ó¡¢²Í¶õÌ¾µÁ¡¢Æ¿Ì¾ÅùËÜ¿Í°Ê³°¤ÎÌ¾µÁ¤Ë¤è¤ë¿½¹þ¤ß¤ò¶Ø»ß¤¹¤ë¤³¤È </td>
+    </tr>
+    <tr>
+      <td>¡Ê£²¡Ë·ï³°·ÀÌóÀ®Î©¤Î»þ´ü </td>
+    </tr>
+    <tr>
+      <td>¡Ê£³¡Ë¸ÜµÒ¤Î¸Ä¿Í¾ðÊó¤ÎÅÐÏ¿¡¢ÍøÍÑ </td>
+    </tr>
+    <tr>
+      <td>¡Ê£´¡Ë·ï³°·ÀÌó¤¬Éí¹ç·ÀÌó¤Î¤¿¤á¿ï»þÊÑ¹¹¤¬¤¢¤ë¤³¤È¤Î¾µÇ§ </td>
+    </tr>
+  </table>
+  <table>
+    <tr>
+      <td> ¥³¥ó¥Ó¥Ë¤ÇÈñÍÑ»ÙÊ§¸å·èºÑ¤ò¹Ô¤Ê¤Ã¤¿¥³¥ó¥Ó¥ËÅ¹ÊÞ¤ÇÊÖ¶â¤ò¼õ¤±¤ì¤Ê¤¤»Ý¤ÎÃí°Õ½ñ¤­¤òµ­½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£</td>
+    </tr>
+ </table>
+</body>
+</html>
+<?php
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(SEJInvoice.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/FMInvoice.php
===================================================================
--- /temp/trunk/html/test/iketest/FMInvoice.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/FMInvoice.php	(revision 1328)
@@ -0,0 +1,134 @@
+<?php
+##################################################
+# Veritrans CVS Merchant Development Kit.
+# FMInvoice.php¡¡Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ø
+#       ÀÜÂ³¤¹¤ë¤¿¤á¤Î¥µ¥ó¥×¥ë
+#       << ¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥ÈÍÑ¥µ¥ó¥×¥ë >>
+##################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+include_once("Cart.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥«¡¼¥È¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$cart = new Cart;
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(FMInvoice.php)½èÍý³«»Ï... >>>');
+
+# ¥À¥ß¡¼¼è°úID¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$order_id = "fm-" . $cart->getOrderId();
+
+# ¥À¥ß¡¼¶â³Û¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$amount = $cart->getPrice();
+
+# ¥À¥ß¡¼»ÙÊ§´ü¸Â¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$pay_limit = $cart->getPayLimit();
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿ÇÛÎó¤ÎºîÀ®
+$params = array(
+    REQ_ORDER_ID => $order_id,
+    REQ_AMOUNT => $amount,
+    REQ_PAY_LIMIT => $pay_limit
+);
+
+# URL ¥¨¥ó¥³¡¼¥É¤ò¹Ô¤¦
+$params_str = $t->URLEncode($ENCODE, $params);
+
+# ¥Ú¡¼¥¸²þ¤¶¤ó¤òËÉ»ß¤¹¤ë¤¿¤á¤Ë¥Ï¥Ã¥·¥å¤ò·×»»¤¹¤ë
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $params_str);
+
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER = ' . $params_str);
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER_SIG = ' . $hash);
+
+# ²èÌÌ¤ò½ÐÎÏ
+?>
+<script language="javascript">
+<!--
+function disableSubmit(form) {
+  var elements = form.elements;
+  for (var i = 0; i < elements.length; i++) {
+    if (elements[i].type == 'submit') {
+      elements[i].disabled = true;
+    }
+  }
+}
+//-->
+</script>
+<html>
+<head>
+  <title>¤ªÇã¤¤¾å¤²¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>" />
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <hr />
+  <h1>¤ªÇã¤¤¾å¤²¾ðÊó</h1>
+  <p>
+    ¼è°úID:&nbsp;<strong><?=$order_id?></strong>
+  </p>
+  <p>
+    ²Á³Ê:&nbsp;<strong><?=$amount?></strong>&nbsp;±ß
+  </p>
+  <p>
+    ¤ª»ÙÊ§´ü¸Â:&nbsp;<strong><?=$pay_limit?></strong>
+  </p>
+  <h3>¤ªµÒÍÍ¾ðÊó</h3>
+  <form action="<?=$PAY_URL_FM?>" method="POST" onsubmit="disableSubmit(this)">
+    <table>
+      <tr>
+        <td>À«¡§</td>
+        <td><input type="text" name="REQ_NAME1" /></td>
+      </tr>
+      <tr>
+        <td>Ì¾¡§</td>
+        <td><input type="text" name="REQ_NAME2" /></td>
+      </tr>
+      <tr>
+        <td>»áÌ¾¡Ê¥«¥Ê¡Ë¡§</td>
+        <td><input type="text" name="REQ_KANA" /></td>
+      </tr>
+      <tr>
+        <td>ÅÅÏÃÈÖ¹æ¡§</td>
+        <td><input type="text" name="REQ_TEL_NO" /></td>
+      </tr>
+    </table>
+    <input type="hidden" name="REQ_ORDER" value="<?=$params_str?>" />
+    <input type="hidden" name="REQ_ORDER_SIG" value="<?=$hash?>" />
+    <p><input type="submit" value=" ¿½¹þ " /></p>
+  </form>
+  <hr />
+  <h3>É¬¤º²¼µ­¤Î»ö¹à¤òWeb¥Ú¡¼¥¸¤Î¤É¤³¤«¤Ëµ­ºÜ¤·¤Æ¤¯¤À¤µ¤¤¡£</h3>
+  <table>
+    <tr>
+      <td> ¥³¥ó¥Ó¥Ë¤ÇÈñÍÑ»ÙÊ§¸å·èºÑ¤ò¹Ô¤Ê¤Ã¤¿¥³¥ó¥Ó¥ËÅ¹ÊÞ¤ÇÊÖ¶â¤ò¼õ¤±¤ì¤Ê¤¤»Ý¤ÎÃí°Õ½ñ¤­¤òµ­½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£</td>
+    </tr>
+  </table>
+</body>
+</html>
+<?php
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(FMInvoice.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/LWInvoice.php
===================================================================
--- /temp/trunk/html/test/iketest/LWInvoice.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/LWInvoice.php	(revision 1328)
@@ -0,0 +1,184 @@
+<?php
+##################################################
+# Veritrans CVS Merchant Development Kit.
+# LWInvoice.php¡¡Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ø
+#       ÀÜÂ³¤¹¤ë¤¿¤á¤Î¥µ¥ó¥×¥ë
+#       << ¥í¡¼¥½¥ó/¥»¥¤¥³¡¼¥Þ¡¼¥ÈÍÑ¥µ¥ó¥×¥ë >>
+##################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+include_once("Cart.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥«¡¼¥È¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$cart = new Cart;
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(LWInvoice.php)½èÍý³«»Ï... >>>');
+
+# ¥À¥ß¡¼¼è°úID¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$order_id = "lw-" . $cart->getOrderId();
+
+# ¥À¥ß¡¼¶â³Û¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$amount = $cart->getPrice();
+
+# ¥À¥ß¡¼»ÙÊ§´ü¸Â¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$pay_limit = $cart->getPayLimit();
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿ÇÛÎó¤ÎºîÀ®
+$params = array(
+    REQ_ORDER_ID => $order_id,
+    REQ_AMOUNT => $amount,
+    REQ_PAY_LIMIT => $pay_limit
+);
+
+# URL ¥¨¥ó¥³¡¼¥É¤ò¹Ô¤¦
+$params_str = $t->URLEncode($ENCODE, $params);
+
+# ¥Ú¡¼¥¸²þ¤¶¤ó¤òËÉ»ß¤¹¤ë¤¿¤á¤Ë¥Ï¥Ã¥·¥å¤ò·×»»¤¹¤ë
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $params_str);
+
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER = ' . $params_str);
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER_SIG = ' . $hash);
+
+# ²èÌÌ¤ò½ÐÎÏ
+?>
+<script language="javascript">
+<!--
+function disableSubmit(form) {
+  var elements = form.elements;
+  for (var i = 0; i < elements.length; i++) {
+    if (elements[i].type == 'submit') {
+      elements[i].disabled = true;
+    }
+  }
+}
+//-->
+</script>
+<html>
+<head>
+  <title>¤ªÇã¤¤¾å¤²¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>">
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <hr>
+  <h1>¤ªÇã¤¤¾å¤²¾ðÊó</h1>
+  <p>
+    ¼è°úID:&nbsp;<strong><?=$order_id?></strong>
+  </p>
+  <p>
+    ²Á³Ê:&nbsp;<strong><?=$amount?></strong>&nbsp;±ß
+  </p>
+  <p>
+    ¤ª»ÙÊ§´ü¸Â:&nbsp;<strong><?=$pay_limit?></strong>
+  </p>
+  <h3>¤ªµÒÍÍ¾ðÊó</h3>
+  <form action="<?=$PAY_URL_LW?>" method="POST" onsubmit="disableSubmit(this)">
+    <table>
+      <tr>
+        <td>À«¡§</td>
+        <td><input type="text" name="REQ_NAME1"></td>
+      </tr>
+      <tr>
+        <td>Ì¾¡§</td>
+        <td><input type="text" name="REQ_NAME2"></td>
+      </tr>
+      <tr>
+        <td>ÅÅÏÃÈÖ¹æ¡§</td>
+        <td><input type="text" name="REQ_TEL_NO"></td>
+      </tr>
+    </table>
+    <input type="hidden" name="REQ_ORDER" value="<?=$params_str?>" />
+    <input type="hidden" name="REQ_ORDER_SIG" value="<?=$hash?>" />
+    <p><input type="submit" value=" ¿½¹þ ">
+  </form>
+  <hr>  
+
+  <h3>É¬¤º²¼µ­¤Î»ö¹à¤òWeb¥Ú¡¼¥¸¤Î¤É¤³¤«¤Ëµ­ºÜ¤·¤Æ¤¯¤À¤µ¤¤¡£</h3>
+  <table>
+    <tr>
+      <td>1.1 ¼ýÇ¼¶ÈÌ³¤Ë¤Ä¤¤¤Æ</td>
+    </tr>
+    <tr>
+      <td>(1) ²ÃÌÁÅ¹¤ÎÌ¾¾Î</td>
+    </tr>
+    <tr>
+      <td>(2) ²ÃÌÁÅ¹¤Î½êºßÃÏ</td>
+    </tr>
+    <tr>
+      <td>(3) ²ÃÌÁÅ¹¤ÎÅÅÏÃÈÖ¹æ¡¢¥á¡¼¥ë¥¢¥É¥ì¥¹</td>
+    </tr>
+    <tr>
+      <td>(4) ²ÃÌÁÅ¹¤ÎÈÎÇäÀÕÇ¤¼ÔÌ¾µÚ¤ÓÀÕÇ¤¼Ô¤Ø¤ÎÏ¢ÍíÊýË¡</td>
+    </tr>
+    <tr>
+      <td>(5) ¾¦ÉÊ¤ÎÈÎÇä²Á³Ê¡¢ÀÇ¶â¡¢Á÷ÎÁ¤½¤ÎÂ¾É¬Í×¤È¤µ¤ì¤ëÎÁ¶â¡Ê°Ê²¼¡¢¤³¤ì¤é¤òÁí¾Î¤·¤Æ¾¦ÉÊÂå¶âÅù¤È¤¤¤¦¡Ë</td>
+    </tr>
+    <tr>
+      <td>(6) ¾¦ÉÊ¤Î°úÅÏ¤·´ü´Ö</td>
+    </tr>
+    <tr>
+      <td>(7) ¾¦ÉÊÂå¶âÅù¤Î»ÙÊ§»þ´üµÚ¤ÓÊýË¡</td>
+    </tr>
+    <tr>
+      <td>(8) ¾¦ÉÊ¤ÎÊÖÉÊ¡¦¼è¾Ã¤Ë´Ø¤¹¤ë»ö¹à</td>
+    </tr>
+    <tr>
+      <td>(9) ¸ÜµÒ¤«¤é¤ÎÁ÷¿®¥Ç¡¼¥¿Åù¤Ï²µ¤Ë¤è¤ê°ÂÁ´¤ËÊÝ¸î¤µ¤ì¤Æ¤¤¤ë»Ý¤ÎÉ½¼¨</td>
+    </tr>
+    <tr>
+      <td>(10) ¾åµ­°Ê³°¤ÇÆÃÄê¾¦¼è°úË¡¤ÇÄê¤á¤é¤ì¤¿»ö¹à</td>
+    </tr>
+    <tr>
+      <td>1.2 ¿½¹þ¼è¾Ã¡¦ÊÖÉÊ¡¦¸ò´¹¤Ë¤Ä¤¤¤Æ </td>
+    </tr>
+    <tr>
+      <td> ¸ÜµÒ¤ËÈÎÇä¤¹¤ë¤¹¤Ù¤Æ¤Î¾¦ÉÊ¤Ë¤Ä¤¤¤Æ¡¢ºÇ½ª¼õÎÎ¼Ô¤Ë°úÅÏ¤µ¤ì¤Æ¤«¤é²ÃÌÁÅ¹¤¬ÀßÄê¤¹¤ë°ìÄê´ü´Ö¤Ë </td>
+    </tr>
+    <tr>
+      <td> ¤ª¤¤¤Æ¤Ï¸ÜµÒ¤«¤é¤Î¾¦ÉÊ¤ÎÊÖÉÊËô¤Ï¸ò´¹¤ò¼õ¤±ÉÕ¤±¤ë¤â¤Î¤È¤·¡¢¤½¤Î»Ý¤òÈÎÇä»þÅÀ¤Ë²ÃÌÁÅ¹¤Î </td>
+    </tr>
+    <tr>
+      <td> ¥µ¥¤¥È¾å¤ËÌÀµ­¤¹¤ë¤â¤Î¤È¤·¤Þ¤¹¡£ </td>
+    </tr>
+    <tr>
+      <td> Ã¢¤·¡¢¾¦ÉÊ¤ÎÆÃÀ­¤Ë´Õ¤ß¤ÆÊÖÉÊËô¤Ï¸ò´¹¤ò¼õ¤±ÉÕ¤±¤Ê¤¤¾ì¹ç¤Ï¤¢¤é¤«¤¸¤áÈÎÇä»þÅÀ </td>
+    </tr>
+    <tr>
+      <td> ¤Ë²ÃÌÁÅ¹¤Î¥µ¥¤¥È¾å¤Ë¤½¤Î»Ý¤òÌÀµ­¤¹¤ë¤â¤Î¤È¤·¤Þ¤¹¡£ </td>
+    </tr>
+ </table>
+ <table>
+   <tr>
+     <td> ¥³¥ó¥Ó¥Ë¤ÇÈñÍÑ»ÙÊ§¸å·èºÑ¤ò¹Ô¤Ê¤Ã¤¿¥³¥ó¥Ó¥ËÅ¹ÊÞ¤ÇÊÖ¶â¤ò¼õ¤±¤ì¤Ê¤¤»Ý¤ÎÃí°Õ½ñ¤­¤òµ­½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£</td>
+   </tr>
+ </table>
+</body>
+</html>
+<?php
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(LWInvoice.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/SEJPayment.php
===================================================================
--- /temp/trunk/html/test/iketest/SEJPayment.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/SEJPayment.php	(revision 1328)
@@ -0,0 +1,202 @@
+<?php
+######################################################
+# Veritrans CVS Merchant Development Kit.
+# SEJPayment.php Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î
+#       ¥ì¥¹¥Ý¥ó¥¹¤ò½èÍý¤¹¤ë¥µ¥ó¥×¥ë
+#       << ¥»¥Ö¥ó¡¦¥¤¥ì¥Ö¥óÍÑ¥µ¥ó¥×¥ë >>
+######################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(SEJPayment.php)½èÍý³«»Ï... >>>');
+
+# »ÙÊ§¥Ú¡¼¥¸¤«¤é¤Î¥Ñ¥é¥á¡¼¥¿¤ò¼èÆÀ
+$query = $t->getQuery($ENCODE);
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿²þãâ¥Á¥§¥Ã¥¯
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $query['REQ_ORDER']);
+
+#if ($hash != $query['REQ_ORDER_SIG']) {
+if (strlen($hash) <= 0 || $hash != $query['REQ_ORDER_SIG']) {
+    # ½ðÌ¾¥¨¥é¡¼¤òÉ½¼¨¤·¤Æ½ªÎ»
+?>
+<html>
+<head>
+  <title>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>" />
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <p>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£</p>
+</body>
+</html>
+<?php
+    exit;
+}
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤ò¥Ç¥³¡¼¥É
+$orders = $t->URLDecode($ENCODE, $query['REQ_ORDER']);
+
+#-----------------------------------------------
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸($request)¤Ë¥Ñ¥é¥á¡¼¥¿¤ò¥»¥Ã¥È¢­
+#-----------------------------------------------
+$request = array(
+    # ¸À¸ìÁªÂò
+    #REQ_ACCEPT_LANGUAGE => ACCEPT_LANGUAGE_JA,
+    # ¼è°ú¥³¥Þ¥ó¥É¡§ entry(ÅÐÏ¿)
+    #REQ_COMMAND => CMD_ENTRY,
+    # ¼è°ú ID
+    REQ_ORDER_ID => $orders[REQ_ORDER_ID],
+    # CVS¥¿¥¤¥×(¥»¥Ö¥ó¥¤¥ì¥Ö¥ó)
+    REQ_CVS_TYPE => "01",
+    # ¶â³Û
+    REQ_AMOUNT => $orders[REQ_AMOUNT],
+    # »ÙÊ§´ü¸Â
+    REQ_PAY_LIMIT => $orders[REQ_PAY_LIMIT],
+    # »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+    # ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+    REQ_NAME1 => $t->jCode($query[REQ_NAME1], ENCODE_UTF8),
+    REQ_NAME2 => $t->jCode($query[REQ_NAME2], ENCODE_UTF8),
+    # ÅÅÏÃÈÖ¹æ
+    REQ_TEL_NO => $query[REQ_TEL_NO]
+);
+
+
+#------------------------------------------------
+# ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¼è°ú¤òÅê¤²¤ë
+# ¼è°ú·ë²Ì¤Ï result ¤Ë¥­¡¼¤ÈÃÍ¤Î¥Ú¥¢¤Ç³ÊÇ¼¤µ¤ì¤ë
+#------------------------------------------------
+$result = $t->doTransaction(CMD_ENTRY, $request);
+
+# ¥ì¥¹¥Ý¥ó¥¹ÃÍ¤ò¼èÆÀ¤¹¤ë
+$MStatus = $result[RES_MSTATUS];
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+    $aux_msg = $t->jCode($result[RES_AUX_MSG], $ENCODE);
+}
+else {
+    $MErrMsg = $t->jCode($result[RES_MERRMSG], $ENCODE);
+    $MErrLoc = $result[RES_MERRLOC];
+}
+$action_code = $result[RES_ACTION_CODE];
+$order_id = $result[RES_ORDER_ID];
+$order_ctl_id = $result[RES_ORDER_CTL_ID];
+$txn_version = $result[RES_TXN_VERSION];
+$merch_txn = $result[RES_MERCH_TXN];
+$cust_txn = $result[RES_CUST_TXN];
+$receipt_no = $result[RES_RECEIPT_NO];
+$haraikomi_url = $result[RES_HARAIKOMI_URL];
+$err_code = $result[RES_ERR_CODE];
+$payment_type = $result[RES_PAYMENT_TYPE];
+$ref_code = $result[RES_REF_CODE];
+
+# ¶â³Û¤È»ÙÊ§´ü¸Â¤¬¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹ÅÅÊ¸¤Ë´Þ¤Þ¤ì¤Ê¤¤¤¿¤á
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤«¤é¼èÆÀ¤¹¤ë
+$amount = $request[REQ_AMOUNT];
+$pay_limit = $request[REQ_PAY_LIMIT];
+
+# »ÙÊ§·ë²Ì¤Ë¤è¤êÀ®¸ù¡¦¼ºÇÔ¥Ú¡¼¥¸¤òÉ½¼¨
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type"
+          content="text/html; charset=<?=$ENCODE?>" />
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</h1>
+    <hr />
+    <p>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</p>
+    <p>¿¶¹þÉ¼ÈÖ¹æ¤Ï <?=$receipt_no?> ¤Ç¤¹¡£</p>
+    <p>Ê§¹þ°ÍÍêÉ¼¤Ï
+       <a href="<?=$haraikomi_url?>"><?=$haraikomi_url?></a> ¤Ç¤¹¡£</p>
+    <p>»ÙÊ§¶â³Û¤Ï <?=$amount?> ±ß¤Ç¤¹¡£</p>
+    <p>»ÙÊ§´ü¸Â¤Ï <?=$pay_limit?> ¤Ç¤¹¡£</p>
+    <p>¿¶¹þÉ¼¤ò°õºþ¡¢¤â¤·¤¯¤Ï¿¶¹þÉ¼ÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤ÆÁ´¹ñ¤Î¥»¥Ö¥ó¥¤¥ì¥Ö¥ó¤Ë¤Æ¤ª»ÙÊ§¤¯¤À¤µ¤¤¡£</p>
+    <p>¿¶¹þÉ¼ÈÖ¹æ¤ò»æ¤Ê¤É¤Ç¤ª»ý¤Á¤Î¾ì¹ç¤Ï¡¢¤ªµÒÍÍ¤«¤éÅ¹°÷¤ËÄó¼¨¤ÎºÝ¤Ë¡Ö¥¤¥ó¥¿¡¼¥Í¥Ã¥ÈÂå¶â¤Î»ÙÊ§¤¤¡×¤È¤ªÅÁ¤¨²¼¤µ¤¤¡£</p>
+    <p><a href="http://pr.sej.co.jp/in/system.html" target="_blank">¾Ü¤·¤¯¤Ï¤³¤Î¥Ú¡¼¥¸¤Ë¤Æ¤´³ÎÇ§¤¯¤À¤µ¤¤¡£</a><br></p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr />
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=$receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr />
+  </body>
+</html>
+<?php
+} else { 
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type"
+          content="text/html; charset=<?=$ENCODE?>" />
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¡£</h1>
+    <h2>¤ªµÒÍÍ¤Î¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</h2>
+    <hr />
+    <blockquote><?=$MErrMsg?></blockquote>
+    <p><blockquote>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</blockquote></p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr />
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr />
+  </body>
+</html>
+<?php
+}
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(MIPayment.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/test.php
===================================================================
--- /temp/trunk/html/test/iketest/test.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/test.php	(revision 1328)
@@ -0,0 +1,70 @@
+<?php
+$now_dir = realpath(dirname(__FILE__));
+require_once($now_dir . "/../../../data/lib/slib.php");	
+require_once($now_dir . "/../../../data/conf/core_os.php");
+require_once($now_dir . "/../../../data/conf/conf_os.php");
+require_once($now_dir . "/../../../data/class/SC_View.php");
+require_once($now_dir . "/../../../data/class/SC_Query.php");
+require_once($now_dir . "/../../../data/class/SC_CheckError.php");
+require_once($now_dir . "/../../../data/class/SC_FormParam.php");
+require_once($now_dir . "/../../../data/class/SC_Customer.php");
+require_once($now_dir . "/../../../data/class/SC_Cookie.php");
+require_once($now_dir . "/../../../data/module/Archive/Tar.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'test/iketest/test.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+rmdir("test");
+
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(SITE_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+
+//-------------------------------------------------------------------------------------------------------
+
+//²òÅà¥Õ¥¡¥¤¥ë¤Ë¤è¤ê¡¢¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤¹¤ë
+function lfSetExtractFile($extract_file, $extract_top_file, $install_success) {
+	//¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤±¤ì¤Ð
+	if(!is_dir($extract_file)) {
+		return false;
+	}
+
+	//¥Ç¥£¥ì¥¯¥È¥ê¤ò³«¤¯
+	if($handle = opendir($extract_file)) {
+		//¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¿È¤òÆÉ¤ß¹þ¤à
+		while($file = readdir($handle)) {
+			//'.'¤È'..'¥Õ¥¡¥¤¥ë¤Ï½ü³°
+			if($file != "." && $file != "..") {
+				//¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë
+				if(is_dir($extract_file . "/" . $file)) {
+					//ºÆµ¢¸Æ¤Ó½Ð¤·
+					lfSetExtractFile($extract_file . "/" . $file, $extract_top_file, $install_success);
+				} else {
+					//²òÅà¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê
+					$replace_file = ereg_replace("^" . $extract_top_file . "/", "", $extract_file);
+					//¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼(¾å½ñ¤­)¤¹¤ë
+					if(!copy($extract_file . "/" . $file, ROOT_DIR . $replace_file . "/" . $file)) {
+						$install_success = false;
+					}
+				}
+			}
+		}
+		//¥Ç¥£¥ì¥¯¥È¥ê¤òÊÄ¤¸¤ë
+		closedir($handle);
+	} else {
+		$install_success = false;
+	}
+	return $install_success;
+	
+}	
+
+?>
Index: /temp/trunk/html/test/iketest/FMPayment.php
===================================================================
--- /temp/trunk/html/test/iketest/FMPayment.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/FMPayment.php	(revision 1328)
@@ -0,0 +1,204 @@
+<?php
+######################################################
+# Veritrans CVS Merchant Development Kit.
+# FMPayment.php Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î
+#       ¥ì¥¹¥Ý¥ó¥¹¤ò½èÍý¤¹¤ë¥µ¥ó¥×¥ë
+#       << ¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥ÈÍÑ¥µ¥ó¥×¥ë >>
+######################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(FMPayment.php)½èÍý³«»Ï... >>>');
+
+# »ÙÊ§¥Ú¡¼¥¸¤«¤é¤Î¥Ñ¥é¥á¡¼¥¿¤ò¼èÆÀ
+$query = $t->getQuery($ENCODE);
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿²þãâ¥Á¥§¥Ã¥¯
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $query['REQ_ORDER']);
+
+#if ($hash != $query['REQ_ORDER_SIG']) {
+if (strlen($hash) <= 0 || $hash != $query['REQ_ORDER_SIG']) {
+    # ½ðÌ¾¥¨¥é¡¼¤òÉ½¼¨¤·¤Æ½ªÎ»
+?>
+<html>
+<head>
+  <title>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>" />
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <p>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£</p>
+</body>
+</html>
+<?php
+    exit;
+}
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤ò¥Ç¥³¡¼¥É
+$orders = $t->URLDecode($ENCODE, $query['REQ_ORDER']);
+
+#-----------------------------------------------
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸($request)¤Ë¥Ñ¥é¥á¡¼¥¿¤ò¥»¥Ã¥È¢­
+#-----------------------------------------------
+$request = array(
+    # ¸À¸ìÁªÂò
+    #REQ_ACCEPT_LANGUAGE => ACCEPT_LANGUAGE_JA,
+    # ¼è°ú¥³¥Þ¥ó¥É¡§ entry(ÅÐÏ¿)
+    #REQ_COMMAND => CMD_ENTRY,
+    # ¼è°ú ID
+    REQ_ORDER_ID => $orders[REQ_ORDER_ID],
+    # CVS¥¿¥¤¥×(¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È)
+    REQ_CVS_TYPE => "03",
+    # ¶â³Û
+    REQ_AMOUNT => $orders[REQ_AMOUNT],
+    # »ÙÊ§´ü¸Â
+    REQ_PAY_LIMIT => $orders[REQ_PAY_LIMIT],
+    # »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+    # ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+    REQ_NAME1 => $t->jCode($query[REQ_NAME1], ENCODE_UTF8),
+    REQ_NAME2 => $t->jCode($query[REQ_NAME2], ENCODE_UTF8),
+    REQ_KANA => $t->jCode($query[REQ_KANA], ENCODE_UTF8),
+    # ÅÅÏÃÈÖ¹æ
+    REQ_TEL_NO => $query[REQ_TEL_NO]
+);
+
+
+#------------------------------------------------
+# ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¼è°ú¤òÅê¤²¤ë
+# ¼è°ú·ë²Ì¤Ï result ¤Ë¥­¡¼¤ÈÃÍ¤Î¥Ú¥¢¤Ç³ÊÇ¼¤µ¤ì¤ë
+#------------------------------------------------
+$result = $t->doTransaction(CMD_ENTRY, $request);
+
+# ¥ì¥¹¥Ý¥ó¥¹ÃÍ¤ò¼èÆÀ¤¹¤ë
+$MStatus = $result[RES_MSTATUS];
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+    $aux_msg = $t->jCode($result[RES_AUX_MSG], $ENCODE);
+}
+else {
+    $MErrMsg = $t->jCode($result[RES_MERRMSG], $ENCODE);
+    $MErrLoc = $result[RES_MERRLOC];
+}
+$action_code = $result[RES_ACTION_CODE];
+$order_id = $result[RES_ORDER_ID];
+$order_ctl_id = $result[RES_ORDER_CTL_ID];
+$txn_version = $result[RES_TXN_VERSION];
+$merch_txn = $result[RES_MERCH_TXN];
+$cust_txn = $result[RES_CUST_TXN];
+$receipt_no = $result[RES_RECEIPT_NO];
+$haraikomi_url = $result[RES_HARAIKOMI_URL];
+$err_code = $result[RES_ERR_CODE];
+$payment_type = $result[RES_PAYMENT_TYPE];
+$ref_code = $result[RES_REF_CODE];
+
+# ¶â³Û¤È»ÙÊ§´ü¸Â¤¬¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹ÅÅÊ¸¤Ë´Þ¤Þ¤ì¤Ê¤¤¤¿¤á
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤«¤é¼èÆÀ¤¹¤ë
+$amount = $request[REQ_AMOUNT];
+$pay_limit = $request[REQ_PAY_LIMIT];
+
+# ´ë¶È¥³¡¼¥É¡õÃíÊ¸ÈÖ¹æÃê½Ð
+$company_code = substr($receipt_no, 0, 5);
+$order_no = substr($receipt_no, 6, 12);
+
+# »ÙÊ§·ë²Ì¤Ë¤è¤êÀ®¸ù¡¦¼ºÇÔ¥Ú¡¼¥¸¤òÉ½¼¨
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type"
+          content="text/html; charset=<?=$ENCODE?>" />
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</h1>
+    <hr />
+    <p>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</p>
+    <p>´ë¶È¥³¡¼¥É¤Ï <?=$company_code?> ¤Ç¤¹¡£</p>
+    <p>ÃíÊ¸ÈÖ¹æ¤Ï <?=$order_no?> ¤Ç¤¹¡£</p>
+    <p>»ÙÊ§¶â³Û¤Ï <?=$amount?> ±ß¤Ç¤¹¡£</p>
+    <p>»ÙÊ§´ü¸Â¤Ï <?=$pay_limit?> ¤Ç¤¹¡£</p>
+    <p>´ë¶È¥³¡¼¥É¡¢ÃíÊ¸ÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤ÆÁ´¹ñ¤Î¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È¤Ë¤Æ¤ª»ÙÊ§¤¯¤À¤µ¤¤¡£</p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr />
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=$receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr />
+  </body>
+</html>
+<?php
+} else { 
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type"
+          content="text/html; charset=<?=$ENCODE?>" />
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¡£</h1>
+    <h2>¤ªµÒÍÍ¤Î¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</h2>
+    <hr />
+    <blockquote><?=$MErrMsg?></blockquote>
+    <p><blockquote>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</blockquote></p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr />
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr />
+  </body>
+</html>
+<?php
+}
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(FMPayment.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/LWPayment.php
===================================================================
--- /temp/trunk/html/test/iketest/LWPayment.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/LWPayment.php	(revision 1328)
@@ -0,0 +1,196 @@
+<?php
+######################################################
+# Veritrans CVS Merchant Development Kit.
+# LWPayment.php Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î
+#       ¥ì¥¹¥Ý¥ó¥¹¤ò½èÍý¤¹¤ë¥µ¥ó¥×¥ë
+#       << ¥í¡¼¥½¥ó/¥»¥¤¥³¡¼¥Þ¡¼¥ÈÍÑ¥µ¥ó¥×¥ë >>
+######################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(LWPayment.php)½èÍý³«»Ï... >>>');
+
+# »ÙÊ§¥Ú¡¼¥¸¤«¤é¤Î¥Ñ¥é¥á¡¼¥¿¤ò¼èÆÀ
+$query = $t->getQuery($ENCODE);
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿²þãâ¥Á¥§¥Ã¥¯
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $query['REQ_ORDER']);
+
+#if ($hash != $query['REQ_ORDER_SIG']) {
+if (strlen($hash) <= 0 || $hash != $query['REQ_ORDER_SIG']) {
+    # ½ðÌ¾¥¨¥é¡¼¤òÉ½¼¨¤·¤Æ½ªÎ»
+?>
+<html>
+<head>
+  <title>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>">
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <p>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£</p>
+</body>
+</html>
+<?php
+    exit;
+}
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤ò¥Ç¥³¡¼¥É
+$orders = $t->URLDecode($ENCODE, $query['REQ_ORDER']);
+
+#-----------------------------------------------
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸($request)¤Ë¥Ñ¥é¥á¡¼¥¿¤ò¥»¥Ã¥È¢­
+#-----------------------------------------------
+$request = array(
+    # ¸À¸ìÁªÂò
+    #REQ_ACCEPT_LANGUAGE => ACCEPT_LANGUAGE_JA,
+    # ¼è°ú¥³¥Þ¥ó¥É¡§ entry(ÅÐÏ¿)
+    #REQ_COMMAND => CMD_ENTRY,
+    # ¼è°ú ID
+    REQ_ORDER_ID => $orders[REQ_ORDER_ID],
+    # CVS¥¿¥¤¥×(¥í¡¼¥½¥ó¡¢¥»¥¤¥³¥Þ¡¼¥È)
+    REQ_CVS_TYPE => "02",
+    # ¶â³Û
+    REQ_AMOUNT => $orders[REQ_AMOUNT],
+    # »ÙÊ§´ü¸Â
+    REQ_PAY_LIMIT => $orders[REQ_PAY_LIMIT],
+    # »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+    # ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+    REQ_NAME1 => $t->jCode($query[REQ_NAME1], ENCODE_UTF8),
+    REQ_NAME2 => $t->jCode($query[REQ_NAME2], ENCODE_UTF8),
+    # ÅÅÏÃÈÖ¹æ
+    REQ_TEL_NO => $query[REQ_TEL_NO]
+);
+
+
+#------------------------------------------------
+# ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¼è°ú¤òÅê¤²¤ë
+# ¼è°ú·ë²Ì¤Ï result ¤Ë¥­¡¼¤ÈÃÍ¤Î¥Ú¥¢¤Ç³ÊÇ¼¤µ¤ì¤ë
+#------------------------------------------------
+$result = $t->doTransaction(CMD_ENTRY, $request);
+
+# ¥ì¥¹¥Ý¥ó¥¹ÃÍ¤ò¼èÆÀ¤¹¤ë
+$MStatus = $result[RES_MSTATUS];
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+    $aux_msg = $t->jCode($result[RES_AUX_MSG], $ENCODE);
+}
+else {
+    $MErrMsg = $t->jCode($result[RES_MERRMSG], $ENCODE);
+    $MErrLoc = $result[RES_MERRLOC];
+}
+$action_code = $result[RES_ACTION_CODE];
+$order_id = $result[RES_ORDER_ID];
+$order_ctl_id = $result[RES_ORDER_CTL_ID];
+$txn_version = $result[RES_TXN_VERSION];
+$merch_txn = $result[RES_MERCH_TXN];
+$cust_txn = $result[RES_CUST_TXN];
+$receipt_no = $result[RES_RECEIPT_NO];
+$haraikomi_url = $result[RES_HARAIKOMI_URL];
+$err_code = $result[RES_ERR_CODE];
+$payment_type = $result[RES_PAYMENT_TYPE];
+$ref_code = $result[RES_REF_CODE];
+
+# ¶â³Û¤È»ÙÊ§´ü¸Â¤¬¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹ÅÅÊ¸¤Ë´Þ¤Þ¤ì¤Ê¤¤¤¿¤á
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤«¤é¼èÆÀ¤¹¤ë
+$amount = $request[REQ_AMOUNT];
+$pay_limit = $request[REQ_PAY_LIMIT];
+
+# »ÙÊ§·ë²Ì¤Ë¤è¤êÀ®¸ù¡¦¼ºÇÔ¥Ú¡¼¥¸¤òÉ½¼¨
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>">
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</h1>
+    <hr>
+    <p>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</p>
+    <p>¤ª»ÙÊ§¤¤¼õÉÕÈÖ¹æ¤Ï <?=$receipt_no?> ¤Ç¤¹¡£</p>
+    <p>»ÙÊ§¶â³Û¤Ï <?=$amount?> ±ß¤Ç¤¹¡£</p>
+    <p>»ÙÊ§´ü¸Â¤Ï <?=$pay_limit?> ¤Ç¤¹¡£</p>
+    <p>¼õÉÕÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤ÆÁ´¹ñ¤Î¥í¡¼¥½¥ó¤Þ¤¿¤Ï¥»¥¤¥³¡¼¥Þ¡¼¥È¤Ë¤Æ¤ª»ÙÊ§¤¯¤À¤µ¤¤¡£</p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr>
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=$receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?> </p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr>
+  </body>
+</html>
+<?php
+} else { 
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>">
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¡£</h1>
+    <h2>¤ªµÒÍÍ¤Î¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</h2>
+    <hr>
+    <blockquote><?=$MErrMsg?></blockquote>
+    <p><blockquote>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</blockquote></p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr>
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr>
+  </body>
+</html>
+<?php
+}
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(LWPayment.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/MIInvoice.php
===================================================================
--- /temp/trunk/html/test/iketest/MIInvoice.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/MIInvoice.php	(revision 1328)
@@ -0,0 +1,183 @@
+<?php
+##################################################
+# Veritrans CVS Merchant Development Kit.
+# MIInvoice.php¡¡Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ø
+#       ÀÜÂ³¤¹¤ë¤¿¤á¤Î¥µ¥ó¥×¥ë
+#       << ¥ß¥Ë¥¹¥È¥Ã¥×/¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­/¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢¡¼ÍÑ¥µ¥ó¥×¥ë >>
+##################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+include_once("Cart.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥«¡¼¥È¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$cart = new Cart;
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(MIInvoice.php)½èÍý³«»Ï... >>>');
+
+# ¥À¥ß¡¼¼è°úID¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$order_id = "mi-" . $cart->getOrderId();
+
+# ¥À¥ß¡¼¶â³Û¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$amount = $cart->getPrice();
+
+# ¥À¥ß¡¼»ÙÊ§´ü¸Â¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$pay_limit = $cart->getPayLimit();
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿ÇÛÎó¤ÎºîÀ®
+$params = array(
+    REQ_ORDER_ID => $order_id,
+    REQ_AMOUNT => $amount,
+    REQ_PAY_LIMIT => $pay_limit
+);
+
+# URL ¥¨¥ó¥³¡¼¥É¤ò¹Ô¤¦
+$params_str = $t->URLEncode($ENCODE, $params);
+
+# ¥Ú¡¼¥¸²þ¤¶¤ó¤òËÉ»ß¤¹¤ë¤¿¤á¤Ë¥Ï¥Ã¥·¥å¤ò·×»»¤¹¤ë
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $params_str);
+
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER = ' . $params_str);
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER_SIG = ' . $hash);
+
+# ²èÌÌ¤ò½ÐÎÏ
+?>
+<script language="javascript">
+<!--
+function disableSubmit(form) {
+  var elements = form.elements;
+  for (var i = 0; i < elements.length; i++) {
+    if (elements[i].type == 'submit') {
+      elements[i].disabled = true;
+    }
+  }
+}
+//-->
+</script>
+<html>
+<head>
+  <title>¤ªÇã¤¤¾å¤²¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>" />
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <hr />
+  <h1>¤ªÇã¤¤¾å¤²¾ðÊó</h1>
+  <p>
+    ¼è°úID:&nbsp;<strong><?=$order_id?></strong>
+  </p>
+  <p>
+    ²Á³Ê:&nbsp;<strong><?=$amount?></strong>&nbsp;±ß
+  </p>
+  <p>
+    ¤ª»ÙÊ§´ü¸Â:&nbsp;<strong><?=$pay_limit?></strong>
+  </p>
+  <h3>¤ªµÒÍÍ¾ðÊó</h3>
+  <form action="<?=$PAY_URL_MI?>" method="POST" onsubmit="disableSubmit(this)">
+    <table>
+      <tr>
+        <td>À«¡§</td>
+        <td><input type="text" name="REQ_NAME1" /></td>
+      </tr>
+      <tr>
+        <td>Ì¾¡§</td>
+        <td><input type="text" name="REQ_NAME2" /></td>
+      </tr>
+      <tr>
+        <td>ÅÅÏÃÈÖ¹æ¡§</td>
+        <td><input type="text" name="REQ_TEL_NO" /></td>
+      </tr>
+    </table>
+    <input type="hidden" name="REQ_ORDER" value="<?=$params_str?>" />
+    <input type="hidden" name="REQ_ORDER_SIG" value="<?=$hash?>" />
+    <p><input type="submit" value=" ¿½¹þ " /></p>
+  </form>
+  <hr />
+  <h3>É¬¤º²¼µ­¤Î»ö¹à¤òWeb¥Ú¡¼¥¸¤Î¤É¤³¤«¤Ëµ­ºÜ¤·¤Æ¤¯¤À¤µ¤¤¡£</h3>
+  <table>
+    <tr>
+      <td>1.1 ¼ýÇ¼¶ÈÌ³¤Ë¤Ä¤¤¤Æ</td>
+    </tr>
+    <tr>
+      <td>(1) ²ÃÌÁÅ¹¤ÎÌ¾¾Î</td>
+    </tr>
+    <tr>
+      <td>(2) ²ÃÌÁÅ¹¤Î½êºßÃÏ</td>
+    </tr>
+    <tr>
+      <td>(3) ²ÃÌÁÅ¹¤ÎÅÅÏÃÈÖ¹æ¡¢¥á¡¼¥ë¥¢¥É¥ì¥¹</td>
+    </tr>
+    <tr>
+      <td>(4) ²ÃÌÁÅ¹¤ÎÈÎÇäÀÕÇ¤¼ÔÌ¾µÚ¤ÓÀÕÇ¤¼Ô¤Ø¤ÎÏ¢ÍíÊýË¡</td>
+    </tr>
+    <tr>
+      <td>(5) ¾¦ÉÊ¤ÎÈÎÇä²Á³Ê¡¢ÀÇ¶â¡¢Á÷ÎÁ¤½¤ÎÂ¾É¬Í×¤È¤µ¤ì¤ëÎÁ¶â¡Ê°Ê²¼¡¢¤³¤ì¤é¤òÁí¾Î¤·¤Æ¾¦ÉÊÂå¶âÅù¤È¤¤¤¦¡Ë</td>
+    </tr>
+    <tr>
+      <td>(6) ¾¦ÉÊ¤Î°úÅÏ¤·´ü´Ö</td>
+    </tr>
+    <tr>
+      <td>(7) ¾¦ÉÊÂå¶âÅù¤Î»ÙÊ§»þ´üµÚ¤ÓÊýË¡</td>
+    </tr>
+    <tr>
+      <td>(8) ¾¦ÉÊ¤ÎÊÖÉÊ¡¦¼è¾Ã¤Ë´Ø¤¹¤ë»ö¹à</td>
+    </tr>
+    <tr>
+      <td>(9) ¸ÜµÒ¤«¤é¤ÎÁ÷¿®¥Ç¡¼¥¿Åù¤Ï²µ¤Ë¤è¤ê°ÂÁ´¤ËÊÝ¸î¤µ¤ì¤Æ¤¤¤ë»Ý¤ÎÉ½¼¨</td>
+    </tr>
+    <tr>
+      <td>(10) ¾åµ­°Ê³°¤ÇÆÃÄê¾¦¼è°úË¡¤ÇÄê¤á¤é¤ì¤¿»ö¹à</td>
+    </tr>
+    <tr>
+      <td>1.2 ¿½¹þ¼è¾Ã¡¦ÊÖÉÊ¡¦¸ò´¹¤Ë¤Ä¤¤¤Æ </td>
+    </tr>
+    <tr>
+      <td> ¸ÜµÒ¤ËÈÎÇä¤¹¤ë¤¹¤Ù¤Æ¤Î¾¦ÉÊ¤Ë¤Ä¤¤¤Æ¡¢ºÇ½ª¼õÎÎ¼Ô¤Ë°úÅÏ¤µ¤ì¤Æ¤«¤é²ÃÌÁÅ¹¤¬ÀßÄê¤¹¤ë°ìÄê´ü´Ö¤Ë </td>
+    </tr>
+    <tr>
+      <td> ¤ª¤¤¤Æ¤Ï¸ÜµÒ¤«¤é¤Î¾¦ÉÊ¤ÎÊÖÉÊËô¤Ï¸ò´¹¤ò¼õ¤±ÉÕ¤±¤ë¤â¤Î¤È¤·¡¢¤½¤Î»Ý¤òÈÎÇä»þÅÀ¤Ë²ÃÌÁÅ¹¤Î </td>
+    </tr>
+    <tr>
+      <td> ¥µ¥¤¥È¾å¤ËÌÀµ­¤¹¤ë¤â¤Î¤È¤·¤Þ¤¹¡£ </td>
+    </tr>
+    <tr>
+      <td> Ã¢¤·¡¢¾¦ÉÊ¤ÎÆÃÀ­¤Ë´Õ¤ß¤ÆÊÖÉÊËô¤Ï¸ò´¹¤ò¼õ¤±ÉÕ¤±¤Ê¤¤¾ì¹ç¤Ï¤¢¤é¤«¤¸¤áÈÎÇä»þÅÀ </td>
+    </tr>
+    <tr>
+      <td> ¤Ë²ÃÌÁÅ¹¤Î¥µ¥¤¥È¾å¤Ë¤½¤Î»Ý¤òÌÀµ­¤¹¤ë¤â¤Î¤È¤·¤Þ¤¹¡£ </td>
+    </tr>
+ </table>
+ <table>
+   <tr>
+     <td> ¥³¥ó¥Ó¥Ë¤ÇÈñÍÑ»ÙÊ§¸å·èºÑ¤ò¹Ô¤Ê¤Ã¤¿¥³¥ó¥Ó¥ËÅ¹ÊÞ¤ÇÊÖ¶â¤ò¼õ¤±¤ì¤Ê¤¤»Ý¤ÎÃí°Õ½ñ¤­¤òµ­½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£</td>
+   </tr>
+ </table>
+</body>
+</html>
+<?php
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(MIInvoice.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/MIPayment.php
===================================================================
--- /temp/trunk/html/test/iketest/MIPayment.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/MIPayment.php	(revision 1328)
@@ -0,0 +1,199 @@
+<?php
+######################################################
+# Veritrans CVS Merchant Development Kit.
+# MIPayment.php Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î
+#       ¥ì¥¹¥Ý¥ó¥¹¤ò½èÍý¤¹¤ë¥µ¥ó¥×¥ë
+#       << ¥ß¥Ë¥¹¥È¥Ã¥×/¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­/¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢ÍÑ¥µ¥ó¥×¥ë >>
+######################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+include_once($PHPLIB_PATH . "Transaction.php");
+include_once($PHPLIB_PATH . "Config.php");
+include_once($PHPLIB_PATH . "Log.php");
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(MIPayment.php)½èÍý³«»Ï... >>>');
+
+# »ÙÊ§¥Ú¡¼¥¸¤«¤é¤Î¥Ñ¥é¥á¡¼¥¿¤ò¼èÆÀ
+$query = $t->getQuery($ENCODE);
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿²þãâ¥Á¥§¥Ã¥¯
+$hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $query['REQ_ORDER']);
+
+#if ($hash != $query['REQ_ORDER_SIG']) {
+if (strlen($hash) <= 0 || $hash != $query['REQ_ORDER_SIG']) {
+    # ½ðÌ¾¥¨¥é¡¼¤òÉ½¼¨¤·¤Æ½ªÎ»
+?>
+<html>
+<head>
+  <title>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=<?=$ENCODE?>" />
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+  <p>ÅÅ»Ò½ðÌ¾¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£</p>
+</body>
+</html>
+<?php
+    exit;
+}
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤ò¥Ç¥³¡¼¥É
+$orders = $t->URLDecode($ENCODE, $query['REQ_ORDER']);
+
+#-----------------------------------------------
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸($request)¤Ë¥Ñ¥é¥á¡¼¥¿¤ò¥»¥Ã¥È¢­
+#-----------------------------------------------
+$request = array(
+    # ¸À¸ìÁªÂò
+    #REQ_ACCEPT_LANGUAGE => ACCEPT_LANGUAGE_JA,
+    # ¼è°ú¥³¥Þ¥ó¥É¡§ entry(ÅÐÏ¿)
+    #REQ_COMMAND => CMD_ENTRY,
+    # ¼è°ú ID
+    REQ_ORDER_ID => $orders[REQ_ORDER_ID],
+    # CVS¥¿¥¤¥×(¥ß¥Ë¥¹¥È¥Ã¥×¡¢¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¢etc)
+    REQ_CVS_TYPE => "02",
+    # ¶â³Û
+    REQ_AMOUNT => $orders[REQ_AMOUNT],
+    # »ÙÊ§´ü¸Â
+    REQ_PAY_LIMIT => $orders[REQ_PAY_LIMIT],
+    # »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+    # ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+    REQ_NAME1 => $t->jCode($query[REQ_NAME1], ENCODE_UTF8),
+    REQ_NAME2 => $t->jCode($query[REQ_NAME2], ENCODE_UTF8),
+    # ÅÅÏÃÈÖ¹æ
+    REQ_TEL_NO => $query[REQ_TEL_NO]
+);
+
+
+#------------------------------------------------
+# ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¼è°ú¤òÅê¤²¤ë
+# ¼è°ú·ë²Ì¤Ï result ¤Ë¥­¡¼¤ÈÃÍ¤Î¥Ú¥¢¤Ç³ÊÇ¼¤µ¤ì¤ë
+#------------------------------------------------
+$result = $t->doTransaction(CMD_ENTRY, $request);
+
+# ¥ì¥¹¥Ý¥ó¥¹ÃÍ¤ò¼èÆÀ¤¹¤ë
+$MStatus = $result[RES_MSTATUS];
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+    $aux_msg = $t->jCode($result[RES_AUX_MSG], $ENCODE);
+}
+else {
+    $MErrMsg = $t->jCode($result[RES_MERRMSG], $ENCODE);
+    $MErrLoc = $result[RES_MERRLOC];
+}
+$action_code = $result[RES_ACTION_CODE];
+$order_id = $result[RES_ORDER_ID];
+$order_ctl_id = $result[RES_ORDER_CTL_ID];
+$txn_version = $result[RES_TXN_VERSION];
+$merch_txn = $result[RES_MERCH_TXN];
+$cust_txn = $result[RES_CUST_TXN];
+$receipt_no = $result[RES_RECEIPT_NO];
+$haraikomi_url = $result[RES_HARAIKOMI_URL];
+$err_code = $result[RES_ERR_CODE];
+$payment_type = $result[RES_PAYMENT_TYPE];
+$ref_code = $result[RES_REF_CODE];
+
+# ¶â³Û¤È»ÙÊ§´ü¸Â¤¬¥²¡¼¥È¥¦¥§¥¤¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹ÅÅÊ¸¤Ë´Þ¤Þ¤ì¤Ê¤¤¤¿¤á
+# ¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤«¤é¼èÆÀ¤¹¤ë
+$amount = $request[REQ_AMOUNT];
+$pay_limit = $request[REQ_PAY_LIMIT];
+
+# »ÙÊ§·ë²Ì¤Ë¤è¤êÀ®¸ù¡¦¼ºÇÔ¥Ú¡¼¥¸¤òÉ½¼¨
+#if (substr_count($MStatus, RES_MSTATUS_SC) != 0) {
+if ($MStatus == 'success') {
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type"
+          content="text/html; charset=<?=$ENCODE?>" />
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¤´ÃíÊ¸À¿¤Ë¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£</h1>
+    <hr />
+    <p>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</p>
+    <p>·èºÑ¥µ¡¼¥Ó¥¹Ê§¹þ¼è°·É¼¤Ï
+       <a href="<?=$haraikomi_url?>"><?=$haraikomi_url?></a> ¤Ç¤¹¡£</p>
+    <p>»ÙÊ§¶â³Û¤Ï <?=$amount?> ±ß¤Ç¤¹¡£</p>
+    <p>»ÙÊ§´ü¸Â¤Ï <?=$pay_limit?> ¤Ç¤¹¡£</p>
+    <p>·èºÑ¥µ¡¼¥Ó¥¹Ê§¹þ¼è°·É¼¤ò°õºþ¤·Á´¹ñ¤Î¥ß¥Ë¥¹¥È¥Ã¥×¡¦¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¦¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢¡¼¤Ë¤Æ¤ª»ÙÊ§¤¯¤À¤µ¤¤¡£</p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr />
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=$receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr />
+  </body>
+</html>
+<?php
+} else { 
+?>
+<html>
+  <head>
+    <title>¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</title>
+    <meta http-equiv="Content-Type"
+          content="text/html; charset=<?=$ENCODE?>" />
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <h1>¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¡£</h1>
+    <h2>¤ªµÒÍÍ¤Î¤´ÃíÊ¸¤Ï¼õÉÕ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£</h2>
+    <hr />
+    <blockquote><?=$MErrMsg?></blockquote>
+    <p><blockquote>¤ªµÒÍÍ¤Î¼è°úID¤Ï <?=$order_id?> ¤Ç¤¹¡£</blockquote></p>
+    <!-- °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏÍÑÅÓ¤Ë¤è¤Ã¤Æ»È¤Ã¤Æ¤¯¤À¤µ¤¤
+    <hr />
+    <p>txn-version  :  <?=$txn_version?></p>
+    <p>merch-txn    :  <?=$merch_txn?></p>
+    <p>order-ctl-id :  <?=$order_ctl_id?></p>
+    <p>MStatus      :  <?=$MStatus?></p>
+    <p>MErrMsg      :  <?=$MErrMsg?></p>
+    <p>aux-msg      :  <?=$aux_msg?></p>
+    <p>receipt-no   :  <?=receipt_no?></p>
+    <p>action-code  :  <?=$action_code?></p>
+    <p>ref-code     :  <?=$ref_code?></p>
+    <p>MErrLoc      :  <?=$MErrLoc?></p>
+    <p>err-code     :  <?=$err_code?></p>
+    <p>cust-txn     :  <?=$cust_txn?></p>
+    <p>order-id     :  <?=$order_id?></p>
+    <p>amount       :  <?=$amount?></p>
+    <p>pay-limit    :  <?=$pay_limit?></p>
+    -->
+  <hr />
+  </body>
+</html>
+<?php
+}
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(MIPayment.php)½èÍý½ªÎ». >>>');
+?>
Index: /temp/trunk/html/test/iketest/index.html
===================================================================
--- /temp/trunk/html/test/iketest/index.html	(revision 1328)
+++ /temp/trunk/html/test/iketest/index.html	(revision 1328)
@@ -0,0 +1,29 @@
+<script type="text/javascript">
+<!--
+/* [´Ø¿ôÌ¾] getInputLength
+* [µ¡¡¡Ç½] ÆþÎÏÊ¸»ú¿ô¤ò¥ê¥¢¥ë¥¿¥¤¥àÉ½¼¨
+* [Àâ¡¡ÌÀ] È¾³Ñ¤âÁ´³Ñ¤â1Ê¸»ú¤È¤·¤Æ¥«¥¦¥ó¥È¡£²þ¹Ô¤Ï¥Î¡¼¥«¥¦¥ó¥È¡£
+* [°ú¡¡¿ô]
+* @param string Ê¸»úÎó
+* [ÊÖ¤êÃÍ] ¤Ê¤·
+*/
+function getInputLength(val){
+    var len = val.length; /* ÆþÎÏ¤µ¤ì¤¿Ê¸»úÎó¤ÎÄ¹¤µ */
+    var cnt=x=y=0;
+    for(i=0; ;cnt++){
+        /* ²þ¹Ô¤Î¤¬¤¤¤¯¤Ä¤¢¤ë¥«¥¦¥ó¥È */
+        x = val.indexOf("\n",y);
+         if(x==-1) break;
+         y=x+2;
+    }
+    /* ²þ¹Ô¤Ï¥«¥¦¥ó¥È¤»¤º¡¢Ê¸»ú¿ô¤Î¤ßÉ½¼¨ */
+    document.form11.elements["strlength"].value = len - (cnt * 2);
+}
+//-->
+</script>
+<form name="form11">
+ÆþÎÏ¤·¤¿Ê¸»úÎó¤ÎÊ¸»ú¿ô¤¬¡¢²¼¤Î¥Æ¥­¥¹¥ÈÆâ¤ËÉ½¼¨¤µ¤ì¤Þ¤¹<br>
+<textarea name="area" cols="60" rows="5" wrap="soft" onKeyup="getInputLength(this.value)"></textarea>
+<br>
+ÆþÎÏ¤µ¤ì¤¿Ê¸»ú¿ô¡§<input type=text size="3" name="strlength" readonly>
+</form>
Index: /temp/trunk/html/test/iketest/Cart.php
===================================================================
--- /temp/trunk/html/test/iketest/Cart.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/Cart.php	(revision 1328)
@@ -0,0 +1,53 @@
+<?php
+#########################################################
+# Veritrans CVS Merchant Development Kit.
+# BSCVS::Cart.php Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥¦¥§¥Ö¥µ¥ó¥×¥ë¤Î¥«¡¼¥È¥¯¥é¥¹¡£
+#       ¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+#########################################################
+
+class Cart
+{
+
+#------------------------------------------#
+# ¥á¥½¥Ã¥É: getOrderId
+# ÀâÌÀ: ¥À¥ß¡¼¤Î¼è°ú£É£Ä¤òÀ¸À®
+# ÆþÎÏÃÍ  : void
+# Ìá¤êÃÍ  : ¥À¥ß¡¼¼è°ú£É£Ä(YYYYMMDD-HHMISS)
+# Ãí°ÕÅÀ  :
+#------------------------------------------#
+function getOrderId() {
+    $id = sprintf("%4d%02d%02d-%02d%02d%02d",
+                  date("Y"), date("m"), date("d"),
+                  date("H"), date("i"), date("s"));
+    return $id;
+}
+
+#------------------------------------------#
+# ¥á¥½¥Ã¥É: getPrice
+# ÀâÌÀ: ¥À¥ß¡¼¤Î»ÙÊ§¶â³Û¤òÀ¸À®
+# ÆþÎÏÃÍ  : void
+# Ìá¤êÃÍ  : ¥À¥ß¡¼»ÙÊ§¶â³Û(2±ß)
+# Ãí°ÕÅÀ  :
+#------------------------------------------#
+function getPrice() {
+  return '2';
+}
+
+#------------------------------------------#
+# ¥á¥½¥Ã¥É: getPayLimit
+# ÀâÌÀ: ¥À¥ß¡¼¤Î»ÙÊ§´ü¸Â¤òÀ¸À®
+# ÆþÎÏÃÍ  : void
+# Ìá¤êÃÍ  : ¥À¥ß¡¼»ÙÊ§´ü¸Â(YYYY/MM/DD)
+# Ãí°ÕÅÀ  : ¸½ºß¤ÎÆüÉÕ¤è¤ê20Æü¸å¤ÎÆüÉÕ¤òÊÖ¤¹
+#------------------------------------------#
+function getPayLimit() {
+    $date = sprintf("%10s",
+                    date("Y/m/d",mktime(0,0,0,date("m"),
+                    date("d")+20,date("Y"))));
+    return $date;
+}
+
+}
+?>
Index: /temp/trunk/html/test/iketest/CKSInvoice.php
===================================================================
--- /temp/trunk/html/test/iketest/CKSInvoice.php	(revision 1328)
+++ /temp/trunk/html/test/iketest/CKSInvoice.php	(revision 1328)
@@ -0,0 +1,93 @@
+<?php
+##################################################
+# Veritrans CVS Merchant Development Kit.
+# CKSInvoice.php¡¡Version 1.0.0
+# Copyright(c) 2006 SBI VeriTrans Co., Ltd.
+# Note: ¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ø
+#       ÀÜÂ³¤¹¤ë¤¿¤á¤Î¥µ¥ó¥×¥ë
+#       << ¥µ¡¼¥¯¥ë K ¥µ¥ó¥¯¥¹ÍÑ¥µ¥ó¥×¥ë >>
+##################################################
+
+#-----------------------------------------------
+# CVSÍÑ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ÀßÄê
+# Ãí°Õ¡§¤ªµÒÍÍ¤Î´Ä¶­¤Ë¹ç¤ï¤»¤ÆÀßÄê¤·¤Æ¤¯¤À¤µ¤¤¡£
+#-----------------------------------------------
+# ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+
+require_once("../../require.php");
+require("merchant.ini");
+
+# ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+
+require_once($PHPLIB_PATH . "Transaction.php");
+require_once($PHPLIB_PATH . "Config.php");
+require_once($PHPLIB_PATH . "Log.php");
+require_once("Cart.php");
+
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = 'test/iketest/CKSInvoice.tpl';
+		$this->tpl_title = '¤ªÇã¤¤¾å¤²¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹';
+		global $PAY_URL_CKS;
+		$this->PAY_URL_CKS = $PAY_URL_CKS;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+# ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$t = new Transaction;
+
+# ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+$t->setServer($CONFIG);
+# ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+$logger = $t->getLogger();
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ(CKSInvoice.php)½èÍý³«»Ï... >>>');
+
+# ¥«¡¼¥È¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+$cart = new Cart;
+
+# ¥À¥ß¡¼¼è°úID¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$order_id = "ck-" . $cart->getOrderId();
+
+# ¥À¥ß¡¼¶â³Û¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$amount = $cart->getPrice();
+
+# ¥À¥ß¡¼»ÙÊ§´ü¸Â¤òºîÀ®
+# Ãí°Õ¡§¥·¥ç¥Ã¥Ô¥ó¥°¥«¡¼¥È¤Ê¤É¤«¤é¼èÆÀ¤¹¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£
+$pay_limit = $cart->getPayLimit();
+
+# ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿ÇÛÎó¤ÎºîÀ®
+$params = array(
+    REQ_ORDER_ID => $order_id,
+    REQ_AMOUNT => $amount,
+    REQ_PAY_LIMIT => $pay_limit
+);
+
+# URL ¥¨¥ó¥³¡¼¥É¤ò¹Ô¤¦
+$objPage->params_str = $t->URLEncode($ENCODE, $params);
+
+# ¥Ú¡¼¥¸²þ¤¶¤ó¤òËÉ»ß¤¹¤ë¤¿¤á¤Ë¥Ï¥Ã¥·¥å¤ò·×»»¤¹¤ë
+$objPage->hash = $t->genHash($MERCHANT_ID, $SIG_KEY, $objPage->params_str);
+
+$objPage->order_id = $order_id;
+$objPage->amount = $amount;
+$objPage->pay_limit = $pay_limit;
+
+# ¥í¥°½ÐÎÏ¥µ¥ó¥×¥ë
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER = ' . $objPage->params_str);
+$logger->logprint(DBGLVL_DEBUG, ' REQ_ORDER_SIG = ' . $objPage->hash);
+
+$logger->logprint('DEBUG', '<<< »ÙÊ§²èÌÌ(CKSInvoice.php)½èÍý½ªÎ»... >>>');
+
+# ²èÌÌ¤ò½ÐÎÏ
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/test/fukutest/test2.php
===================================================================
--- /temp/trunk/html/test/fukutest/test2.php	(revision 1328)
+++ /temp/trunk/html/test/fukutest/test2.php	(revision 1328)
@@ -0,0 +1,7 @@
+<?php
+
+$include_dir = realpath(dirname( __FILE__));
+
+echo $include_dir;
+
+?>
Index: /temp/trunk/html/test/fukutest/perl.php
===================================================================
--- /temp/trunk/html/test/fukutest/perl.php	(revision 1328)
+++ /temp/trunk/html/test/fukutest/perl.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+require_once("../require.php");
+
+$cgi_dir = "/home/web/ec-kit.lockon.co.jp/cgi-bin/";
+$cgi_name = "mauthonly.cgi";
+
+##  À®¸ùÎã
+
+$name01 = "fuku";
+$name02 = "hiro";
+$amount = "5000";
+$order_id = date("YmdHis", mktime());
+$card_no = "4111111111111111";
+$card_exp = "12/05";							# MM/DD
+
+
+$result = sfGetAuthonlyResult($cgi_dir, $cgi_name, $name01, $name02, $card_no, $card_exp, $amount, $order_id);
+
+
+echo "Àµ¤·¤¤ÅÅÊ¸¤òÁ÷¤ê¤Þ¤¹<br><br>\n";
+
+if ( $result['action-code'] === '000' ){
+	echo "·ë²Ì:À®¸ù<br><br>\n";
+} else {
+	echo "·ë²Ì:¼ºÇÔ<br><br>\n";
+}
+
+echo "<pre>";
+print_R($result);
+echo "</pre>";
+
+##  ¼ºÇÔÎã
+
+$name01 = "fuku";
+$name02 = "hiro";
+$amount = "500000";							
+$order_id = date("YmdHis"."1", mktime());
+$card_no = "4111111111111111";
+$card_exp = "09/04";						## ¤Õ¤ë¤¤¥«¡¼¥É					
+
+echo "¸í¤Ã¤¿ÅÅÊ¸¤òÁ÷¤ê¤Þ¤¹<br><br>\n";
+
+
+$result = sfGetAuthonlyResult($cgi_dir, $cgi_name, $name01, $name02, $card_no, $card_exp, $amount, $order_id);
+
+
+if ( $result['action-code'] === '000' ){
+	echo "·ë²Ì:À®¸ù<br><br>\n";
+} else {
+	echo "·ë²Ì:¼ºÇÔ<br><br>\n";
+}
+
+echo "<pre>";
+print_R($result);
+echo "</pre>";
+
+?>
Index: /temp/trunk/html/test/fukutest/index.php
===================================================================
--- /temp/trunk/html/test/fukutest/index.php	(revision 1328)
+++ /temp/trunk/html/test/fukutest/index.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+require_once("../require.php");
+$fuku = array(	"ÀèÆ¬"=>300,
+				"hoge"=>200,
+				"uhyo"=>130,
+				"muho"=>100,
+				"oge" =>10,
+				"ahe" =>30,
+				"¤¦¤Ò¤ç" =>20,
+				"¤â°ì¸Ä" =>15
+			);
+
+/*
+// ËÀ¥°¥é¥Õ		
+$hoge = new SC_JpGraph_Bar(600, 300);
+$hoge->setData($fuku);
+$hoge->getGraph();
+*/
+
+// ±ß¥°¥é¥Õ
+$hoge = new SC_JpGraph_Pie(500, 300);
+$hoge->setData($fuku);
+$hoge->getGraph();
+
+/*
+// ÀÞ¤ìÀþ¥°¥é¥Õ		
+$hoge = new SC_JpGraph_Line(600, 300, 2);
+$hoge->setData($fuku);
+$hoge->getGraph();
+*/
+
+?>
Index: /temp/trunk/html/test/kakinaka/dragdrop/kakinaka.php
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/kakinaka.php	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/kakinaka.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?PHP
+
+
+
+
+
+
+
+
+?>
Index: /temp/trunk/html/test/kakinaka/dragdrop/files/style.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/files/style.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/files/style.js	(revision 1328)
@@ -0,0 +1,23 @@
+
+var d = document;
+var n = navigator;
+var Mac = n.appVersion.indexOf('Mac');
+var MSIE = n.userAgent.indexOf('MSIE');
+var Safari = n.userAgent.indexOf('Safari');
+var Netscape = n.userAgent.indexOf('Netscape');
+var css = null;
+	
+if(Mac>-1){
+	if((Safari>1)||(MSIE>1)){
+		css = 'mac-webkit.css';
+	}else{
+		css = 'mac.css';
+	}
+}else{
+	if(MSIE>1){
+		css = 'win-ie.css';
+	}else{
+		css = 'win.css';
+	}
+}
+d.write('<link rel="stylesheet" href="/drecomcms/css/' + css + '" type="text/css">\n');
Index: /temp/trunk/html/test/kakinaka/dragdrop/files/common.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/files/common.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/files/common.js	(revision 1328)
@@ -0,0 +1,466 @@
+/*
+ * ¶¦ÄÌ JavaScript
+ *
+ *
+ * Copyright (c) 2003 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * ¥Ö¥é¥¦¥¶²èÌÌÎÎ°è¤ÎÉý¤ò¼èÆÀ
+ */
+function getWidth(win)
+{
+	var tmp_width;
+    
+	if (win.document.documentElement) { 
+		tmp_width = win.document.documentElement.clientWidth;
+		if (tmp_width > 0) {
+			return tmp_width;
+		}
+	}
+    if (win.document.all) {
+    	tmp_width = win.document.body.clientWidth;
+		return tmp_width;
+	}
+	return win.innerWidth;
+}
+       
+/**
+ * ¥Ö¥é¥¦¥¶²èÌÌÎÎ°è¤Î¹â¤µ¤ò¼èÆÀ
+ */
+function getHeight(win)
+{
+	var tmp_height;
+    
+	if (win.document.documentElement) {
+		tmp_height = win.document.documentElement.clientHeight;
+		if (tmp_height > 0) {
+			return(tmp_height);
+		}
+	}
+    if (win.document.all) {
+		return(win.document.body.clientHeight);
+	}
+	return(win.innerHeight);
+}
+
+/**
+ * Window¤òÃæ¿´¤Ë°ÜÆ°
+ */
+function moveWindowToCenter(win) {
+	x = (screen.width  - getWidth(win)) / 2;
+	y = (screen.height - getHeight(win)) / 2;
+	win.moveTo(x,y);
+}
+
+/**
+ * ¾ï¤Ë¼êÁ°¤ËÉ½¼¨¤¹¤ë¥¦¥£¥ó¥É¥¦¤ò³«¤¯
+ */
+function openModalWindow(url, name, height, width, scrollbars, resizable, status)
+{
+	ModalWindow = openWindow(url, name, height, width, scrollbars, resizable, status);
+	onfocus = function onFocus(){
+		if (null !=ModalWindow && !ModalWindow.closed) {
+			try {
+				ModalWindow.focus();
+			} catch(e) {
+				document.onmousemove = null;
+			}
+		} else {
+			document.onmousemove = null;
+		}
+	}
+	
+	document.onmousemove = onfocus;
+	
+	return ModalWindow;
+}
+
+/**
+ * ¥¦¥£¥ó¥É¥¦¤ò³«¤¯
+ */
+function openWindow(url, name, height, width, scrollbars, resizable, status, left, top)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					((left) ? ",left=" + left : "") + ((top) ? ",top=" + top : "") +
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status;
+
+	subWindow = window.open(url, name, window_condition);
+	// ¥Ý¥Ã¥×¥¢¥Ã¥×¥Ö¥í¥Ã¥«¡¼¤Ê¤É¤Ç¥Ö¥í¥Ã¥¯¤µ¤ì¤¿¾ì¹ç¤ËJavaScript¥¨¥é¡¼¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë
+	if (subWindow) {
+		subWindow.focus();
+	}
+
+	return subWindow;
+}
+
+/**
+ * ¥¦¥£¥ó¥É¥¦¤ò¸å¤í¤Ë³«¤¯
+ */
+function openWindowBack(url, name, height, width, scrollbars, resizable, status)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status +
+					",left=" + window.screen.width;
+	subWindow = window.open(url, name, window_condition);
+	subWindow.blur();
+	window.focus();
+	subWindow.moveTo(0,0);
+	return subWindow;
+}
+
+/**
+ * Esc¥­¡¼¤Ç¥¦¥£¥ó¥É¥¦¤òÊÄ¤¸¤ë¥¤¥Ù¥ó¥È
+ * 
+ * ¢¨¥µ¥Ö¥¦¥£¥ó¥É¥¦¤Îonload¤Ç
+ *   document.body.onkeypress = subwinCloseOnEsc;
+ * ¤Î¤è¤¦¤Ë»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£
+ */
+function subwinCloseOnEsc(ev)
+{
+	ev || (ev = window.event);
+	if (ev.keyCode == 27) {
+		window.close();
+		return false;
+	}
+	return true;
+}
+
+
+
+// 2004-06-09 Takanori Ishikawa 
+// -----------------------------------------------------------
+// htmlAlert(), htmlConfirm() ¤Ï html ¤ò¤½¤Î¤Þ¤Þ
+// ½ÐÎÏ¤»¤º¡¢¥µ¥Ë¥¿¥¤¥º¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+// sanitize html message
+function sanitize_msg(msg)
+{
+	msg = msg.replace(/</g, '&lt;');
+	msg = msg.replace(/>/g, '&gt;');
+	msg = msg.replace(/&lt;br\s*&gt;/g, '<br>');
+
+	return msg;
+}
+// alert
+function htmlAlert(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	msg = sanitize_msg(msg);
+	
+	if (defined(window.showModalDialog)) {
+		showModalDialog("/drecomcms/html/message_box.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+  	} else {
+		dialogArguments = msg;
+		ModalWindow = open("/drecomcms/html/message_box.html", "sub_alert","height=" + height + ",width=" + width + 
+					",scrollbars=no,resizable=no,toolbar=no,status=no,alwaysRaised=yes");
+		onfocus = function onFocus(){
+			if (null !=ModalWindow && !ModalWindow.closed) {
+				ModalWindow.focus();
+			}
+		}
+		document.onmousemove = onfocus;
+		return ModalWindow;
+	}
+}
+// confirm
+function htmlConfirm(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	if (defined(window.showModalDialog)) {
+		var value = showModalDialog("/drecomcms/html/confirm.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+		if (typeof value == "undefined") {
+			value = false;
+		} 
+		return value;
+	} else {
+		return window.confirm(msg.replace(/<br[^>]*\/?>/, '\n'));
+	}
+}
+
+/**
+  * ÍËÆü¤ò¼èÆÀ¤¹¤ë´Ø¿ô
+  * year:  Ç¯
+  * month: ·î
+  * day:   Æü
+  */
+function getDayOfWeek(year, month, day) {
+
+	DateOfWeek	= new Date();
+	DateOfWeek.setYear(year);
+	DateOfWeek.setMonth(month - 1);
+	DateOfWeek.setDate(day);
+	day_of_week_number	= DateOfWeek.getDay();
+
+	days = new Array('Æü','·î','²Ð','¿å','ÌÚ','¶â','ÅÚ');
+	return days[day_of_week_number];
+}
+
+
+// -----------------------------------------------------------
+// ¥Ý¡¼¥¿¥ë¡¢¥Ø¥Ã¥À
+// -----------------------------------------------------------
+/**
+ * INPUT FORM ¤ÎÇØ·Ê¿§ÊÑ¹¹
+ */
+function focusForm(obj,flag){
+	if (obj == null || obj.style == null) {
+		return;	
+	}
+	obj.style.backgroundColor = flag ? '#FFFFCC' : '#FFFFFF' 
+}
+function Skinup(fnr){
+	win = window.open('/contents/skinpop_'+fnr,'skin','width=455,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
+	win.focus();
+}
+function imgSwap(name,gifPath) {
+	document.images[name].src = gifPath ;
+}
+
+
+// -----------------------------------------------------------
+// ²èÁü
+// -----------------------------------------------------------
+/**
+ * ²èÁü¤ÎÉ½¼¨¥µ¥¤¥ºÄ´À°
+ */
+function adjustImageSize(imgElementName, widthMax, heightMax) {
+	var imgs = document.getElementsByName(imgElementName);
+	if (imgs) {
+		if (!imgs.length) {
+			if (widthMax && imgs.width > widthMax) {
+				imgs.height = imgs.height * widthMax / imgs.width;
+				imgs.width = widthMax;
+			}
+			if (heightMax && imgs.height > heightMax) {
+				imgs.width = imgs.width * heightMax / imgs.height;
+				imgs.height = heightMax;
+			}
+		} else {
+			for (i=0; i<imgs.length; i++) {
+				if (widthMax && imgs[i].width > widthMax) {
+					imgs[i].height = imgs[i].height * widthMax / imgs[i].width;
+					imgs[i].width = widthMax;
+				}
+				if (heightMax && imgs[i].height > heightMax) {
+					imgs[i].width = imgs[i].width * heightMax / imgs[i].height;
+					imgs[i].height = heightMax;
+				}
+			}
+		}
+	}
+}
+
+/**
+ * ËÜÊ¸¤ÎHTML¥½¡¼¥¹¤è¤ê³°Éô²èÁüURL("http://¡Á")¤òPickUp
+ */
+function getExternalImageList(orgHtml) {
+
+	var extImageList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+	
+	exp = new RegExp("<img [^>]*src=[\"']?http://[^\"']*[\"']?[^>]*>", 'ig');
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("src=[\"']?");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp("[\"'\\s>]|/>");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+				
+				var isExist = false;
+				for (var j = 0; j < extImageList.length; j++) {
+					if (extImageList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extImageList[n++] = str; }
+			}
+		}
+	}
+	return extImageList;
+}
+
+/**
+ * ËÜÊ¸¤ÎHTML¥½¡¼¥¹¤è¤ê³°ÉôFlashURL("http://¡Á")¤òPickUp
+ */
+function getExternalFlashList(orgHtml) {
+
+	var extFlashList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+
+	var flashTag = "\\{\\\$CMSInclude [^\\\$\\}]*name=\"flash\"\\s*param=\"[^\"]*Movie=http://[^\"]*\"\\s*\\\$\\}";	
+	exp = new RegExp(flashTag, 'ig');	
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("Movie=");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp(";");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+
+				var isExist = false;				
+				for (var j = 0; j < extFlashList.length; j++) {
+					if (extFlashList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extFlashList[n++] = str; }
+			}
+		}
+	}
+	return extFlashList;
+}
+ 
+/**
+ * ¥ê¥ó¥¯¤ÎÁ«°ÜÀè¤òÌµ¸ú¤Ë¤¹¤ë¡£
+ * ¡Ê<a>¥¿¥°¤ÎhrefÂ°À­¤ò"javascript:void(0)"¤ËÃÖ´¹¡Ë
+ */
+function replaceLinkInvalid(html) {
+	html = html.replace(/<a [^>]*>/ig, '<a href="javascript:void(0);">');
+	html = html.replace(/openPermLink\([^)]*\)/ig, 'void(0)');
+	return html;
+}
+
+/**
+ * URLÍÑ¤Î¥¨¥¹¥±¡¼¥×¤ò¹Ô¤¤¤Þ¤¹¡£
+ * '&' -> '&amp;'
+ * '>' -> '&gt;'
+ * '<' -> '&lt;'
+ * '"' -> '&quot;'
+ * Î¾Ã¼¤Î¶õÇò¤Ï Trim
+ * ' ' -> '%20'
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ escapeUrl(/*: String :*/ src) {
+	var s = replaceAll(src, '&', '&amp;');
+	s = replaceAll(s, '>', '&gt;');
+	s = replaceAll(s, '<', '&lt;');
+	s = replaceAll(s, '"', '&quot;');
+	s = trim(s);
+	s = replaceAll(s, ' ', '%20');
+	return s;
+}
+function /*: String :*/ escapeScript(/*: String :*/ src) {
+	var s = replaceAll(src, "\\", "\\\\");
+	s = replaceAll(s, "'", "\\'");
+	s = replaceAll(s, "\"", "\\\"");
+	return s;
+}
+/**
+ * Ê¸»úÎó¤ÎÁ´ÃÖ´¹¤ò¹Ô¤¤¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ * @param oldc µìÊ¸»úÎó
+ * @param newc ¿·Ê¸»úÎó
+ */
+function /*: String :*/ replaceAll(/*: String :*/src, /*: String :*/oldc, /*: String :*/newc) {
+ var h = "";
+ var b = src;
+ var index = 0;
+ while (true) {
+  index = b.indexOf(oldc, 0);
+  if (index == -1) {
+   break;
+  }
+  src = b.replace(oldc, newc);
+  h += src.substring(0, index + newc.length);
+  b = src.substring(index + newc.length, src.length);
+ }
+ return h + b;
+}
+/**
+ * Î¾Ã¼¤ÎÈ¾³Ñ/Á´³Ñ¥¹¥Ú¡¼¥¹¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ trim(/*: String :*/src ) {
+	var s = trimR(src);
+	return trimL(s);
+}
+/**
+ * ±¦Ã¼¤ÎÈ¾³Ñ/Á´³Ñ¥¹¥Ú¡¼¥¹¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ trimR(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(strFinal.length - 1, strFinal.length) == " ") || (strFinal.substring(strFinal.length - 1, strFinal.length) == "¡¡")) {
+			strFinal = strTemp.substring(0, strTemp.length - (nLoop + 1));
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+/**
+ * º¸Ã¼¤ÎÈ¾³Ñ/Á´³Ñ¥¹¥Ú¡¼¥¹¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ trimL(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(0, 1) == " ") || (strFinal.substring(0, 1) == "¡¡")) {
+			strFinal = strTemp.substring(nLoop + 1, strTemp.length );
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+
+/**
+ * ·Ñ¾µ
+ */
+function extend(subClass, superClass) {
+    for (var prop in superClass.prototype) {
+        subClass.prototype[prop] = superClass.prototype[prop];
+    }
+}
+
+
+/**
+ * ¥Ý¥Ã¥×¥¢¥Ã¥×¥Ö¥í¥Ã¥«¡¼ÂÐºö
+ * window.onPopupBlocked,window.onPopupNonBlocked¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¤¯¤À¤µ¤¤¡£
+ */
+window.onPopupBlocked = function(){
+	alert('¥¦¥£¥ó¥É¥¦¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£¥Ý¥Ã¥×¥¢¥Ã¥×¥Ö¥í¥Ã¥«¡¼¤òÍ­¸ú¤Ë¤·¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Ìµ¸ú¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£');
+};
+
+window.onPopupNonBlocked = function(){}
+
+if (typeof window.org_open == 'undefined'){
+	window.org_open = window.open;
+	window.open = function() {
+		var win = (2 == window.open.arguments.length)
+					? window.org_open(window.open.arguments[0], window.open.arguments[1])
+					: window.org_open(window.open.arguments[0], window.open.arguments[1], window.open.arguments[2]);
+		if (null == win) {
+			window.onPopupBlocked(window.open.arguments);
+		} else {
+			window.onPopupNonBlocked(window.open.arguments);
+		}
+		return win;
+	}
+}
+
+
Index: /temp/trunk/html/test/kakinaka/dragdrop/files/access_key.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/files/access_key.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/files/access_key.js	(revision 1328)
@@ -0,0 +1,51 @@
+/*
+ * Access Key Utilities
+ *
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * ÊÝÂ¸¥·¥ç¡¼¥È¥«¥Ã¥È¤òÍ­¸ú¤Ë¤¹¤ë¤«¤É¤¦¤«¡£
+ * ¥·¥ç¡¼¥È¥«¥Ã¥È¤è¤ê¤âÀè¤Ë¡¢¥Ö¥é¥¦¥¶¤ÎÊÝÂ¸¥À¥¤¥¢¥í¥°¤¬½Ð¤ë¾ì¹ç¤ÏÌµ¸ú¤Ë¤¹¤ë¡£
+ * 
+ * @return ÊÝÂ¸¥·¥ç¡¼¥È¥«¥Ã¥È¤òÍ­¸ú¤Ë¤¹¤ë¤«¤É¤¦¤«
+ */
+function shortCutSupported()
+{
+	return (document.all != null && null == XBSUtil.opera);
+}
+
+function access_key_onkeydown_hock(theEvent) 
+{
+	if (false == shortCutSupported()) {
+		return true;
+	}
+
+	if (theEvent == null) {
+		theEvent = window.event;
+	}
+	var willCancel = false;
+	var k = XBSEvent.getKeyCode(theEvent);
+	var m = XBSEvent.getModifierFlags(theEvent);
+	if (m & XBSEvent.CONTROL_KEY_MASK){
+		if (k == 83) {  // 's'
+			execSave != null ? execSave() : void(0);
+			willCancel = true;
+		}
+	} else if (m & XBSEvent.ALT_KEY_MASK){
+		if (k == 80) {  // 'p'
+			execPrint != null ? execPrint() : void(0);
+			willCancel = true;
+		}
+	}
+	if (willCancel) {
+		theEvent.returnValue = false;
+		return false;
+	}
+	
+	return true;
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/files/sidefunc_order.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/files/sidefunc_order.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/files/sidefunc_order.js	(revision 1328)
@@ -0,0 +1,1014 @@
+/**
+ * 
+ * ¥µ¥¤¥É¥Ð¡¼ÊÔ½¸ JavaScript
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+
+//---------------------------------------------------------------------------------
+// ÀßÄê
+//---------------------------------------------------------------------------------
+
+// *** ½é´üÀßÄêÊÑ¿ô *** //
+
+var gSidefuncOrderForm = null;
+var SIDEFUNC_ORDER_FORM_NAME = "SidefuncOrderForm";
+
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+//
+// Mac ¤Î IE5 ¤ÏºÂÉ¸´ØÏ¢¤Îµ¡Ç½¡Ê¤À¤±¤¸¤ã¤Ê¤¤¤±¤É¡Ë¤ÎÂ¿¤¯¤¬¶¸¤Ã¤Æ¤¤¤ë
+// ¤Î¤ÇÅ¬Åö¤ËÂÐ±þ
+//
+// »²¹Í¡§
+// Mac ¤Î¿©¤¨¤Ê¤¤ÌîÏº¤É¤â
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+var MAC_IE5_PITCH_X;
+var MAC_IE5_PITCH_Y;
+
+MAC_IE5_PITCH_X = MAC_IE5_PITCH_Y = 0;	/* BITCH */
+if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+	MAC_IE5_PITCH_X = -10;
+	MAC_IE5_PITCH_Y = 0;
+}
+
+
+// *** CheckLine *** //
+var CHECKLINE_ID = 'checkline';
+
+
+// --- Panel ---
+// ¼±ÊÌ»Ò
+var PANEL_NAME_DISABLE	= 'DISABLE';	// ³°µ¡Ç½BOX¤ÎID
+var PANEL_NAME_LEFT		= 'LEFT';		// Æâ¡¦º¸µ¡Ç½BOX¤ÎID
+var PANEL_NAME_RIGHT	= 'RIGHT';		// Æâ¡¦±¦µ¡Ç½BOX¤ÎID
+
+//¤¹¤Ù¤Æ¤Î Panel ¤ò¥×¥í¥Ñ¥Æ¥£¤Ë¤â¤Ä¥ª¥Ö¥¸¥§¥¯¥È
+// key ¤Ï name
+var gAllPanels         = new Object();
+
+// º¸¤«¤é¤Î½çÈÖ
+var gPanelNames         = [PANEL_NAME_DISABLE, PANEL_NAME_LEFT, PANEL_NAME_RIGHT];
+
+
+// --- Box ---
+var BOX_ID_PREFIX 		= 'f';			// Box ¤Î ID ¥×¥ê¥Õ¥£¥Ã¥¯¥¹
+var BoxConfig = {
+	width: 		120,	// Box Éý
+	height: 	20,		// Box ¹â¤µ
+	padding: 	10,		// Box ´Ö¤Î¥¹¥Ú¡¼¥¹
+	marginTop: 	5,		// °ìÈÖ¾å¤ÎBox¤È¿Æ¥Ñ¥Í¥ë¤È¤Î¥¹¥Ú¡¼¥¹
+	marginLeft: 5		// Box ¤È¿Æ¥Ñ¥Í¥ë¤Îº¸Â¦¤Î¥¹¥Ú¡¼¥¹
+};
+
+// Box ÇÛÃÖÎÎ°è¤ÎºÇ¾®¹â¤µ
+var MIN_BOXIES_HEIGHT	= 200;
+
+// ¤¹¤Ù¤Æ¤Î Box ¤ò¥×¥í¥Ñ¥Æ¥£¤Ë¤â¤Ä¥ª¥Ö¥¸¥§¥¯¥È
+var gAllBoxes           = new Object();
+
+/**
+ * ¥Ñ¥Í¥ë¤Ë³ÊÇ¼¤Ç¤­¤ëºÇÂç Box ¿ô¤òµ­Ï¿¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * key: ¥Ñ¥Í¥ëÌ¾ value: ¥Ñ¥Í¥ë¤Ë³ÊÇ¼¤Ç¤­¤ëºÇÂç Box ¿ô
+ * 
+ */
+
+BoxConfig.maxNBoxes = new Object();
+BoxConfig.maxNBoxes[PANEL_NAME_DISABLE]	= OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES;	// ¡Ö»ÈÍÑ¤·¤Ê¤¤µ¡Ç½¡×
+BoxConfig.maxNBoxes[PANEL_NAME_LEFT]	= OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES;		// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×º¸
+BoxConfig.maxNBoxes[PANEL_NAME_RIGHT]	= OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES;		// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×±¦
+
+/**
+ * ¥Ú¡¼¥¸ÆÉ¤ß¹þ¤ß»þ¤ÎÇÛÃÖ¥Ç¡¼¥¿
+ */
+gInitialBoxPositionsData = null;
+
+//---------------------------------------------------------
+// ÇÛÃÖ¤Ê¤É
+//---------------------------------------------------------
+/**
+ * HTML ¤Î hidden input Í×ÁÇ¤«¤é¹àÌÜ¤ÎÇÛÃÖ¤Ê¤É¤Î¾ðÊó¤òÆÉ¤ß¼è¤ë¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+SFSettings = new Object();
+
+/**
+ * HTML ¤Î hidden input Í×ÁÇ¤«¤éÀßÄêÃÍ¤òÆÉ¤ß¼è¤ë
+ */
+SFSettings.loadBoxPositions = function()
+{
+	var positions = new Object();
+	var orders       = new Array();
+	var panelNames   = new Array();	
+	
+	// hidden¤«¤ébox_position¤ò¼èÆÀ
+	positions[PANEL_NAME_DISABLE]	= new Array();
+	positions[PANEL_NAME_LEFT]		= new Array();
+	positions[PANEL_NAME_RIGHT]		= new Array();
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			var idx = XBSUtil.parseIntNoError(elem.value);
+			panelNames[panelNames.length] = gPanelNames[idx];
+		} else if (Box.ID_PROPERTY_NAME == elem.name) {
+			;
+		}
+	}
+	for (var i = 0; i < orders.length; i++) {
+		var pnm = panelNames[i];
+		var bid = i;
+		var ord = orders[i];
+		
+		positions[pnm][bid] = ord;
+	}
+	
+	orders     = null;
+	panelNames = null;
+	return positions;
+}
+
+/**
+ * ¸½ºß¤Î¾õÂÖ¤òÃ±°ì¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¨¥ó¥³¡¼¥É¤·¤ÆÊÖ¤¹¡£
+ */
+SFSettings.getObjectForPersistent = function()
+{
+	var orders = new Array();
+	var pidxes = new Array();
+	var result = '';
+	
+	if (gSidefuncOrderForm == null) {
+		return result;
+	}
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			pidxes[pidxes.length] = XBSUtil.parseIntNoError(elem.value);
+		}
+	}
+	result += pidxes.join('');
+	result += orders.join('');
+	pidxes = null;
+	orders = null;
+	
+	return result;
+}
+
+//---------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------
+/**
+ * ¥µ¥¤¥É¥Ð¡¼¤ÎÊÑ¹¹¤ò´Æ»ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È
+ * ContentsChangedListener ¤Î¥µ¥Ö¥¯¥é¥¹
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+function SFChangedListener(/* Optional */ aName) /* extends ContentsChangedListener */
+{
+}
+SFChangedListener.prototype = new ContentsChangedListener();
+SFChangedListener.prototype.setChanged = function(b) 
+{
+	var persistent = SFSettings.getObjectForPersistent();
+	
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// ¤³¤³¤Ç prototype ¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤â¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¡£
+
+	this.changed = (gInitialBoxPositionsData != persistent);
+}
+
+//---------------------------------------------------------
+// Drag & Drop: SFDragManager (Sidebar Function DragManager)
+//---------------------------------------------------------
+/**
+ * ¥É¥é¥Ã¥°½èÍý¤ÎÍ­¸ú²½¡¢ÅÓÃæ¤Î¾õÂÖ¤òÊÝ»ý¤¹¤ë¤¿¤á¤Î¥ª¥Ö¥¸¥§¥¯¥È
+ * ¥É¥é¥Ã¥°½èÍý¤Ï°ìÅÙ¤Ë¤Ò¤È¤Ä¤·¤«µ¯¤³¤é¤Ê¤¤¤Î¤Ç¡¢¤¤¤Þ¤Î¤È¤³¤í
+ * Singleton ¤È¤·¤Æ¼ÂÁõ
+ * 
+ * For example:
+ * <pre>
+ * // prepare for dragging, enable event handler.
+ * SFDragManager.enableEventHandler();
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+SFDragManager = new Object();
+
+// *** Event Handler *** //
+SFDragManager.ondrop = null;  // ÇÛÃÖ¤¬ÊÑ¹¹¤µ¤ì¤¿
+
+
+// ¥É¥é¥Ã¥°½èÍý¤ËÍøÍÑ¤¹¤ë document ¤Î¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤òÀßÄê
+SFDragManager.enableEventHandler = function ()
+{
+	document.onmousemove = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.moveBox(e);
+	};
+	
+	document.onmouseup = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.downBox(e);
+	};
+	
+	for (var key in gAllBoxes) {
+		var box = gAllBoxes[key];
+		var src = box ? box.getHTMLElement() : null;
+		
+		if (src != null) {
+			src.onmousedown = SFDragManager.pickUpBox;
+		}
+	}
+}
+
+// ¥É¥é¥Ã¥°½èÍý¤ËÍøÍÑ¤¹¤ë document ¤Î¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤ò²ò½ü
+SFDragManager.disbleEventHandler= function()
+{
+	document.onmousemove	= '';
+	document.onmouseup		= '';
+}
+
+
+//¥É¥é¥Ã¥°Ãæ¤Î¥ª¥Ö¥¸¥§¥¯¥È
+
+SFDragManager.destination = null;	/* °ÜÆ°Àè Panel */
+SFDragManager.source      = null;	/* °ÜÆ°¸µ Panel */
+SFDragManager.box         = null;	/* ¥É¥é¥Ã¥°Ãæ¤Î Panel */
+
+/**
+ * ¥µ¥¤¥É¥Ð¡¼¹àÌÜ¤ÎÊÑ¹¹¤ò´Æ»ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡£
+ */
+SFDragManager.getChangedListener = function()
+{
+	if (SFDragManager.getChangedListener.$instance == null) {
+		
+		SFDragManager.getChangedListener.$instance = 
+			new SFChangedListener("[Sidebar Function Order]");
+	}
+	return SFDragManager.getChangedListener.$instance;
+}
+SFDragManager.setUpContentsChangedListener = function()
+{
+	// 2004-04-23  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// ¥µ¥¤¥É¥Ð¡¼¤ÎÇÛÃÖ¤¬ÊÑ¹¹¤µ¤ì¤¿¤«¤É¤¦¤«¤òµ­Ï¿
+	
+	var listener = SFDragManager.getChangedListener();
+	
+	listener.listenEvent(SFDragManager, 'ondrop');
+	OEMBlogGlobal.watchOtherLinks(document, listener);
+}
+
+/**
+  * setOnLoad()
+  *
+  * ¥Ú¡¼¥¸ÆÉ¤ß¹þ¤ß»þ¤Î½é´ü½èÍý
+  */
+SFDragManager.loaded = false;
+SFDragManager.onload = function() 
+{
+	// ¥Õ¥©¡¼¥à½é´ü²½
+	gSidefuncOrderForm = UtilKit.getPropertyNotNull(document, SIDEFUNC_ORDER_FORM_NAME);
+	
+	// ³Æ Panel, Box ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+	var boxPositions = SFSettings.loadBoxPositions();
+	gInitialBoxPositionsData = SFSettings.getObjectForPersistent();
+	for (var i = 0; i < gPanelNames.length; i++) {
+		var nm = gPanelNames[i];
+		var panel;
+		
+		panel = new Panel(nm, boxPositions[nm]);
+		
+		for(var key in panel.box_position) {
+			gAllBoxes[key] = new Box(key);
+		}
+		
+		// Box ¤Î½é´üÇÛÃÖ
+		panel.setBoxPosition();
+		Panel[nm] = panel;
+		
+		gAllPanels[nm] = panel;
+	}
+	
+	
+	// ¥É¥é¥Ã¥°½èÍý¤Î½àÈ÷
+	SFDragManager.setUpContentsChangedListener();
+	SFDragManager.enableEventHandler();
+	
+	// onload ¤â¥¤¥Ù¥ó¥È
+	resetPositionsInEventHandler();
+	window.onresize = resetPositionsInEventHandler;
+	
+	SFDragManager.loaded = true;
+	// 2004-04-20  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// Opera ¤Ç¤Ï onload »þÅÀ¤Ç¥ì¥¤¥ä¡¼¤ÎºÆÉÁ²è¤¬´Ö¤Ë¹ç¤ï¤Ê¤¤¡£
+	// ¤³¤Î´Ø¿ô¤ò»È¤Ã¤Æ¡¢ÌµÍý¤ä¤êºÆÉÁ²è¤¹¤ë¡£
+	if (window.opera) {
+		SFDragManager.loaded = false;
+		setTimeout("refreshDisplay()", 0.8*1000);
+	}
+	
+}
+
+
+//---------------------------------------------------------
+// ¥¤¥Ù¥ó¥È½èÍý
+//---------------------------------------------------------
+// CheckLine
+/**
+ *  ¥É¥é¥Ã¥°Ãæ¤Î Box ¤¬ÁÞÆþ¤µ¤ì¤ë²Õ½ê¤ò»Ø¤·¼¨¤¹¤¿¤á¤Î¥é¥¤¥ó 
+ *
+ * @return XBSLayer
+ * @see xbs.js 
+ */
+function getCheckLineLayer()
+{
+	if (null == getCheckLineLayer.layer) {
+		getCheckLineLayer.layer = XBSLayer.makeLayer(CHECKLINE_ID);
+	}
+	return getCheckLineLayer.layer;
+}
+function getPanelAtPosition(x, y)
+{
+	var panel = null;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+			
+		if (x > panel.panel_section['left']  &&
+			x < panel.panel_section['right'] &&
+			y > panel.panel_section['top']   &&
+			y < panel.panel_section['under']) 
+		{ break; }
+	}
+	return panel;
+}
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+// Mac IE ¤Ç¤Ï¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤ÎÃæ¤ÇºÂÉ¸´Ø·¸¤ÎÁàºî¤ò¹Ô¤¦¤È¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Î¤Ç
+// ¤¹¤³¤·ÃÙ¤é¤»¤Æ¼Â¹Ô
+function resetPositionsInEventHandler()
+{
+	if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+		setTimeout("resetPositions()", 1*1000);	
+	} else {
+		resetPositions();
+	}
+}
+
+// *** Reset *** //
+/**
+  * ¤¹¤Ù¤Æ¤Î Box ¤òºÆÇÛÃÖ
+  */
+function resetPositions() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setSections(); 
+			panel.setBoxPosition(); 
+		}
+	}
+}
+
+/**
+ * ¤¹¤Ù¤Æ¤Î Box ¤ò°ìÅÙ¾Ã¤·¡¢¤¹¤°¤Ë¤¹¤Ù¤ÆÉ½¼¨
+ */
+function refreshDisplay() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setBoxVisible(false);
+			panel.setBoxVisible(true);		
+		}
+	}
+	SFDragManager.loaded = true;
+}
+
+// -----------------------------------------------------------------
+// ¥Ü¥Ã¥¯¥¹¤Î¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×
+// -----------------------------------------------------------------
+
+/**
+  * pickUpBox()
+  * theEvent: ¥¤¥Ù¥ó¥È
+  *
+  * Box¤ò»ý¤Á¾å¤²¤¿(¥¯¥ê¥Ã¥¯¤µ¤ì¤¿)»þ¤Î½èÍý¤ò¤¹¤ë´Ø¿ô
+  */
+SFDragManager.pickUpBox = function(theEvent) {
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	if (SFDragManager.box != null || SFDragManager.loaded == false)
+		return;
+	
+	// ¥Þ¥¦¥¹°ÌÃÖ¼èÆÀ
+	var mouse_x	    = XBSEvent.getMouseX(theEvent);
+	var mouse_y	    = XBSEvent.getMouseY(theEvent);
+	var pickedPanel = getPanelAtPosition(mouse_x, mouse_y);
+
+	if (null == pickedPanel) 
+		return;
+
+	// ÁªÂò¤µ¤ì¤¿Box¤ÎÊÂ¤Ó½çÈÖ¹æ¤È id ¤ò¼èÆÀ
+	var beforeId = pickedPanel.orderIndexOfBoxAt(mouse_x, mouse_y);
+	var funcId	= UtilKit.getKeyForValue(pickedPanel.box_position, beforeId);
+	
+	if (null == funcId)
+		return;
+	
+	//Box¥¨¥ì¥á¥ó¥È¼èÆÀ¡¦½èÍý
+	var selected = new XBSLayer(BOX_ID_PREFIX + funcId);
+	if (null == selected) 
+		return;
+
+	selected.setZIndex(selected.getZIndex() +1);
+
+	//ÁªÂò¤µ¤ì¤¿Box¤ÎX,YºÂÉ¸¤òÊÝÂ¸
+	before_box_x	= selected.getX() + MAC_IE5_PITCH_X;
+	before_box_y	= selected.getY() + MAC_IE5_PITCH_Y;
+
+	//¥Þ¥¦¥¹¤ÈBox¸¶ÅÀ¤Îº¹
+	box_to_mouse_x	= mouse_x - before_box_x;
+	box_to_mouse_y	= mouse_y - before_box_y;
+	
+	// ¥É¥é¥Ã¥°³«»Ï
+	SFDragManager.box = selected;
+	SFDragManager.source = pickedPanel;
+	before_order_id = beforeId;
+	function_id = funcId;
+}
+
+/**
+ * 
+ * Box¤ò°ÜÆ°¤¹¤ë´Ø¿ô
+ * 
+ * @param theEvent mousemove ¥¤¥Ù¥ó¥È
+ */
+SFDragManager.moveBox = function(theEvent) {
+	var selected = SFDragManager.box;
+	
+	if (null == selected || SFDragManager.loaded == false)
+		return;
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	//
+	// ¥É¥é¥Ã¥°Ãæ¡¢¥¦¥£¥ó¥É¥¦¤«¤é½Ð¤ë»þ¥ê¥»¥Ã¥È¤·¤Æ½ª¤ï¤ë
+	//
+	if (false == Box.canMoveWithEvent(theEvent)) {
+		gAllBoxes[function_id].setPosition(before_box_x, before_box_y);
+		clearMove();
+		
+		return;
+	}
+
+	var mouse_x  = XBSEvent.getMouseX(theEvent);
+	var mouse_y  = XBSEvent.getMouseY(theEvent);
+	var curPanel = getPanelAtPosition(mouse_x, mouse_y);
+	if (null == curPanel) 
+		return;
+	
+	if (curPanel.canDropAtPosition(SFDragManager.source, selected, mouse_x, mouse_y)) {
+		// ¥Á¥§¥Ã¥¯¥é¥¤¥óÉ½¼¨
+		curPanel.showCheckLineAtPosition(mouse_x, mouse_y);
+	}
+
+	//Box°ÜÆ°
+	move_to_x = mouse_x - box_to_mouse_x;
+	move_to_y = mouse_y - box_to_mouse_y;
+	
+	selected.setLeftTopPosition(move_to_x, move_to_y);
+}
+
+/**
+ * Box ¤ò²¼¤í¤·¤¿»þ¤Î½èÍý
+ * 
+ * @param theEvent ¥¤¥Ù¥ó¥È
+ */
+SFDragManager.downBox = function(theEvent)
+{
+	if (SFDragManager.loaded == false) {
+		return;
+	}
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// ¥Á¥§¥Ã¥¯¥é¥¤¥ó¤ò¾Ã¤¹
+	getCheckLineLayer().setVisible(false);
+
+	// ¥Þ¥¦¥¹°ÌÃÖ¼èÆÀ
+	var mouse_x = XBSEvent.getMouseX(theEvent);
+	var mouse_y = XBSEvent.getMouseY(theEvent);
+	
+	// -------------------------------------
+	// °ÜÆ°ÎÎ°èÆâ¤«³°¤«¥Á¥§¥Ã¥¯
+	// -------------------------------------
+	// °ÜÆ°Àè¤Î¥Ñ¥Í¥ë¤ò¼èÆÀ¤·¡¢¥É¥é¥Ã¥°¾ðÊó¤ò¹¹¿·
+	// ¥É¥é¥Ã¥°Á°¸å¤Î¥Ñ¥Í¥ë
+	var beforePanel = SFDragManager.source;
+	var afterPanel  = getPanelAtPosition(mouse_x, mouse_y);
+	
+	SFDragManager.destination = afterPanel;
+	if (null == beforePanel) {
+		throw ASSERT_EXCEPTION + 'SFDragManager.source must be not null';
+	}
+	
+	var droppedBox = gAllBoxes[function_id];
+	var after_order_id = afterPanel.orderIndexOfMovingAt(mouse_x, mouse_y);
+	
+	// ¥É¥í¥Ã¥×¤Ç¤­¤Ê¤¤¾ì¹ç¡¢Box ¤òÌá¤·¤Æ¡¢¥É¥é¥Ã¥°½èÍý¤ò½ªÎ»¤¹¤ë
+	if (false == afterPanel.canDropAtPosition(beforePanel, droppedBox, mouse_x, mouse_y)) {
+		droppedBox.setPosition(before_box_x, before_box_y);
+		clearMove();
+		return;
+	}
+
+	// °ÜÆ°¤¹¤ëBox¤ò¥Ñ¥Í¥ë¤«¤éºï½ü¤·¡¢½çÈÖ¤òÀ°Íý¤¹¤ë
+	delete beforePanel.box_position[function_id];	
+	for (key in beforePanel.box_position) {
+		if (before_order_id < beforePanel.box_position[key]) {
+			--beforePanel.box_position[key];
+		}
+	}
+
+	//after_order_id¤Î½èÍý
+	if (!(beforePanel.equals(afterPanel) && before_order_id <= after_order_id)) {
+		++after_order_id;
+	}
+
+
+	// ºÇÂç¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò¹¹¿·
+	if (after_order_id > afterPanel.getMaxOrderIndex() + 1) {
+		after_order_id = afterPanel.getMaxOrderIndex() + 1;
+	}
+
+	//ÁÞÆþ¤¹¤ë´Ö¤ò¤Ä¤¯¤ê¡¢ÁÞÆþ¤¹¤ë
+	for (key in afterPanel.box_position) {
+		if (after_order_id <= afterPanel.box_position[key]) {
+			++afterPanel.box_position[key];
+		}
+	}
+	afterPanel.box_position[function_id] = after_order_id;
+
+	//BoxºÆÇÛÃÖ
+	if (false == beforePanel.equals(afterPanel)) {
+		beforePanel.setBoxPosition();
+	}
+	afterPanel.setBoxPosition();
+
+	// HTML¤ÎhiddenÃÍÊÑ¹¹
+	for (var nm in gAllPanels) {
+		var p = gAllPanels[nm];
+
+		for (key in p.box_position) {
+			gSidefuncOrderForm.elements['order'][key].value = p.box_position[key];
+			gSidefuncOrderForm.elements['position'][key].value = p.getPosition();
+		}
+	}
+
+	// °ÜÆ°¤Î²ò½ü
+	clearMove();
+	if (SFDragManager.ondrop != null && typeof SFDragManager.ondrop == 'function') {
+		SFDragManager.ondrop();
+	}	
+}
+
+
+/**
+  * clearMove()
+  *
+  * Box°ÜÆ°¤ò½ªÎ»¤¹¤ë´Ø¿ô
+  */
+function clearMove() {
+	var selected = SFDragManager.box;
+	
+	selected.setZIndex(selected.getZIndex() -1);
+	SFDragManager.box = null;
+}
+
+//---------------------------------------------------------------------------------
+// Panel
+//---------------------------------------------------------------------------------
+/**
+  * ¸Ä¡¹¤Î¥É¥é¥Ã¥°²ÄÇ½¤Ê¹àÌÜ¤òÊÝ»ý¤¹¤ëÎÎ°è
+  * 
+  * ¤¤¤Þ¤Î¤È¤³¤í¡¢º¸¤«¤é¡Ö»ÈÍÑ¤·¤Ê¤¤µ¡Ç½¡×¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡¦º¸¡×¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡¦±¦¡×
+  *
+  * @param aPanelName    ¥Ñ¥Í¥ë¤ÎÌ¾Á°
+  * @param aPositionArray Box¤ÎÇÛÃÖ¾ðÊóÇÛÎó
+  *
+  * @author Yusuke Saito
+  * @version 2003/10/10
+  * 
+  * @author Takanori Ishikawa
+  * @version 2004/04/20
+  */
+function Panel(aPanelName, aPositionArray)
+{
+	this.name			   = aPanelName;						// ¥Ñ¥Í¥ë¤ÎÌ¾Á°(div¤Îid)
+	this.box_position	   = aPositionArray;					// Box¤ÎÇÛÃÖ¾ðÊóÇÛÎó
+	this.box_limit_number  = BoxConfig.maxNBoxes[aPanelName];	// ¥Ñ¥Í¥ëÆâ¤ÎºÇÂçBox¿ô
+	
+	this.position = -1;
+	for (var i = 0; i < gPanelNames.length; i++) {
+		if (this.name == gPanelNames[i]) {
+			this.position = i;
+			break;
+		}
+	}
+	
+	// ¥Ñ¥Í¥ë¡¦¥Ü¥Ã¥¯¥¹¡¦°ÜÆ°¤Î³ÆÎÎ°è¤òÀßÄê
+	this.setSections();
+}
+
+/**
+ * Box ¤Î Y offset
+ * 
+ * @param anIndex order index
+ */
+Panel.getBoxSectionOffsetY = function(anIndex)
+{
+	if (Panel.box_section_y == null) {  // Box °ÌÃÖÀßÄê
+		var nboxs = BoxConfig.maxNBoxes[PANEL_NAME_DISABLE];
+		Panel.box_section_y = new Array(nboxs);
+		
+		for (var i = 0; i < nboxs; ++i) {
+			Panel.box_section_y[i] = (BoxConfig.height + BoxConfig.padding) * i + BoxConfig.marginTop;
+		}
+	}
+	return Panel.box_section_y[anIndex];
+}
+
+Panel.prototype.getPosition = function() {
+	return this.position;
+}
+
+/**
+ * description
+ */
+Panel.prototype.toString = function()
+{
+	return '[Panel] ' + this.name;
+}
+
+/**
+ * Èæ³Ó
+ * 
+ * @param aPanel ¥Ñ¥Í¥ë
+ */
+Panel.prototype.equals = function(aPanel)
+{
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// instanceof ¤Ï IE 6 ¤Ç¤âÌ¤¥µ¥Ý¡¼¥È	
+	if (aPanel == null || /*false == (aPanel instanceof Panel)*/ typeof aPanel.name == 'undefined') {
+		return false;
+	}	
+	return this.name == aPanel.name;
+}
+
+
+/**
+  * setSections()
+  * 
+  * ¥¦¥£¥ó¥É¥¦¤ò¸¶ÅÀ¤È¤·¤¿¥Ñ¥Í¥ë¤Î£´ÊÕ¤ÎX,YºÂÉ¸¤òÀßÄê¤¹¤ë´Ø¿ô
+  * left:º¸ÊÕX right:±¦ÊÕX top:¾åÊÕY under:²¼ÊÕY
+  */
+Panel.prototype.setSections = function() {
+
+	// ¿Æ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¼èÆÀ
+	this.setUpPanelSections();
+
+	//BoxÎÎ°è¤ÎÀßÄê
+	this.setBoxSection();
+
+	//Box°ÜÆ°ÀèÎÎ°è¤ÎÀßÄê
+	this.setMoveSection();
+}
+
+
+/**
+  * setUpPanelSections()
+  * 
+  * ¥¦¥£¥ó¥É¥¦¤ò¸¶ÅÀ¤È¤·¤¿¥Ñ¥Í¥ë¤Î£´ÊÕ¤ÎX,YºÂÉ¸¤òÀßÄê¤¹¤ë´Ø¿ô
+  * left:º¸ÊÕX right:±¦ÊÕX top:¾åÊÕY under:²¼ÊÕY
+  */
+Panel.prototype.setUpPanelSections = function() 
+{
+	var psec    = new Object;
+	var lyer = XBSLayer.makeLayer(this.name);
+	
+	psec['left'] = MAC_IE5_PITCH_X; 
+	psec['top']  = MAC_IE5_PITCH_Y;
+	
+	psec['right'] = lyer.getWidth();
+	psec['under'] = lyer.getHeight();
+	while (lyer != null && lyer.isValid() && lyer.hasID()) {
+		
+		psec['left'] += lyer.getX();	
+		psec['top']  += lyer.getY();
+		lyer = lyer.getParent();
+	}
+	psec['right'] += psec['left'];
+	psec['under'] += psec['top'];
+
+	this.panel_section = psec;
+}
+
+/**
+  * setBoxSection()
+  * 
+  * Box¤Î¼ý¤Þ¤ëÎÎ°è¤òÀßÄê¤¹¤ë´Ø¿ô
+  * box_section[ÊÂ¤Ó½çÈÖ¹æ] => (left => º¸ÊÕX, right => ±¦ÊÕX, top => ¾åÊÕY, under => ²¼ÊÕY)
+  */
+Panel.prototype.setBoxSection = function() {
+
+	//BoxÎÎ°è¤ÎÀßÄê
+	this.box_section_left_x		= this.panel_section['left'] + BoxConfig.marginLeft;
+	this.box_section_right_x	= this.box_section_left_x + BoxConfig.width
+
+	this.box_section			= new Array(this.box_limit_number);
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.box_section[i]				= new Array(4);
+		this.box_section[i]['left']		= this.box_section_left_x;
+		this.box_section[i]['right']	= this.box_section_right_x;
+		this.box_section[i]['top']		= Panel.getBoxSectionOffsetY(i) + this.panel_section['top'];
+		this.box_section[i]['under']	= this.box_section[i]['top'] + BoxConfig.height;
+	}
+}
+
+/**
+ * ¥Ñ¥Í¥ë¤ÎÃæ¤Ç°ìÈÖ²¼¤Î Box ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤òÊÖ¤¹
+ * 
+ * @return °ìÈÖ²¼¤Î Box ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¡£
+ */
+Panel.prototype.getMaxOrderIndex = function()
+{
+	var max = -1;
+	for(key in this.box_position) {
+		max = (max < this.box_position[key]) ? this.box_position[key] : max;
+	}
+	return Number(max);
+}
+
+/**
+ * »ØÄê¤µ¤ì¤¿°ÌÃÖ¤ËºÇ¤â¶á¤¤¡¢Box ¤òÁÞÆþ²ÄÇ½¤Ê²Õ½ê¤Ë¥Á¥§¥Ã¥¯¥é¥¤¥ó¤òÉ½¼¨¤¹¤ë¡£
+ * 
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ */
+Panel.prototype.showCheckLineAtPosition = function(x, y)
+{
+	if (typeof x != typeof 0 || typeof y != typeof 0) {
+		throw ASSERT_EXCEPTION + 'x or y arg';
+	}
+	
+	var moveOrderId   = this.orderIndexOfMovingAt(x, y);
+	var maxOrderIndex = this.getMaxOrderIndex();
+	
+	if (null == moveOrderId)
+		return;
+	
+	if (maxOrderIndex < moveOrderId) {
+		moveOrderId = maxOrderIndex;
+	}
+	if (moveOrderId < this.box_limit_number) {
+		// ¥Á¥§¥Ã¥¯¥é¥¤¥ó°ÜÆ°
+		var check_line_left = this.panel_section['left'];
+		var check_line_top = this.move_section[moveOrderId]['top'];
+
+		// °ìÃ¶¥Á¥§¥Ã¥¯¥é¥¤¥ó¤ò¾Ã¤¹
+		getCheckLineLayer().setVisible(false);
+		getCheckLineLayer().setLeftTopPosition(check_line_left, check_line_top);
+		getCheckLineLayer().setVisible(true);
+	}
+}
+
+
+/**
+  * setMoveSection()
+  * 
+  * Box¤ò°ÜÆ°¤Ç¤­¤ëÎÎ°è¤òÀßÄê¤¹¤ë´Ø¿ô
+  * move_section[ÊÂ¤Ó½çÈÖ¹æ] => (left => º¸ÊÕX, right => ±¦ÊÕX, top => ¾åÊÕY, under => ²¼ÊÕY)
+  */
+Panel.prototype.setMoveSection = function() {
+
+	//°ÜÆ°ÎÎ°è¤ÎÀßÄê
+	this.move_section_left_x	= this.panel_section['left'];
+	this.move_section_right_x	= this.move_section_left_x + BoxConfig.width + (BoxConfig.marginLeft * 2);
+	this.move_section			= new Array(this.box_limit_number + 1);
+
+	this.move_section[-1]			= new Array(4);
+	this.move_section[-1]['left']	= this.move_section_left_x;
+	this.move_section[-1]['right']	= this.move_section_right_x;
+	this.move_section[-1]['top']	= this.panel_section['top'] - 7;
+	this.move_section[-1]['under']	= this.panel_section['top'] + (BoxConfig.marginTop / 2) + BoxConfig.height;
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.move_section[i]			= new Array(4);
+		this.move_section[i]['left']	= this.move_section_left_x;
+		this.move_section[i]['right']	= this.move_section_right_x;
+		this.move_section[i]['top']		= this.move_section[i - 1]['under'];
+		this.move_section[i]['under']	= this.move_section[i]['top'] + BoxConfig.height + BoxConfig.padding;
+	}
+}
+
+
+
+Panel.prototype.canDropAtPosition = function(aSourcePanel, aBox, x, y)
+{
+	var orderIndex = this.orderIndexOfMovingAt(x, y);
+	var maxIndex = this.getMaxOrderIndex() + 1;
+
+	// ¥Ñ¥Í¥ë¤«¤é³°¤ì¤¿¡¢
+	// ¥Ñ¥Í¥ë¤ÎºÇÂç Box ¿ô¤òÄ¶¤¨¤ë = false
+	return (orderIndex != null && (this.equals(aSourcePanel) || this.box_limit_number > maxIndex));
+}
+
+/**
+ * °ÜÆ°Ãæ¡¢ÁÞÆþ¤µ¤ì¤ë²Õ½ê¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤òÊÖ¤¹¡£
+ * 
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ * @return ÁÞÆþ¤µ¤ì¤ë¥¤¥ó¥Ç¥Ã¥¯¥¹¡¢¤Ê¤±¤ì¤Ð null
+ */
+Panel.prototype.orderIndexOfMovingAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.move_section, x, y);
+}
+Panel.prototype.orderIndexOfBoxAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.box_section, x, y);
+}
+// private
+Panel.prototype.findOrderIndexOf_ = function(sectionDataArray, x, y)
+{
+	for (var i = -1; i < sectionDataArray.length; i++) {
+		var sec = sectionDataArray[i];
+		if (sec == null)
+			continue;
+		
+		if (x >= sec['left'] && x <= sec['right'] &&
+			y >= sec['top']  && y <= sec['under']) {
+	
+			return i
+		}
+	}
+	return null;
+}
+
+/**
+  * setBoxPosition()
+  *
+  * Box¤òºÆÇÛÃÖ¤¹¤ë´Ø¿ô
+  */
+Panel.prototype.setBoxPosition = function() {
+	for (key in this.box_position) {
+		gAllBoxes[key].setPosition(
+			this.panel_section['left'] + BoxConfig.marginLeft,
+			this.panel_section['top']  + Panel.getBoxSectionOffsetY(this.box_position[key]) );
+	}
+}
+
+Panel.prototype.setBoxVisible = function(flag)
+{
+	for (key in this.box_position) {
+		gAllBoxes[key].setVisible(flag);
+	}
+}
+
+
+
+//---------------------------------------------------------------------------------
+// Box
+//---------------------------------------------------------------------------------
+/**
+ * ¸Ä¡¹¤Î¥É¥é¥Ã¥°¤Ç°ÜÆ°²ÄÇ½¤Ê¹àÌÜ
+ * 
+ * @param anId HTML Í×ÁÇ¤Î id Â°À­
+ * 
+ * @author Yusuke Saito
+ * @version 2003/10/10
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/21
+ */
+function Box(anId)
+{	
+	this.uniqID     = anId;
+	this.srcElement = XBSLayer.getLayerImpById(BOX_ID_PREFIX + anId);
+
+	this.setUpSize();
+	this.x = this.y = 0;	
+}
+
+Box.prototype.getFormID = function() { return this.uniqID; }
+Box.prototype.getHTMLElement = function() { return this.srcElement; }
+
+/**
+ * HTML ¤Î hidden input Í×ÁÇ¤ÇÅÏ¤µ¤ì¤ë¥×¥í¥Ñ¥Æ¥£¤ÎÌ¾Á°
+ */
+Box.POSITION_PROPERTY_NAME = "position";
+Box.ORDER_PROPERTY_NAME    = "order";
+Box.NAME_PROPERTY_NAME     = "sidefuncName";
+Box.AUTHOR_PROPERTY_NAME   = "authorCd";
+Box.ID_PROPERTY_NAME       = "sidefuncId";
+
+
+/**
+ * ¥É¥é¥Ã¥°½èÍý¤ÎºÇÃæ¤Ë¸Æ¤Ð¤ì¤ë¡£
+ * 
+ * @param theEvent mousemove
+ * @return ¥É¥é¥Ã¥°½èÍý¤ò¥­¥ã¥ó¥»¥ë¤¹¤ë¾ì¹ç¤Ï¡¢false ¤òÊÖ¤¹¡£
+ */
+Box.MOVABLE_INSET = 5;	/* ¥É¥­¥å¥á¥ó¥È¤ÎÃ¼ - Box.MOVABLE_INSET = ¥É¥é¥Ã¥°²ÄÇ½¤ÊÎÎ°è */
+Box.canMoveWithEvent = function(theEvent) 
+{
+	// ÁêÂÐÅª¤Ê°ÌÃÖ¤¬¤Û¤·¤¤¤Î¤Ç¡¢XBSDocument.getPageOffsetX/Y() ¤ò°ú¤¯
+	var mouse_x = XBSEvent.getMouseX(theEvent) - XBSDocument.getPageOffsetX();
+	var mouse_y = XBSEvent.getMouseY(theEvent) - XBSDocument.getPageOffsetY();
+	
+	if (mouse_x < Box.MOVABLE_INSET || mouse_y < Box.MOVABLE_INSET) {
+		return false;
+	}
+	
+	var maxX = XBSDocument.getWidth() - Box.MOVABLE_INSET;
+	var maxY = XBSDocument.getHeight() - Box.MOVABLE_INSET;
+	
+	if (mouse_x > maxX || mouse_y > maxY) {
+		return false;
+	}
+	
+	return true;
+}
+
+/**
+  * setUpSize()
+  * 
+  * Box¤ÎÂç¤­¤µ¤òÀßÄê¤¹¤ë´Ø¿ô
+  */
+Box.prototype.setUpSize = function() 
+{
+	var imp = this.getHTMLElement();
+	
+	// style.height ¤Ç¤Ê¤¤¤È opera ¤Ç¤¦¤Þ¤¯¤¤¤«¤Ê¤¤
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = BoxConfig.height;	
+		imp.style.width = BoxConfig.width;	
+	} else {
+		XBSLayer.setHeightWithLayerImp(imp, BoxConfig.height);
+		XBSLayer.setWidthWithLayerImp(imp, BoxConfig.width);
+	}
+	XBSLayer.setCursorWithLayerImp(imp, 'move');
+}
+
+/**
+  * Box¤Î°ÌÃÖ¤òÀßÄê
+  * 
+  * @param left x
+  * @param top  y
+  */
+Box.prototype.setPosition = function(left, top) 
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top);
+	this.x = left; this.y = top;
+}
+/**
+ * Box ¤Î²Ä»ëÂ°À­¤òÀßÄê
+ */
+Box.prototype.setVisible = function(flag)
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.setVisibilityWithLayerImp(imp, flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/files/xbs.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/files/xbs.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/files/xbs.js	(revision 1328)
@@ -0,0 +1,1462 @@
+/**
+ * XBS (Cross Browser Scripting) Utilities
+ *
+ * Copyright (c) 2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+//---------------------------------------------------------------------------------
+// Debugging 
+//---------------------------------------------------------------------------------
+/**
+ * Assertion ¤Ë¼ºÇÔ¤·¤¿¤È¤­¤Ë¤³¤ì¤ò throw
+ */
+ASSERT_EXCEPTION = '*** Assertion Failur *** ';
+
+/**
+ * dprint, dinspect ¤Î½ÐÎÏ¤ò¥¹¥È¥Ã¥×¤¹¤ë¤È¤­¤Ï true ¤ËÀßÄê
+ */
+BLOCK_DEBUG_PRINT  = true;
+
+
+/**
+ * v ¤¬ undefined ¤Ç¤Ê¤±¤ì¤Ð true
+ */
+function defined(v) { return (typeof v != 'undefined'); }
+
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤Î¤¹¤Ù¤Æ¤Î¥×¥í¥Ñ¥Æ¥£¤ò dprint ´Ø¿ô¤ÇÉ½¼¨
+ * 
+ * @param ¥ª¥Ö¥¸¥§¥¯¥È
+ */
+function dinspect(anObj)
+{
+	if (null == anObj) return;
+	for (key in anObj) {
+		dprint(key + ": " + anObj[key]);
+	}
+
+}
+
+function dprint(obj)
+{
+	if (BLOCK_DEBUG_PRINT) {
+		return;
+	}
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("/drecomcms/js/Console.html", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+	}
+	
+	var t = dprint.window.document.getElementById('console');
+	
+	if (t != null) {
+		t.value = t.value + "\n> " + obj.toString();
+	}
+// Takanori Ishiakwa 04/04/06
+// -----------------------------------------
+// Safari ¤ä Opera ¤Ç¤¦¤Þ¤¯Æ°ºî¤·¤Ê¤¤¤¿¤á
+// TextArea ¥Ð¡¼¥¸¥ç¥ó¤ËÀÚ¤êÂØ¤¨¤¿
+/*
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+		dprint.window.document.open("text/plain");	
+	}
+	var d = dprint.window.document;
+	
+	if (d == null) return;
+
+	d.writeln("> " + obj.toString());
+	
+	// Opera: mime text/plain ¤ò»ØÄê¤·¤Æ¤â HTML ¤È¤·¤Æ²ò¼á
+	// ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤Î¤Ç¡¢²þ¹Ô¤µ¤»¤ë¤¿¤á¤Ë¥¿¥°¤ò½ÐÎÏ
+	if (window.opera) d.writeln("<br>");
+*/
+}
+
+// ---------------------------------------------------------
+// XBSUtil
+// ---------------------------------------------------------
+// for the purpose of namespace
+/**
+ * ¥Ö¥é¥¦¥¶¸ß´¹¤òÌÜ»Ø¤·¤Æ¡¢¥æ¡¼¥Æ¥£¥ê¥Æ¥£·²¤ò¤Þ¤È¤á¤¿¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSUtil = new Object();
+
+/**
+ * Í×ÁÇ¤ò´Þ¤à document ¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡£
+ * 
+ * @param document
+ */
+XBSUtil.getOwnerDocument = function(anElement) 
+{
+	if (anElement.document) {
+		return anElement.document;
+	} else if (anElement.ownerDocument) {
+		return anElement.ownerDocument;
+	}
+	return null;
+}
+
+
+/**
+ * Unicode code points collection
+ * 
+ * ¥×¥í¥°¥é¥àÃæ¤Ç»È¤¦Ê¸»ú¥³¡¼¥É¤ò½¸¤á¤¿¤â¤Î
+ * 
+ * @author Takanori Ishikawa
+ * @version 1.0
+ */
+XBSCType = new Object();
+
+// *** XBSCType ½é´ü²½ *** //
+// ½é´ü²½¥Æ¡¼¥Ö¥ë
+// key: property name
+// value: string (length must be 1)
+XBSCType.template_ = {
+	CR:    '\r',
+	LF:    '\n',
+	TAB:   '\t',
+	SPACE: ' ',
+	LT:    '<',
+	GT:    '>',
+	SLASH: '/',
+	COLON: ':',
+	AMP:   '&',
+	LBRACE:'{',
+	RBRACE:'}'
+};
+
+for (var key in XBSCType.template_) {
+	var c = XBSCType.template_[key];
+	
+	if (c.length != 1) {
+		throw ASSERT_EXCEPTION + 'XBSCType.template_[' + key + '] length must be 1.';
+	}
+	c = c.charCodeAt(0);
+	XBSCType[key] = c;
+}
+// ºï½ü
+delete XBSCType.template_;
+
+/**
+ * isspace
+ */
+XBSCType.isspace = function(c) 
+{
+	return (c == XBSCType.SPACE || c == XBSCType.TAB || c == XBSCType.CR || c == XBSCType.LF);
+}
+
+
+/**
+ * DOM ¥µ¥Ý¡¼¥È¶ñ¹ç¤Ë¤è¤ë¥Ö¥é¥¦¥¶È½ÊÌ
+ * 
+ * <ul>
+ * <li>IE4:   IE4 ÁêÅö</li>
+ * <li>IE5:   IE5 ÁêÅö</li>
+ * <li>NN4:   NN4 ÁêÅö</li>
+ * <li>NN6:   NN6 ÁêÅö</li>
+ * <li>OTHER: ¾åµ­°Ê³°</li>
+ * </ul>
+ */
+OTHER = 0;
+IE4   = 1;
+IE5   = 2;
+NN4   = 3;
+NN6   = 4;
+XBSUtil.DOM = document.all 
+				? (document.getElementById ? IE5 : IE4)
+				: (document.getElementById 
+					? NN6
+					: (document.layers ? NN4 : OTHER));
+
+/**
+ * ¥Æ¥­¥¹¥ÈÁàºî API ¤Î¥µ¥Ý¡¼¥È¶ñ¹ç¤Ë¤è¤ë¥Ö¥é¥¦¥¶È½ÊÌ
+ */
+XBSUtil.Range = null;
+if (document.selection != null && defined(document.selection.createRange)) {
+	XBSUtil.Range = IE5;
+}
+
+
+// ¥¨¥é¡¼»þ¤Ë¤Ï 0 ¤òÊÖ¤¹ parseInt(), 10 ¿Ê¿ô
+XBSUtil.parseIntNoError = function(anObj) {
+	var v = 0;	
+
+	try {
+		v = parseInt(anObj, 10);
+	} catch (e) {
+
+	}
+	if ((typeof v != typeof 0) || isNaN(v)) {
+		v = 0;
+	}
+
+	return v;
+}
+
+/**
+ * DOM:
+ * DocumentImplementation - feature list
+ */
+if (null == XBSUtil.DOM) {
+	throw ASSERT_EXCEPTION + 'XBSUtil.DOM must be not null.';
+}
+XBSUtil.DOM.HTMLEvent = false;
+
+if (document.implementation) {
+	XBSUtil.DOM.HTMLEvent = document.implementation.hasFeature('HTMLEvents', '2.0');
+}
+
+
+/**
+ * Mac: AppleWebKit
+ * 
+ * Apple ¤Î WebKit framework ¤Î¾å¤Ë¹½ÃÛ¤µ¤ì¤¿¥Ö¥é¥¦¥¶¤Ê¤é
+ * ¤³¤³¤Ç XBSUtil.appleWebKit ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¡£
+ * 
+ * @field major WebKit ¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ * @field minor WebKit ¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ */
+XBSUtil.appleWebKit = null;
+var _webKitMatch = navigator.userAgent.match(/AppleWebKit\/(\d+)\.?(\d+)?/i);
+if (_webKitMatch != null) {
+	var o = new Object();
+	
+	o.major = XBSUtil.parseIntNoError(_webKitMatch[1]);
+	o.minor = XBSUtil.parseIntNoError(_webKitMatch[2]);	
+	XBSUtil.appleWebKit = o;
+}
+
+/**
+ * Mac IE
+ * 
+ * Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
+ */
+/**
+ * Mac: IE
+ * 
+ * IE ¤Î Mac ÈÇ¤Ê¤é
+ * ¤³¤³¤Ç XBSUtil.macIE ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¡£
+ * 
+ * @field major IE ¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ * @field minor IE ¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ */
+//
+// »²¹Í¡§ 
+// Mac ¤Î¿©¤¨¤Ê¤¤ÌîÏº¤É¤â
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+XBSUtil.macIE = null;
+if (navigator.userAgent.match(/Mac/i)) {
+	var _macIEMatch;
+	
+	_macIEMatch = navigator.userAgent.match(/MSIE\s+(\d+)\.?(\d+)?/i);
+	if (_macIEMatch) {
+		var o = new Object();
+
+		o.major = XBSUtil.parseIntNoError(_macIEMatch[1]);
+		o.minor = XBSUtil.parseIntNoError(_macIEMatch[2]);	
+		XBSUtil.macIE = o;
+	}
+}
+/**
+ * Opera
+ *
+ * Opera ¤Ê¤é¤³¤³¤Ç XBSUtil.opera ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¡£
+ * 
+ * @field major opera ¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ * @field minor opera ¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ */
+XBSUtil.opera = null;
+if (window.opera) {
+	var o = new Object();
+	
+	o.major = 6;
+	if (document.documentElement)
+		o.major = 7;
+	
+	o.minor = 0;
+	XBSUtil.opera = o;
+}
+
+
+// ---------------------------------------------------------
+// XBSLayer
+// ---------------------------------------------------------
+/**
+ * div Í×ÁÇ¤Ê¤É¤ò¥ì¥¤¥ä¡¼¤È¤·¤Æ°·¤¦¤¿¤á¤Î¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * For example:
+ * <pre>
+ *    var layer = new XBSLayer(anIdOfDivElement);
+ *    // some operation...
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ * @see     document.layer
+ * @see     style
+ * 
+ * @param     uniqId  div Í×ÁÇ¤Î id Â°À­
+ * @param     doc     document ¥ª¥Ö¥¸¥§¥¯¥È¡Ê¥ª¥×¥·¥ç¥ó¡§¥Ç¥Õ¥©¥ë¥È¤Ïwindow.document¡Ë
+ */
+function XBSLayer(uniqId, doc)
+{
+	if (uniqId) {
+		this.setLayerImp(XBSLayer.getLayerImpById(uniqId, doc));
+	}
+}
+/**
+ * »ØÄê¤µ¤ì¤¿ div Í×ÁÇ¤¬¤Ê¤±¤ì¤ÐÎã³°¤òÅê¤²¤ë
+ * 
+ * ¤É¤¦¤»¡¢¤¿¤¤¤·¤¿¿ô¤Î¥ì¥¤¥ä¡¼¤Ï¤Ê¤¤¤Î¤Ç¥­¥ã¥Ã¥·¥å
+ */
+XBSLayer.makeLayer = function(uniqId, doc)
+{
+	var lyer = null;
+	
+	if (XBSLayer.makeLayer.$cache == null) {
+		XBSLayer.makeLayer.$cache = new Object();
+	}
+	
+	lyer = XBSLayer.makeLayer.$cache[uniqId];
+	if (null == lyer || (doc && doc != XBSUtil.getOwnerDocument(lyer.getLayerImp()))) {
+		lyer = new XBSLayer(uniqId, doc);
+		
+		if (null == lyer || null == lyer.getLayerImp()) {
+			//b throw ASSERT_EXCEPTION + 'div element (id:' + uniqId + ') is required.';
+		}
+		XBSLayer.makeLayer.$cache[uniqId] = lyer;
+	}
+	
+	return lyer;
+}
+
+/* ---- class properties ---- */
+
+// Visibility constants
+/**
+ * ¥ì¥¤¥ä¡¼¤Î²Ä»ëÂ°À­¤òÉ½¤¹Äê¿ô
+ */
+XBSLayer.VISIBLE   = 1;
+XBSLayer.HIDDEN    = 2;
+XBSLayer.INHERIT   = 3;
+XBSLayer.UNDEFINED = 4;
+
+/**
+ * ¥ì¥¤¥ä¡¼¤ÎÁàºî¤Ë»È¤¦¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È¤òÆÀ¤ë
+ *
+ * @param     anId  div Í×ÁÇ¤Î id Â°À­
+ * @param     doc   document ¥ª¥Ö¥¸¥§¥¯¥È¡Ê¥ª¥×¥·¥ç¥ó¡§¥Ç¥Õ¥©¥ë¥È¤Ïwindow.document¡Ë
+ * @return    DOM: element.style, NN: layer
+ */
+XBSLayer.getLayerImpById = function(anId, doc) 
+{
+	var imp = null;
+	
+	if (null == doc) {
+		doc = document;
+	}
+	if (doc.getElementById || doc.all) {
+		imp = doc.getElementById 
+				? doc.getElementById(anId)
+				: doc.all(anId);
+	} else if (doc.layers) {
+		imp = doc.layers[anId];
+	}
+	return imp;
+}
+XBSLayer.getStyleObjectWithLayerImp = function(imp)
+{
+	if (document.getElementById || document.all) {
+		return imp.style;
+	} else {
+		return imp;
+	}
+}
+
+/**
+ * ¿ÆÍ×ÁÇ¤òÆÀ¤ë
+ *
+ * @param     imp  ¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È
+ * @return    ¿ÆÍ×ÁÇ
+ */
+XBSLayer.getParentOfLayerImp = function(imp)
+{
+	var parent = null;
+	
+	if (null == imp) {
+		;
+	} else if (defined(imp.parentElement)) {
+		parent = imp.parentElement;
+	} else if (defined(imp.offsetParent)) {
+		parent = imp.offsetParent;
+	}
+
+	return parent;
+}
+
+
+/**
+ * ¥ì¥¤¥ä¡¼¤ÎÁàºî¤Ë»È¤¦¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È¤Î²Ä»ëÂ°À­¤òÊÖ¤¹¡£
+ *
+ * @param     imp  ¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È
+ * @return    ²Ä»ëÂ°À­¤òÉ½¤¹Äê¿ô
+ * <ul>
+ * <li>XBSLayer.VISIBLE</li>
+ * <li>XBSLayer.HIDDEN</li>
+ * <li>XBSLayer.INHERIT</li>
+ * <li>XBSLayer.UNDEFINED</li>
+ * </ul>
+ */
+XBSLayer.getVisibilityWithLayerImp = function(imp)
+{
+	var v;
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	v = imp.visibility;
+	if (document.all) {
+		if (v == '') return XBSLayer.INHERIT;
+	} else if (!document.getElementById && document.layers) {
+		if (v == 'show') return XBSLayer.VISIBLE;
+		if (v == 'hide') return XBSLayer.HIDDEN;
+	}
+	
+	if (v == 'visible') return XBSLayer.VISIBLE;
+	if (v == 'hidden') return XBSLayer.HIDDEN;
+	if (v == 'inherit') return XBSLayer.INHERIT;
+		
+	return XBSLayer.UNDEFINED;
+}
+XBSLayer.setVisibilityWithLayerImp = function(imp, anEnum)
+{
+	var v = '';
+	
+	if (!document.getElementById && document.layers) {
+		if (anEnum == XBSLayer.VISIBLE) v = 'show';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hide';
+	} else {
+		if (anEnum == XBSLayer.VISIBLE) v = 'visible';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hidden';
+		if (anEnum == XBSLayer.INHERIT) v = 'inherit';
+	}
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	return imp.visibility = v;
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î display Â°À­
+ * 
+ * @return ¥ì¥¤¥ä¡¼¤¬ÎÎ°è¤ò»ý¤Ä¾ì¹ç¤Ï true
+ */
+XBSLayer.isBlockWithLayerImp = function(imp)
+{
+	var b = true;
+	
+	if (imp.style.display != null) {
+		b = (imp.style.display != 'none');
+	}
+	return b;
+}
+XBSLayer.setBlockWithLayerImp = function(imp, b)
+{
+	if (imp.style != null) {
+		imp.style.display = b ? 'block' : 'none';
+	}
+}
+
+// Position & Size
+
+
+// zIndex
+XBSLayer.getZIndexWithLayerImp = function(imp)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	return imp.zIndex;
+}
+XBSLayer.setZIndexWithLayerImp = function(imp, z)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	imp.zIndex = z;
+}
+
+
+// Position
+/**
+ * °ÌÃÖ»ØÄê¤Ë»È¤¦Äê¿ô
+ */
+XBSLayer.LEFT_TOP     = 1;
+XBSLayer.LEFT_BOTTOM  = 2;
+XBSLayer.RIGHT_TOP    = 3;
+XBSLayer.RIGHT_BOTTOM = 4;
+
+/**
+ * ¥æ¡¼¥Æ¥£¥ê¥Æ¥£¡§ »ØÄê¤µ¤ì¤¿¥¤¥Ù¥ó¥È¤Î°ÌÃÖ¤Ë¥ì¥¤¥ä¡¼¤ò°ÜÆ°¡¢É½¼¨
+ * 
+ * @param imp div Í×ÁÇ
+ * @param theEvent ¥¤¥Ù¥ó¥È¥ª¥Ö¥¸¥§¥¯¥È
+ * @param axisType ºÂÉ¸¤ò»ØÄê¤¹¤ë°ÌÃÖ
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ *
+ * @param offsetX ¤³¤Îµ÷Î¥¤À¤±¥¤¥Ù¥ó¥È¤Î°ÌÃÖ¤«¤éÎ¥¤¹ (x ºÂÉ¸)
+ * @param offsetY ¤³¤Îµ÷Î¥¤À¤±¥¤¥Ù¥ó¥È¤Î°ÌÃÖ¤«¤éÎ¥¤¹ (y ºÂÉ¸)
+ * 
+ */
+XBSLayer.popUpWithLayerImpAtEventLocation = function(imp, theEvent, axisType, offsetX, offsetY)
+{
+	var left   = XBSEvent.getMouseX(theEvent) + offsetX;
+	var top    = XBSEvent.getMouseY(theEvent) + offsetY;
+		
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setPositionWIthLayerImp(imp, left, top, axisType);
+	XBSLayer.setVisibilityWithLayerImp(imp, XBSLayer.VISIBLE);
+}
+
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ»ØÄê
+ * 
+ * @param imp div Í×ÁÇ
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ * @param axisType ºÂÉ¸¤ò»ØÄê¤¹¤ë°ÌÃÖ (default: LEFT_TOP)
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.setPositionWIthLayerImp = function(imp, x, y, axisType)
+{
+	var left = x;
+	var top  = y;
+	var w = XBSLayer.getWidthWithLayerImp(imp);
+	var h = XBSLayer.getHeightWithLayerImp(imp);
+	
+	if (XBSLayer.LEFT_BOTTOM == axisType) {
+		top -= h;
+	} else if (XBSLayer.RIGHT_TOP == axisType) {
+		left -= w;
+	} else if (XBSLayer.RIGHT_BOTTOM == axisType) {
+		top -= h;
+		left -= w;
+	}
+	if (left < 0) left = 0;
+	if (top < 0) top = 0;
+	
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top)
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¡Êº¸¾å¡Ë¤ò»ØÄê¡£
+ * 
+ * @param imp div Í×ÁÇ
+ * @param top º¸¾å x ºÂÉ¸
+ * @param left º¸¾å y ºÂÉ¸
+ */
+XBSLayer.setLeftTopPositionWithLayerImp = function(imp, left, top)
+{	
+	if (XBSUtil.DOM == NN4) {
+		imp.moveTo(left, top);
+	}else if (imp.style != null) {	
+		imp.style.left = left; imp.style.top = top;
+	}
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¾ðÊó¤ò½é´ü²½¡£¥Ö¥é¥¦¥¶¤Ë¤è¤Ã¤Æ¤Ï¤³¤Î´Ø¿ô¤ò
+ * Â¾¤Î°ÌÃÖ´Ø·¸´Ø¿ô¤è¤ê¤âÁ°¤Ë¸Æ¤Ð¤Ê¤¤¤È·ë²Ì¤¬ÉÔÄê¤Ë¤Ê¤ë¡£
+ * 
+ * @param imp div
+ */
+XBSLayer.initPositionStyle = function(imp)
+{
+	if (document.layers) {
+		return;
+	} else if (typeof imp.style.left == "string") {
+		imp.style.left = imp.offsetLeft + 'px';
+		imp.style.top  = imp.offsetTop  + 'px';
+	} else if (typeof imp.style.pixelLeft != "undefined") {
+		imp.style.pixelLeft = imp.offsetLeft;
+		imp.style.pixelTop  = imp.offsetTop;
+	}
+}
+
+XBSLayer.getLeftWithLayerImp = function(imp)
+{
+	var x = 0;
+
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		x = imp.offsetLeft;
+	} else if (XBSUtil.DOM == IE4) {
+		x = imp.style.pixelLeft;
+	} else if (XBSUtil.DOM == NN4) {
+		x = imp.clip.left;
+	}
+	return x;
+}
+
+XBSLayer.getTopWithLayerImp = function(imp)
+{
+	var y = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		y = imp.offsetTop;
+	} else if (XBSUtil.DOM == IE4) {
+		y = imp.style.pixelTop;
+	} else if (XBSUtil.DOM == NN4) {
+		y = imp.clip.top;
+	}
+	return y;
+}
+
+// Size
+XBSLayer.getWidthWithLayerImp = function(imp) 
+{
+	var w = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		w = imp.offsetWidth;
+	} else if (XBSUtil.DOM == IE4) {
+		w = imp.style.pixelWidth;
+	} else if (XBSUtil.DOM == NN4) {
+		w = imp.clip.width;
+	}
+	return w;
+}
+XBSLayer.getHeightWithLayerImp = function(imp)
+{
+	var h = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		h = imp.offsetHeight;
+	} else if (XBSUtil.DOM == IE4) {
+		h = imp.style.pixelHeight;
+	} else if (XBSUtil.DOM == NN4) {
+		h = imp.clip.height;
+	}
+	return h;
+}
+XBSLayer.setWidthWithLayerImp = function(imp, w) 
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.width = w;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelWidth = w;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(w, imp.clip.height);
+
+	}
+}
+XBSLayer.setHeightWithLayerImp = function(imp, h)
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = h;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelHeight = h;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(imp.clip.width, h);
+	}
+}
+
+// HTML
+XBSLayer.getInnerHTMLWithLayerImp = function(imp)
+{
+	if (defined(imp.innerHTML)) {
+		return imp.innerHTML;
+	}
+	return '';
+}
+XBSLayer.setInnerHTMLWithLayerImp = function(imp, htmlText)
+{
+	if (defined(imp.innerHTML)) {
+		imp.innerHTML = htmlText;
+	} else if (document.layers != null) {
+		imp.document.open();
+		imp.document.write(htmlText);
+		imp.document.close();
+	}
+}
+
+// Cursor
+XBSLayer.setCursorWithLayerImp = function(imp, aName) 
+{
+	if (imp.style != null && defined(imp.style.cursor)) {
+		imp.style.cursor = aName;
+	}
+}
+
+
+
+/* ---- Instance properties ---- */
+/**
+ * ¿ÆÍ×ÁÇ¤Î XBSLayer ¤òÊÖ¤¹
+ */
+XBSLayer.prototype.getParent = function()
+{
+	var imp = XBSLayer.getParentOfLayerImp(this.getLayerImp());
+	if (null == imp) {
+		return null;
+	}
+	var lyer = new XBSLayer();
+	
+	lyer.setLayerImp(imp);
+	return lyer;
+}
+XBSLayer.prototype.getID = function() { 
+	return this.getLayerImp().id;
+}
+XBSLayer.prototype.hasID = function() {
+	var id = this.getID();
+	
+	return id != null && id != '';
+}
+XBSLayer.prototype.isValid = function() {
+	return (this.getLayerImp() != null);
+}
+// Visibility
+XBSLayer.prototype.getVisibility = function()
+{
+	return XBSLayer.getVisibilityWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setVisibility = function(aEnum)
+{
+	XBSLayer.setVisibilityWithLayerImp(this.getLayerImp(), aEnum);
+}
+
+/**
+ * ¥ì¥¤¥ä¡¼¤¬²Ä»ë¤«¤É¤¦¤«¤òÊÖ¤¹¡£
+ *
+ * @return    boolean
+ */
+XBSLayer.prototype.isVisible  = function()
+{
+	return this.getVisibility() == XBSLayer.HIDDEN ? false : true;
+}
+XBSLayer.prototype.setVisible = function(/* boolean */ flag)
+{
+	this.setVisibility(flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
+XBSLayer.prototype.toggleVisibility = function()
+{
+	this.setVisible(false == this.isVisible())
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î display Â°À­
+ * 
+ * @return ¥ì¥¤¥ä¡¼¤¬ÎÎ°è¤ò»ý¤Ä¾ì¹ç¤Ï true
+ */
+XBSLayer.prototype.isBlock  = function()  
+{ return XBSLayer.isBlockWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setBlock = function(b) 
+{ XBSLayer.setBlockWithLayerImp(this.getLayerImp(), b); }
+
+
+/**
+ * ¥ì¥¤¥ä¡¼¤Î z ºÂÉ¸
+ */
+XBSLayer.prototype.getZIndex = function()
+{
+	return XBSLayer.getZIndexWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setZIndex = function(z)
+{
+	XBSLayer.setZIndexWithLayerImp(this.getLayerImp(), z);
+}
+
+
+XBSLayer.prototype.getStyleObject = function() 
+{
+	return XBSLayer.getStyleObjectWithLayerImp(this.imp);
+}
+XBSLayer.prototype.getLayerImp = function() { return this.imp; }
+XBSLayer.prototype.setLayerImp = function(imp) { this.imp = imp; }
+
+// Position & Size
+XBSLayer.prototype.popUpAtEventLocation = function(theEvent, axisType, offsetX, offsetY)
+{ XBSLayer.popUpWithLayerImpAtEventLocation(this.getLayerImp(), theEvent, axisType, offsetX, offsetY); }
+
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ»ØÄê
+ * 
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ * @param axisType ºÂÉ¸¤ò»ØÄê¤¹¤ë°ÌÃÖ
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.prototype.setPosition = function(x, y, axisType)
+{ XBSLayer.setPositionWIthLayerImp(this.getLayerImp(), x, y, axisType); }
+XBSLayer.prototype.setLeftTopPosition = function(left, top) 
+{ 
+	XBSLayer.setLeftTopPositionWithLayerImp(this.getLayerImp(), left, top); 
+}
+
+XBSLayer.prototype.getX = function() { return XBSLayer.getLeftWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getY = function() { return XBSLayer.getTopWithLayerImp(this.getLayerImp()); }
+/**
+ * ºÂÉ¸¤òÀäÂÐÃÍ¤Ç¼èÆÀ
+ */
+XBSLayer.prototype.getAbsolute_ = function(fnName)
+{
+	var ret = 0;
+	var lyer = this;
+	
+	while (lyer != null && lyer.isValid()) {
+		ret += lyer[fnName]();	
+		lyer = lyer.getParent();
+	}
+	return ret;
+	
+}
+XBSLayer.prototype.getAbsoluteX = function()
+{
+	return this.getAbsolute_("getX");
+}
+XBSLayer.prototype.getAbsoluteY = function()
+{
+	return this.getAbsolute_("getY");
+}
+
+XBSLayer.prototype.getWidth  = function() { return XBSLayer.getWidthWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getHeight = function() { return XBSLayer.getHeightWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setWidth  = function(w) { return XBSLayer.setWidthWithLayerImp(this.getLayerImp(), w); }
+XBSLayer.prototype.setHeight = function(h) { return XBSLayer.setHeightWithLayerImp(this.getLayerImp(), h); }
+
+// HTML
+XBSLayer.prototype.getInnerHTML = function()
+{
+	return XBSLayer.getInnerHTMLWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setInnerHTML= function(htmlText)
+{
+	XBSLayer.setInnerHTMLWithLayerImp(this.getLayerImp(), htmlText);
+}
+
+// Cursor
+XBSLayer.prototype.setCursor = function(aName) { XBSLayer.setCursorWithLayerImp(this.getLayerImp(), aName); }
+
+//---------------------------------------------------------
+// XBSDocument
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * ¥É¥­¥å¥á¥ó¥È¾ðÊó¤Î¼èÆÀ
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSDocument = new Object();
+
+
+/**
+ * ¥É¥­¥å¥á¥ó¥ÈÁ´ÂÎ¤ÎÂç¤­¤µ
+ * 
+ * @return Éý¡¢¹â¤µ
+ */
+XBSDocument.getWidth = function()
+{
+	var w = 0;
+	
+	if (window.innerWidth != null) {
+		w = window.innerWidth;
+	
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ¤¬ÊÖ¤Ã¤Æ¤¯¤ë
+	/*
+	} else if (document.documentElement && document.documentElement.clientWidth != null) {
+		w = document.documentElement.clientWidth;
+	*/
+	} else if (document.body && document.body.clientWidth != null) {
+		w = document.body.clientWidth;
+	} 
+	return w;
+}
+
+XBSDocument.getHeight = function()
+{
+	var h = 0;
+	
+	if (window.innerHeight != null) {
+		h = window.innerHeight;
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ¤¬ÊÖ¤Ã¤Æ¤¯¤ë
+	/*
+	} else if (document.documentElement && document.documentElement.clientHeight != null) {
+		h = document.documentElement.clientHeight;
+	*/
+	} else if (document.body && document.body.clientHeight != null) {
+		h = document.body.clientHeight;
+	} 
+	return h;
+}
+
+/**
+ * ¥É¥­¥å¥á¥ó¥È¤Î²Ä»ëÎÎ°è¤Îº¸¾åºÂÉ¸
+ * 
+ * @return x, y
+ */
+XBSDocument.getPageOffsetX = function()
+{
+	var x = 0;
+	
+	if (document.body && document.body.scrollLeft != null) {
+		x = document.body.scrollLeft;
+	} else if (document.documentElement && document.documentElement.scrollLeft != null) {
+		x = document.documentElement.scrollLeft;
+	} else if (window.scrollX != null) {
+		x = window.scrollX;
+	} else if (window.pageXOffset != null) {
+		x = window.pageXOffset;
+	}
+	
+	return x;
+}
+XBSDocument.getPageOffsetY = function()
+{
+	var y = 0;
+	
+	if (document.body && document.body.scrollTop != null) {
+		y = document.body.scrollTop;
+	} else if (document.documentElement && document.documentElement.scrollTop != null) {
+		y = document.documentElement.scrollTop;
+	} else if (window.scrollY != null) {
+		y = window.scrollY;
+	} else if (window.pageYOffset != null) {
+		y = window.pageYOffset;
+	}
+	
+	return y;
+}
+
+//---------------------------------------------------------
+//XBSEvent
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * ¥¤¥Ù¥ó¥È¥ª¥Ö¥¸¥§¥¯¥È¤ÎÁàºî
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSEvent = new Object();
+
+// *** Key code *** //
+/**
+ * Key code (unicode)
+ * 
+ * @see http://www.unicode.org
+ */
+// 0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;;
+XBSEvent.BACKSPACE_KEY = 0x08;
+// 0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;;
+XBSEvent.TAB_KEY = 0x09;
+// 000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;;
+XBSEvent.LINE_FEED_KEY = 0x0A;
+// 000D;<control>;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;;
+XBSEvent.NEW_LINE_KEY = 0x0D;
+
+
+// Modifier keys
+XBSEvent.ALT_KEY_MASK     = 1;
+XBSEvent.SHIFT_KEY_MASK   = 1 << 1;
+XBSEvent.CONTROL_KEY_MASK = 1 << 2;
+XBSEvent.META_KEY_MASK    = 1 << 3;
+
+/**
+  * getMouseX(e), getMouseY(e)
+  *
+  * ¥Þ¥¦¥¹¤¬¥¤¥Ù¥ó¥È¤òµ¯¤³¤·¤¿»þ¤Ë
+  * XºÂÉ¸¡¢YºÂÉ¸¤òÊÖ¤¹´Ø¿ô
+  * 
+  * @param theEvent ¥Þ¥¦¥¹¥¤¥Ù¥ó¥È
+  * @return ºÂÉ¸
+  */
+XBSEvent.getMouseX = function(theEvent)
+{
+	var x = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// Safari ¤Ï clientX ¤âÀäÂÐºÂÉ¸¤ÇÊÖ¤·¤Æ¤¯¤ë
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageX
+	}
+	
+	if (theEvent.clientX != null) {
+		x = XBSDocument.getPageOffsetX() + theEvent.clientX;
+	} else if (theEvent.pageX != null) {
+		x = theEvent.pageX;
+	} else if (window.opera != null) {  // Ç°¤Î¤¿¤á¡£Æ°ºî³ÎÇ§¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¤³¤Ê¤¤
+		x = (document.documentElement ? window.pageXOffset : 0) + theEvent.clientX;
+	}
+	
+	return x;
+}
+XBSEvent.getMouseY = function(theEvent) {
+	var y = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	
+	// Safari ¤Ï clientY ¤âÀäÂÐºÂÉ¸¤ÇÊÖ¤·¤Æ¤¯¤ë
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageY;
+	}
+	
+	if (theEvent.clientY != null) {
+		y = XBSDocument.getPageOffsetY() + theEvent.clientY;
+	} else if (theEvent.pageY != null) {
+		y = theEvent.pageY;
+	} else if (window.opera != null) {  // Ç°¤Î¤¿¤á¡£Æ°ºî³ÎÇ§¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¤³¤Ê¤¤
+		y = (document.documentElement ? window.pageYOffset : 0) + theEvent.clientY;
+	}
+	
+	return y;
+}
+
+
+/**
+ * Key Event ¤Î Unicode ¥³¡¼¥É¥Ý¥¤¥ó¥È¤òÆÀ¤ë
+ * 
+ * @return code, ¤Ê¤±¤ì¤Ð null
+ */
+XBSEvent.getKeyCode = function(theEvent) 
+{
+	if (theEvent.which != null) {
+		return theEvent.which;
+	} else if (theEvent.keyCode != null) {
+		return theEvent.keyCode;
+	}
+	return null;
+}
+XBSEvent.getTarget = function(theEvent) 
+{
+	if (theEvent.target != null) {
+		return theEvent.target;
+	} else if (theEvent.srcElement != null) {
+		return theEvent.srcElement;
+	}
+	return null;
+}
+
+
+XBSEvent.getModifierFlags = function(theEvent)
+{
+	var flags = 0;
+	
+
+	if (defined(theEvent.ctrlKey)) {
+		if (theEvent.altKey) flags |= XBSEvent.ALT_KEY_MASK;
+		if (theEvent.shiftKey) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (theEvent.ctrlKey) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (theEvent.metaKey) flags |= XBSEvent.META_KEY_MASK;
+	} else if (defined(theEvent.modifiers)) {
+		var m = theEvent.modifiers;
+		
+		if (Event.ALT_MASK & m) flags |= XBSEvent.ALT_KEY_MASK;
+		if (Event.SHIFT_KEY_MASK & m) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (Event.CONTROL_MASK & m) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (Event.META_MASK & m) flags |= XBSEvent.META_KEY_MASK;
+	}
+	return flags;
+}
+
+
+//---------------------------------------------------------------------------------
+// Utilities
+//---------------------------------------------------------------------------------
+UtilKit = new Object();
+
+/**
+ * »ØÄê¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥í¥Ñ¥Æ¥£¤Ë´Ø¿ô¤ò *** ÄÉ²Ã *** ¤¹¤ë¡£
+ * °ÊÁ°¤ËÊÌ¤Î´Ø¿ô¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ì¤Ð¤½¤ì¤ò¸Æ¤Ó½Ð¤·¤Æ¤«¤é¡¢ÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¡£
+ * 
+ * NOTE: ÅÏ¤»¤ë°ú¿ô¤Ï¤È¤ê¤¢¤¨¤º 5 ¤Ä¤Þ¤Ç¤È¤·¤¿¡£¤³¤ì¤À¤±¤¢¤ì¤Ð½½Ê¬¤Ê¤Î¤Ç¡£
+ * 
+ * @param anObject ¥ª¥Ö¥¸¥§¥¯¥È
+ * @param funcName ¥×¥í¥Ñ¥Æ¥£Ì¾
+ * @param func     ´Ø¿ôËÜÂÎ
+ */
+UtilKit.addhook = function(anObject, funcName, func)
+{
+	var prev = anObject[funcName];
+	var fns  = new Array();
+	if (typeof prev == typeof UtilKit.addhook) {
+		fns[fns.length] = prev;
+	}
+	fns[fns.length] = func;
+	
+	// dprint("UtilKit.addhook(" + anObject + ", " + funcName + ") nfunc = " + fns.length);
+	anObject[funcName] = function() {
+		// dprint("funcName: " + funcName + ": " + this);
+		for (var i = 0; i < fns.length; i++) {
+			// dprint(fns[i]);
+			
+			// 2004-04-20  Takanori Ishikawa  
+			// -------------------------------------------------------------------
+			// ´Ø¿ôÆâ¤Ç°ú¿ô¤Î¸Ä¿ô¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¤¤ë²ÄÇ½À­¤â¤¢¤ë¤Î¤Ç¡¢ËÜÅö¤Ï°ú¿ô¸Ä¿ô¤ÇÊ¬´ô¤¹¤Ù¤­¤«¤â
+			// ¤¿¤À¡¢¤½¤Î¾ì¹ç¡¢°ú¿ô¤¬Â­¤ê¤Ê¤¤¾ì¹ç¤Ê¤É¤â¹ÍÎ¸¤¹¤ë¤ÈÌÌÅÝ¤¯¤µ¤¤¤Î¤Ç¼êÈ´¤­
+			 fns[i](
+				arguments[0],
+				arguments[1],
+				arguments[2],
+				arguments[3],
+				arguments[4]);
+			/*
+			var f = fns[i]; var args = arguments;
+			
+			switch (fns.length) {
+			case 0: f(); break;
+			case 1: f(args[0]); break;
+			case 2: f(args[0], args[1]); break;
+			case 3: f(args[0], args[1], args[2]); break;
+			default: ;
+			}
+			*/
+		}
+	};
+}
+
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥í¥Ñ¥Æ¥£¤òÊÖ¤¹¡£
+ * null ¤Î¾ì¹ç¤ÏÎã³°¤òÅê¤²¤ë
+ * 
+ * @param obj  object
+ * @param name property name
+ */
+UtilKit.getPropertyNotNull = function(obj, name)
+{
+	var v = obj[name];
+	
+	if (null == v) {
+		throw ASSERT_EXCEPTION + "object: " + obj + " name: " + name + ' must be nut null.';
+	}
+	
+	return v;	
+}
+
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤òÏÀÍýÃÍ¤ËÊÑ´¹
+ */
+UtilKit.parseBoolean = function(v)
+{
+	if (typeof v == typeof true) {
+		return v;
+	} else if (typeof v == typeof "") {
+		if ('true' == v) 
+			return true;
+		else if ('false' == v) 
+			return false;
+		else
+			return true;
+	} else if (null == v) {
+		return false;
+	} else {
+		return true;
+	}
+}
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥í¥Ñ¥Æ¥£¤«¤é¡¢¤½¤ì¤ÎÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥­¡¼¤ò¸¡º÷
+ * 
+ * @param anObject ¥ª¥Ö¥¸¥§¥¯¥È
+ * @param aValue   ¥×¥í¥Ñ¥Æ¥£ÃÍ
+ */
+UtilKit.getKeyForValue = function(anObject, aValue)
+{
+	for (var key in anObject) {
+		if (aValue == anObject[key]) {
+			return key;
+		}
+	}
+	return null;
+}
+
+UtilKit.getBgColorById = function(anId, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	return UtilKit.normalizeRGBColorRep(style.backgroundColor);
+}
+UtilKit.setBgColorById = function(anId, aColor, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+		
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	style.backgroundColor = aColor;
+}
+
+/**
+ * NN, Opera ¤ÏÇØ·Ê¿§¤ò rgb(r, g, b) ¤È¤¤¤¦·Á¼°¤Ç
+ * ÅÏ¤·¤Æ¤¯¤ë¤Î¤Ç¡¢¤½¤ì¤ò #RGB ¤ËÊÑ´¹
+ */
+UtilKit.normalizeRGBColorRep = function(aColor)
+{
+	var m = aColor.match(/rgb\((\d+),\s*(\d+),\s+(\d+)\)/);
+	
+	if (null == m) {
+		return aColor;
+	}
+	var s = "#";
+	
+	for (var i = 1; i <= 3; i++) {
+		var n = m[i];
+		
+		n = XBSUtil.parseIntNoError(n);
+		n = n.toString(16);
+		if (n.length == 1){
+			n = '0' + n;
+		}
+		s += n;
+	}
+	return s;
+}
+
+/**
+ * InitialFirstResponder:
+ *   ¥æ¡¼¥¶¤¬ºÇ½é¤ËÆþÎÏ¤¹¤Ù¤­¥Õ¥©¡¼¥àÍ×ÁÇ
+ * 
+ * InitialFirstResponder ¤òÀßÄê¤¹¤ë´Ø¿ô¤òÊÖ¤¹¡£
+ * ¤³¤Î´Ø¿ô¤Ï¼Â¹Ô¤µ¤ì¤ë¤È¡¢window.initialFirstResponder ¤Ë¤½¤Î¥Õ¥©¡¼¥àÍ×ÁÇ¤ò³ÊÇ¼¤·¡¢
+ * ¤½¤Î¥Õ¥©¡¼¥àÍ×ÁÇ¤ò focus() ¤¹¤ë¡£
+ * window.onload ¤Ç»È¤ï¤ì¤ë¤³¤È¤òÁÛÄê
+ * 
+ */
+UtilKit.makeInitialFirstResponder = function(formName, elementName)
+{
+	return function() {
+		var frm = document.forms[formName];
+	
+		if (frm == null) return;
+		frm = frm[elementName];
+		if (frm == null) return;
+		
+		window.initialFirstResponder = frm;
+		setTimeout("window.initialFirstResponder.focus()", 500);
+	};
+}
+
+
+//---------------------------------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------------------------------
+/**
+ * 
+ * ¥Ú¡¼¥¸¤ÎÆâÍÆ¤¬ÊÑ¹¹¤µ¤ì¤¿¤«¤É¤¦¤«¤òµ­Ï¿
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/20
+ */
+function ContentsChangedListener(/* Optional */ aName)
+{
+	this.name = aName;
+	if (this.name == null) {
+		this.name = '[undefined listener]';
+	}
+	this.changed = false;
+}
+ContentsChangedListener.prototype.toString = function()
+{ return '[ContentsChangedListener] ' + this.name; }
+
+ContentsChangedListener.prototype.isChanged = function() { return this.changed; }
+ContentsChangedListener.prototype.setChanged = function(b) {
+	if (this.changed != b) {
+		//alert(this + " changed: " + b);
+	}
+	this.changed = b; 
+}
+
+/**
+ * ¥¤¥Ù¥ó¥È¤òÅÐÏ¿¤·¡¢ÅÐÏ¿¤·¤¿¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤¿¤È¤­¤Ë
+ * ÊÑ¹¹¥Õ¥é¥°¤ò true ¤Ë¤¹¤ë¡£
+ * 
+ * ¼ç¤Ë html Í×ÁÇ¤Î onchange ¥¤¥Ù¥ó¥È¤Ê¤É¤òÊáÂª¤·¡¢
+ * ÊÑ¹¹¥Õ¥é¥°¤òÎ©¤Æ¤ë¤Î¤Ë»È¤¦¡£
+ */
+ContentsChangedListener.prototype.listenEvent = function(anObject, eventName)
+{
+//	2004-04-20  Takanori Ishikawa  
+//	------------------------------------------------------------------------
+//	this ¤Ï´Ø¿ôÆâÉô¤Ç¼Â¹Ô»þ¤Ë²ò¼á¤µ¤ì¤ë¤¿¤á¡¢°ìÅÙÊÑ¿ô¤ËÆþ¤ì¤Æ
+//	ÀÅÅª¥¹¥³¡¼¥×¤ËÂ«Çû¤¹¤ëÉ¬Í×¤¬¤¢¤ë¡Ê²òÊü¤µ¤ì¤Ê¤¤¡©¡Ë
+	var me = this
+	var callback = function(){ me.setChanged(true); };
+	
+	UtilKit.addhook(anObject, eventName, callback);
+}
+
+
+//---------------------------------------------------------------------------------
+// Common
+//---------------------------------------------------------------------------------
+/**
+ * ¥¢¥×¥ê¥±¡¼¥·¥ç¥óÁ´ÂÎ¤ÎÀßÄê
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+OEMBlogGlobal = new Object();
+
+/**
+ * µ­»öÊÔ½¸¤Ç Blog ¥Ý¡¼¥¿¥ë¡¦¥«¥Æ¥´¥ê¤ÎÁªÂò¤ò¥¯¥Ã¥­¡¼¤ËÊÝÂ¸¤¹¤ë¤«
+ */
+OEMBlogGlobal.saveTbCategoryToCookie = false;
+
+/**
+ * µ­»öÊÔ½¸¤Ç¥¿¥°ÊÔ½¸µ¡Ç½¡Ê¥¿¥°¤´¤Èºï½ü¡¢°ÜÆ°¤Ê¤É¡Ë¤ò HTML ¥¿¥°¤Ç¤âÍ­¸ú¤Ë¤¹¤ë¤«
+ */
+OEMBlogGlobal.enableTagEditingOnHTML = false;
+
+
+/**
+ * ¹àÌÜÀßÄê¤Î¥Ç¥£¥¹¥¯¥í¡¼¥¸¥ã¥È¥é¥¤¥¢¥ó¥°¥ë¤Ê¤É¤Ç¥¢¥Ë¥á¡¼¥·¥ç¥ó¤òÍ­¸ú¤Ë¤¹¤ë¤«
+ */
+OEMBlogGlobal.enableAnimationFeedback = true;
+
+/**
+ * ²èÁü¤ò¥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Ñ¥¹
+ * jsp Â¦¤ÇÅ¬µ¹¹¹¿·¤µ¤ì¤ë¡£
+ */
+OEMBlogGlobal.uploadImageDirectory = null;
+
+/**
+ * ¥¢¥Ã¥×¥í¡¼¥É¤Ç¤­¤ë²èÁü¥Õ¥¡¥¤¥ëÌ¾¤Î·Á¼°
+ */
+OEMBlogGlobal.IMAGE_FILE_PATTERN = /{(º¸:|±¦:)?([a-zA-Z0-9-_.!~'()]+\.[a-zA-Z]+)}/;
+
+/**
+ * ¥µ¥¤¥É¥Ð¡¼¡§ÇÛÃÖ¤Ç¤­¤ë¹àÌÜ¤ÎºÇÂç¿ô
+ * 
+ * @see sidefunc_order.js BoxConfig.maxNBoxes
+ */
+OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES	= 50;	// ¡Ö»ÈÍÑ¤·¤Ê¤¤µ¡Ç½¡×
+OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES		= 50;	// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×º¸
+OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES	= 50;	// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×±¦
+
+
+/**
+ * 
+ * µ­»öÊÔ½¸¡¢¿·µ¬ºîÀ®¤Ç¤Ï°Ê²¼¤ÎÊ¸»úÎó¤ò´Þ¤à¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤¿¾ì¹ç¡¢
+ * ¤Þ¤ÀÊÑ¹¹¤¬ÊÝÂ¸¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð³ÎÇ§¥À¥¤¥¢¥í¥°¤ò½Ð¤¹¡£
+ * 
+ * @see entry_write_edit.js, entry_save_confirm.jsp
+ * @see OEMBlogGlobal.watchOtherLinks
+ */
+OEMBlogGlobal.DOCUMENT_EDITED_WARNING = "ÊÑ¹¹¤ÏÊÝÂ¸¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>¼¡¤Î¥Ú¡¼¥¸¤Ø°Ü¤Ã¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©"
+OEMBlogGlobal.WATCH_OTHER_LINK_LIST = [
+					/* ¾å */
+					'MyPage',			/* ¥Þ¥¤¥Ú¡¼¥¸ */
+					'EntryWrite',		/* µ­»ö¿·µ¬ºîÀ® */
+					'EntryList',		/* µ­»ö°ìÍ÷ */
+					'TopicList',		/* ¥ê¥ó¥¯¥ê¥¹¥È */
+					'SidefuncOrder',	/* ¥µ¥¤¥É¥Ð¡¼ */
+					'DesignChange',		/* ¥Ç¥¶¥¤¥ó */
+					'BlogSetup',		/* ÀßÄê */
+					
+					/* º¸ */
+					'SidefuncOrder',	/* µ¡Ç½ÁªÂò¡¦ÊÂ¤ÓÂØ¤¨ */
+					'SidefuncSetup',	/* É½¼¨Ì¾ÊÑ¹¹ */
+					'SidefuncEditList',		/* µ¡Ç½ÄÉ²Ã */
+					'LinksList',		/* ¥ê¥ó¥¯½¸  ÊÔ½¸ */
+					'CategoryList'		/* ¥«¥Æ¥´¥ê  ÊÔ½¸ */
+					];
+
+
+/**
+ * ¥Æ¥­¥¹¥È¤ÎÃÖ´¹¤Ê¤É¤Ç»ÈÍÑ¤¹¤ë²þ¹Ô¥³¡¼¥É
+ */
+/** TODO: »ÅÍÍ¤Ë¤·¤¿¤¬¤Ã¤Æ¡¢È½ÊÌ¥³¡¼¥É¤ò½ñ¤¯¤³¤È¡£¤È¤ê¤¢¤¨¤º¡¢CRLF ¤Ë¤·¤Æ¤ª¤¯ */
+OEMBlogGlobal.lineSeparator = "\r\n";
+
+
+OEMBlogGlobal.makeWatchOtherLinkFunction = function(aListener, prevFunc)
+{
+	return function(e) {
+		var ret = true;
+			
+		if (prevFunc != null) {
+			ret = prevFunc(e);
+		}
+		if (aListener.isChanged() == false)
+			return ret;
+			
+		return (htmlConfirm(OEMBlogGlobal.DOCUMENT_EDITED_WARNING))
+	};
+}
+OEMBlogGlobal.watchOtherLinks = function(aDocument, aListener)
+{
+	var linkArray = aDocument.links;
+	var nms = OEMBlogGlobal.WATCH_OTHER_LINK_LIST;
+	var link;
+	var count = 0;
+	
+	for (var i = 0; i < linkArray.length; i++) {
+		
+		link = linkArray[i];
+		if (null == link) continue;
+		
+		for (var j = 0; j < nms.length; j++) {
+			if (link.href.indexOf(nms[j]) != -1) {
+				var prevFunc = link.onclick;
+				
+				if (typeof prevFunc != 'function') {
+					prevFunc = null;
+				}
+				link.onclick = OEMBlogGlobal.makeWatchOtherLinkFunction(aListener, prevFunc);
+				
+				count++;
+				break;
+			}
+		}
+		if (count == nms.length) {
+			break;
+		}
+	}
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/effects.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/effects.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/effects.js	(revision 1328)
@@ -0,0 +1,612 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// Parts (c) 2005 Justin Palmer (http://encytemedia.com/)
+// Parts (c) 2005 Mark Pilgrim (http://diveintomark.org/)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+Effect = {}
+Effect2 = Effect; // deprecated
+
+/* ------------- transitions ------------- */
+
+Effect.Transitions = {}
+
+Effect.Transitions.linear = function(pos) {
+  return pos;
+}
+Effect.Transitions.sinoidal = function(pos) {
+  return (-Math.cos(pos*Math.PI)/2) + 0.5;
+}
+Effect.Transitions.reverse  = function(pos) {
+  return 1-pos;
+}
+Effect.Transitions.flicker = function(pos) {
+  return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random(0.25);
+}
+Effect.Transitions.wobble = function(pos) {
+  return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+}
+Effect.Transitions.pulse = function(pos) {
+  return (Math.floor(pos*10) % 2 == 0 ? 
+    (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
+}
+Effect.Transitions.none = function(pos) {
+  return 0;
+}
+Effect.Transitions.full = function(pos) {
+  return 1;
+}
+
+/* ------------- element ext -------------- */
+
+Element.makePositioned = function(element) {
+  element = $(element);
+  if(element.style.position == "")
+    element.style.position = "relative";
+}
+
+Element.makeClipping = function(element) {
+  element = $(element);
+  element._overflow = element.style.overflow || 'visible';
+  if(element._overflow!='hidden') element.style.overflow = 'hidden';
+}
+
+Element.undoClipping = function(element) {
+  element = $(element);
+  if(element._overflow!='hidden') element.style.overflow = element._overflow;
+}
+
+/* ------------- core effects ------------- */
+
+Effect.Base = function() {};
+Effect.Base.prototype = {
+  setOptions: function(options) {
+    this.options = Object.extend({
+      transition: Effect.Transitions.sinoidal,
+      duration:   1.0,   // seconds
+      fps:        25.0,  // max. 100fps
+      sync:       false, // true for combining
+      from:       0.0,
+      to:         1.0
+    }, options || {});
+  },
+  start: function(options) {
+    this.setOptions(options || {});
+    this.currentFrame = 0;
+    this.startOn      = new Date().getTime();
+    this.finishOn     = this.startOn + (this.options.duration*1000);
+    if(this.options.beforeStart) this.options.beforeStart(this);
+    if(!this.options.sync) this.loop();  
+  },
+  loop: function() {
+    var timePos = new Date().getTime();
+    if(timePos >= this.finishOn) {
+      this.render(this.options.to);
+      if(this.finish) this.finish(); 
+      if(this.options.afterFinish) this.options.afterFinish(this);
+      return;  
+    }
+    var pos   = (timePos - this.startOn) / (this.finishOn - this.startOn);
+    var frame = Math.round(pos * this.options.fps * this.options.duration);
+    if(frame > this.currentFrame) {
+      this.render(pos);
+      this.currentFrame = frame;
+    }
+    this.timeout = setTimeout(this.loop.bind(this), 10);
+  },
+  render: function(pos) {
+    if(this.options.transition) pos = this.options.transition(pos);
+    pos *= (this.options.to-this.options.from);
+    pos += this.options.from; 
+    if(this.options.beforeUpdate) this.options.beforeUpdate(this);
+    if(this.update) this.update(pos);
+    if(this.options.afterUpdate) this.options.afterUpdate(this);  
+  },
+  cancel: function() {
+    if(this.timeout) clearTimeout(this.timeout);
+  }
+}
+
+Effect.Parallel = Class.create();
+Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
+  initialize: function(effects) {
+    this.effects = effects || [];
+    this.start(arguments[1]);
+  },
+  update: function(position) {
+    for (var i = 0; i < this.effects.length; i++)
+      this.effects[i].render(position);  
+  },
+  finish: function(position) {
+    for (var i = 0; i < this.effects.length; i++)
+      if(this.effects[i].finish) this.effects[i].finish(position);
+  }
+});
+
+// Internet Explorer caveat: works only on elements the have
+// a 'layout', meaning having a given width or height. 
+// There is no way to safely set this automatically.
+Effect.Opacity = Class.create();
+Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
+  initialize: function(element) {
+    this.element = $(element);
+    options = Object.extend({
+      from: 0.0,
+      to:   1.0
+    }, arguments[1] || {});
+    this.start(options);
+  },
+  update: function(position) {
+    this.setOpacity(position);
+  }, 
+  setOpacity: function(opacity) {
+    opacity = (opacity == 1) ? 0.99999 : opacity;
+    this.element.style.opacity = opacity;
+    this.element.style.filter = "alpha(opacity:"+opacity*100+")";
+  }
+});
+
+Effect.MoveBy = Class.create();
+Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
+  initialize: function(element, toTop, toLeft) {
+    this.element      = $(element);
+    this.originalTop  = parseFloat(this.element.style.top || '0');
+    this.originalLeft = parseFloat(this.element.style.left || '0');
+    this.toTop        = toTop;
+    this.toLeft       = toLeft;
+    Element.makePositioned(this.element);
+    this.start(arguments[3]);
+  },
+  update: function(position) {
+    topd  = this.toTop  * position + this.originalTop;
+    leftd = this.toLeft * position + this.originalLeft;
+    this.setPosition(topd, leftd);
+  },
+  setPosition: function(topd, leftd) {
+    this.element.style.top  = topd  + "px";
+    this.element.style.left = leftd + "px";
+  }
+});
+
+Effect.Scale = Class.create();
+Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
+  initialize: function(element, percent) {
+    this.element = $(element)
+    options = Object.extend({
+      scaleX: true,
+      scaleY: true,
+      scaleContent: true,
+      scaleFromCenter: false,
+      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
+      scaleFrom: 100.0
+    }, arguments[2] || {});
+    this.originalTop    = this.element.offsetTop;
+    this.originalLeft   = this.element.offsetLeft;
+    if(this.element.style.fontSize=="") this.sizeEm = 1.0;
+    if(this.element.style.fontSize && this.element.style.fontSize.indexOf("em")>0)
+      this.sizeEm      = parseFloat(this.element.style.fontSize);
+    this.factor = (percent/100.0) - (options.scaleFrom/100.0);
+    if(options.scaleMode=='box') {
+      this.originalHeight = this.element.clientHeight;
+      this.originalWidth  = this.element.clientWidth; 
+    } else 
+    if(options.scaleMode=='contents') {
+      this.originalHeight = this.element.scrollHeight;
+      this.originalWidth  = this.element.scrollWidth;
+    } else {
+      this.originalHeight = options.scaleMode.originalHeight;
+      this.originalWidth  = options.scaleMode.originalWidth;
+    }
+    this.start(options);
+  },
+
+  update: function(position) {
+    currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+    if(this.options.scaleContent && this.sizeEm) 
+      this.element.style.fontSize = this.sizeEm*currentScale + "em";
+    this.setDimensions(
+      this.originalWidth * currentScale, 
+      this.originalHeight * currentScale);
+  },
+
+  setDimensions: function(width, height) {
+    if(this.options.scaleX) this.element.style.width = width + 'px';
+    if(this.options.scaleY) this.element.style.height = height + 'px';
+    if(this.options.scaleFromCenter) {
+      topd  = (height - this.originalHeight)/2;
+      leftd = (width  - this.originalWidth)/2;
+      if(this.element.style.position=='absolute') {
+        if(this.options.scaleY) this.element.style.top = this.originalTop-topd + "px";
+        if(this.options.scaleX) this.element.style.left = this.originalLeft-leftd + "px";
+      } else {
+        if(this.options.scaleY) this.element.style.top = -topd + "px";
+        if(this.options.scaleX) this.element.style.left = -leftd + "px";
+      }
+    }
+  }
+});
+
+Effect.Highlight = Class.create();
+Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
+  initialize: function(element) {
+    this.element = $(element);
+    
+    // try to parse current background color as default for endcolor
+    // browser stores this as: "rgb(255, 255, 255)", convert to "#ffffff" format
+    var endcolor = "#ffffff";
+    var current = this.element.style.backgroundColor;
+    if(current && current.slice(0,4) == "rgb(") {
+      endcolor = "#";
+      var cols = current.slice(4,current.length-1).split(',');
+      var i=0; do { endcolor += parseInt(cols[i]).toColorPart() } while (++i<3); }
+      
+    var options = Object.extend({
+      startcolor:   "#ffff99",
+      endcolor:     endcolor,
+      restorecolor: current 
+    }, arguments[1] || {});
+    
+    // init color calculations
+    this.colors_base = [
+      parseInt(options.startcolor.slice(1,3),16),
+      parseInt(options.startcolor.slice(3,5),16),
+      parseInt(options.startcolor.slice(5),16) ];
+    this.colors_delta = [
+      parseInt(options.endcolor.slice(1,3),16)-this.colors_base[0],
+      parseInt(options.endcolor.slice(3,5),16)-this.colors_base[1],
+      parseInt(options.endcolor.slice(5),16)-this.colors_base[2] ];
+
+    this.start(options);
+  },
+  update: function(position) {
+    var colors = [
+      Math.round(this.colors_base[0]+(this.colors_delta[0]*position)),
+      Math.round(this.colors_base[1]+(this.colors_delta[1]*position)),
+      Math.round(this.colors_base[2]+(this.colors_delta[2]*position)) ];
+    this.element.style.backgroundColor = "#" +
+      colors[0].toColorPart() + colors[1].toColorPart() + colors[2].toColorPart();
+  },
+  finish: function() {
+    this.element.style.backgroundColor = this.options.restorecolor;
+  }
+});
+
+Effect.ScrollTo = Class.create();
+Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
+  initialize: function(element) {
+    this.element = $(element);
+    Position.prepare();
+    var offsets = Position.cumulativeOffset(this.element);
+    var max = window.innerHeight ? 
+      window.height - window.innerHeight :
+      document.body.scrollHeight - 
+        (document.documentElement.clientHeight ? 
+          document.documentElement.clientHeight : document.body.clientHeight);
+    this.scrollStart = Position.deltaY;
+    this.delta  = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
+    this.start(arguments[1] || {});
+  },
+  update: function(position) {
+    Position.prepare();
+    window.scrollTo(Position.deltaX, 
+      this.scrollStart + (position*this.delta));
+  }
+});
+
+/* ------------- prepackaged effects ------------- */
+
+Effect.Fade = function(element) {
+  options = Object.extend({
+  from: 1.0,
+  to:   0.0,
+  afterFinish: function(effect) 
+    { Element.hide(effect.element);
+      effect.setOpacity(1); } 
+  }, arguments[1] || {});
+  new Effect.Opacity(element,options);
+}
+
+Effect.Appear = function(element) {
+  options = Object.extend({
+  from: 0.0,
+  to:   1.0,
+  beforeStart: function(effect)  
+    { effect.setOpacity(0);
+      Element.show(effect.element); },
+  afterUpdate: function(effect)  
+    { Element.show(effect.element); }
+  }, arguments[1] || {});
+  new Effect.Opacity(element,options);
+}
+
+Effect.Puff = function(element) {
+  new Effect.Parallel(
+   [ new Effect.Scale(element, 200, { sync: true, scaleFromCenter: true }), 
+     new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], 
+     { duration: 1.0, 
+      afterUpdate: function(effect) 
+       { effect.effects[0].element.style.position = 'absolute'; },
+      afterFinish: function(effect)
+       { Element.hide(effect.effects[0].element); }
+     }
+   );
+}
+
+Effect.BlindUp = function(element) {
+  Element.makeClipping(element);
+  new Effect.Scale(element, 0, 
+    Object.extend({ scaleContent: false, 
+      scaleX: false, 
+      afterFinish: function(effect) 
+        { 
+          Element.hide(effect.element);
+          Element.undoClipping(effect.element);
+        } 
+    }, arguments[1] || {})
+  );
+}
+
+Effect.BlindDown = function(element) {
+  $(element).style.height   = '0px';
+  Element.makeClipping(element);
+  Element.show(element);
+  new Effect.Scale(element, 100, 
+    Object.extend({ scaleContent: false, 
+      scaleX: false, 
+      scaleMode: 'contents',
+      scaleFrom: 0,
+      afterFinish: function(effect) {
+        Element.undoClipping(effect.element);
+      }
+    }, arguments[1] || {})
+  );
+}
+
+Effect.SwitchOff = function(element) {
+  new Effect.Appear(element,
+    { duration: 0.4,
+     transition: Effect.Transitions.flicker,
+     afterFinish: function(effect)
+      { effect.element.style.overflow = 'hidden';
+        new Effect.Scale(effect.element, 1, 
+         { duration: 0.3, scaleFromCenter: true,
+          scaleX: false, scaleContent: false,
+          afterUpdate: function(effect) { 
+           if(effect.element.style.position=="")
+             effect.element.style.position = 'relative'; },
+          afterFinish: function(effect) { Element.hide(effect.element); }
+         } )
+      }
+    } );
+}
+
+Effect.DropOut = function(element) {
+  new Effect.Parallel(
+    [ new Effect.MoveBy(element, 100, 0, { sync: true }), 
+      new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], 
+    { duration: 0.5, 
+     afterFinish: function(effect)
+       { Element.hide(effect.effects[0].element); } 
+    });
+}
+
+Effect.Shake = function(element) {
+  new Effect.MoveBy(element, 0, 20, 
+    { duration: 0.05, afterFinish: function(effect) {
+  new Effect.MoveBy(effect.element, 0, -40, 
+    { duration: 0.1, afterFinish: function(effect) { 
+  new Effect.MoveBy(effect.element, 0, 40, 
+    { duration: 0.1, afterFinish: function(effect) {  
+  new Effect.MoveBy(effect.element, 0, -40, 
+    { duration: 0.1, afterFinish: function(effect) {  
+  new Effect.MoveBy(effect.element, 0, 40, 
+    { duration: 0.1, afterFinish: function(effect) {  
+  new Effect.MoveBy(effect.element, 0, -20, 
+    { duration: 0.05, afterFinish: function(effect) {  
+  }}) }}) }}) }}) }}) }});
+}
+
+Effect.SlideDown = function(element) {
+  element = $(element);
+  element.style.height   = '0px';
+  Element.makeClipping(element);
+  Element.cleanWhitespace(element);
+  Element.makePositioned(element.firstChild);
+  Element.show(element);
+  new Effect.Scale(element, 100, 
+   Object.extend({ scaleContent: false, 
+    scaleX: false, 
+    scaleMode: 'contents',
+    scaleFrom: 0,
+    afterUpdate: function(effect) 
+      { effect.element.firstChild.style.bottom = 
+          (effect.originalHeight - effect.element.clientHeight) + 'px'; },
+    afterFinish: function(effect) 
+      {  Element.undoClipping(effect.element); }
+    }, arguments[1] || {})
+  );
+}
+  
+Effect.SlideUp = function(element) {
+  element = $(element);
+  Element.makeClipping(element);
+  Element.cleanWhitespace(element);
+  Element.makePositioned(element.firstChild);
+  Element.show(element);
+  new Effect.Scale(element, 0, 
+   Object.extend({ scaleContent: false, 
+    scaleX: false, 
+    afterUpdate: function(effect) 
+      { effect.element.firstChild.style.bottom = 
+          (effect.originalHeight - effect.element.clientHeight) + 'px'; },
+    afterFinish: function(effect)
+      { 
+        Element.hide(effect.element);
+        Element.undoClipping(effect.element);
+      }
+   }, arguments[1] || {})
+  );
+}
+
+Effect.Squish = function(element) {
+ new Effect.Scale(element, 0, 
+   { afterFinish: function(effect) { Element.hide(effect.element); } });
+}
+
+Effect.Grow = function(element) {
+  element = $(element);
+  var options = arguments[1] || {};
+  
+  var originalWidth = element.clientWidth;
+  var originalHeight = element.clientHeight;
+  element.style.overflow = 'hidden';
+  Element.show(element);
+  
+  var direction = options.direction || 'center';
+  var moveTransition = options.moveTransition || Effect.Transitions.sinoidal;
+  var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal;
+  var opacityTransition = options.opacityTransition || Effect.Transitions.full;
+  
+  var initialMoveX, initialMoveY;
+  var moveX, moveY;
+  
+  switch (direction) {
+    case 'top-left':
+      initialMoveX = initialMoveY = moveX = moveY = 0; 
+      break;
+    case 'top-right':
+      initialMoveX = originalWidth;
+      initialMoveY = moveY = 0;
+      moveX = -originalWidth;
+      break;
+    case 'bottom-left':
+      initialMoveX = moveX = 0;
+      initialMoveY = originalHeight;
+      moveY = -originalHeight;
+      break;
+    case 'bottom-right':
+      initialMoveX = originalWidth;
+      initialMoveY = originalHeight;
+      moveX = -originalWidth;
+      moveY = -originalHeight;
+      break;
+    case 'center':
+      initialMoveX = originalWidth / 2;
+      initialMoveY = originalHeight / 2;
+      moveX = -originalWidth / 2;
+      moveY = -originalHeight / 2;
+      break;
+  }
+  
+  new Effect.MoveBy(element, initialMoveY, initialMoveX, { 
+    duration: 0.01, 
+    beforeUpdate: function(effect) { $(element).style.height = '0px'; },
+    afterFinish: function(effect) {
+      new Effect.Parallel(
+        [ new Effect.Opacity(element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }),
+          new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition }),
+          new Effect.Scale(element, 100, { 
+            scaleMode: { originalHeight: originalHeight, originalWidth: originalWidth }, 
+            sync: true, scaleFrom: 0, scaleTo: 100, transition: scaleTransition })],
+        options); }
+    });
+}
+
+Effect.Shrink = function(element) {
+  element = $(element);
+  var options = arguments[1] || {};
+  
+  var originalWidth = element.clientWidth;
+  var originalHeight = element.clientHeight;
+  element.style.overflow = 'hidden';
+  Element.show(element);
+
+  var direction = options.direction || 'center';
+  var moveTransition = options.moveTransition || Effect.Transitions.sinoidal;
+  var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal;
+  var opacityTransition = options.opacityTransition || Effect.Transitions.none;
+  
+  var moveX, moveY;
+  
+  switch (direction) {
+    case 'top-left':
+      moveX = moveY = 0;
+      break;
+    case 'top-right':
+      moveX = originalWidth;
+      moveY = 0;
+      break;
+    case 'bottom-left':
+      moveX = 0;
+      moveY = originalHeight;
+      break;
+    case 'bottom-right':
+      moveX = originalWidth;
+      moveY = originalHeight;
+      break;
+    case 'center':  
+      moveX = originalWidth / 2;
+      moveY = originalHeight / 2;
+      break;
+  }
+  
+  new Effect.Parallel(
+    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }),
+      new Effect.Scale(element, 0, { sync: true, transition: moveTransition }),
+      new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: scaleTransition }) ],
+    options);
+}
+
+Effect.Pulsate = function(element) {
+  var options    = arguments[1] || {};
+  var transition = options.transition || Effect.Transitions.sinoidal;
+  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
+  reverser.bind(transition);
+  new Effect.Opacity(element, 
+    Object.extend(Object.extend({  duration: 3.0,
+       afterFinish: function(effect) { Element.show(effect.element); }
+    }, options), {transition: reverser}));
+}
+
+Effect.Fold = function(element) {
+ $(element).style.overflow = 'hidden';
+ new Effect.Scale(element, 5, Object.extend({   
+   scaleContent: false,
+   scaleTo: 100,
+   scaleX: false,
+   afterFinish: function(effect) {
+   new Effect.Scale(element, 1, { 
+     scaleContent: false, 
+     scaleTo: 0,
+     scaleY: false,
+     afterFinish: function(effect) { Element.hide(effect.element) } });
+ }}, arguments[1] || {}));
+}
+
+// old: new Effect.ContentZoom(element, percent)
+// new: Element.setContentZoom(element, percent) 
+
+Element.setContentZoom = function(element, percent) {
+  var element = $(element);
+  element.style.fontSize = (percent/100) + "em";  
+  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/dragdrop.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/dragdrop.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/dragdrop.js	(revision 1328)
@@ -0,0 +1,537 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// 
+// Element.Class part Copyright (c) 2005 by Rick Olson
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Element.Class = {
+    // Element.toggleClass(element, className) toggles the class being on/off
+    // Element.toggleClass(element, className1, className2) toggles between both classes,
+    //   defaulting to className1 if neither exist
+    toggle: function(element, className) {
+      if(Element.Class.has(element, className)) {
+        Element.Class.remove(element, className);
+        if(arguments.length == 3) Element.Class.add(element, arguments[2]);
+      } else {
+        Element.Class.add(element, className);
+        if(arguments.length == 3) Element.Class.remove(element, arguments[2]);
+      }
+    },
+
+    // gets space-delimited classnames of an element as an array
+    get: function(element) {
+      element = $(element);
+      return element.className.split(' ');
+    },
+
+    // functions adapted from original functions by Gavin Kistner
+    remove: function(element) {
+      element = $(element);
+      var regEx;
+      for(var i = 1; i < arguments.length; i++) {
+        regEx = new RegExp("^" + arguments[i] + "\\b\\s*|\\s*\\b" + arguments[i] + "\\b", 'g');
+        element.className = element.className.replace(regEx, '')
+      }
+    },
+
+    add: function(element) {
+      element = $(element);
+      for(var i = 1; i < arguments.length; i++) {
+        Element.Class.remove(element, arguments[i]);
+        element.className += (element.className.length > 0 ? ' ' : '') + arguments[i];
+      }
+    },
+
+    // returns true if all given classes exist in said element
+    has: function(element) {
+      element = $(element);
+      if(!element || !element.className) return false;
+      var regEx;
+      for(var i = 1; i < arguments.length; i++) {
+        regEx = new RegExp("\\b" + arguments[i] + "\\b");
+        if(!regEx.test(element.className)) return false;
+      }
+      return true;
+    },
+    
+    // expects arrays of strings and/or strings as optional paramters
+    // Element.Class.has_any(element, ['classA','classB','classC'], 'classD')
+    has_any: function(element) {
+      element = $(element);
+      if(!element || !element.className) return false;
+      var regEx;
+      for(var i = 1; i < arguments.length; i++) {
+        if((typeof arguments[i] == 'object') && 
+          (arguments[i].constructor == Array)) {
+          for(var j = 0; j < arguments[i].length; j++) {
+            regEx = new RegExp("\\b" + arguments[i][j] + "\\b");
+            if(regEx.test(element.className)) return true;
+          }
+        } else {
+          regEx = new RegExp("\\b" + arguments[i] + "\\b");
+          if(regEx.test(element.className)) return true;
+        }
+      }
+      return false;
+    },
+    
+    childrenWith: function(element, className) {
+      var children = $(element).getElementsByTagName('*');
+      var elements = new Array();
+      
+      for (var i = 0; i < children.length; i++) {
+        if (Element.Class.has(children[i], className)) {
+          elements.push(children[i]);
+          break;
+        }
+      }
+      
+      return elements;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Droppables = {
+  drops: false,
+  
+  remove: function(element) {
+    for(var i = 0; i < this.drops.length; i++)
+      if(this.drops[i].element == element)
+        this.drops.splice(i,1);
+  },
+  
+  add: function(element) {
+    var element = $(element);
+    var options = Object.extend({
+      greedy:     true,
+      hoverclass: null  
+    }, arguments[1] || {});
+    
+    // cache containers
+    if(options.containment) {
+      options._containers = new Array();
+      var containment = options.containment;
+      if((typeof containment == 'object') && 
+        (containment.constructor == Array)) {
+        for(var i=0; i<containment.length; i++)
+          options._containers.push($(containment[i]));
+      } else {
+        options._containers.push($(containment));
+      }
+      options._containers_length = 
+        options._containers.length-1;
+    }
+    
+    Element.makePositioned(element); // fix IE
+    
+    options.element = element;
+    
+    // activate the droppable    
+    if(!this.drops) this.drops = [];
+    this.drops.push(options);
+  },
+  
+  is_contained: function(element, drop) {
+    var containers = drop._containers;
+    var parentNode = element.parentNode;
+    var i = drop._containers_length;
+    do { if(parentNode==containers[i]) return true; } while (i--);
+    return false;
+  },
+  
+  is_affected: function(pX, pY, element, drop) {
+    return (
+      (drop.element!=element) &&
+      ((!drop._containers) ||
+        this.is_contained(element, drop)) &&
+      ((!drop.accept) ||
+        (Element.Class.has_any(element, drop.accept))) &&
+      Position.within(drop.element, pX, pY) );
+  },
+  
+  deactivate: function(drop) {
+    Element.Class.remove(drop.element, drop.hoverclass);
+    this.last_active = null;
+  },
+  
+  activate: function(drop) {
+    if(this.last_active) this.deactivate(this.last_active);
+    if(drop.hoverclass) {
+      Element.Class.add(drop.element, drop.hoverclass);
+      this.last_active = drop;
+    }
+  },
+  
+  show: function(event, element) {
+    if(!this.drops) return;
+    var pX = Event.pointerX(event);
+    var pY = Event.pointerY(event);
+    Position.prepare();
+    
+    var i = this.drops.length-1; do {
+      var drop = this.drops[i];
+      if(this.is_affected(pX, pY, element, drop)) {
+        if(drop.onHover)
+           drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
+        if(drop.greedy) { 
+          this.activate(drop);
+          return;
+        }
+      }
+    } while (i--);
+  },
+  
+  fire: function(event, element) {
+    if(!this.last_active) return;
+    Position.prepare();
+    
+    if (this.is_affected(Event.pointerX(event), Event.pointerY(event), element, this.last_active))
+      if (this.last_active.onDrop) 
+        this.last_active.onDrop(element, this.last_active);
+    
+  },
+  
+  reset: function() {
+    if(this.last_active)
+      this.deactivate(this.last_active);
+  }
+}
+
+Draggables = {
+  observers: new Array(),
+  addObserver: function(observer) {
+    this.observers.push(observer);    
+  },
+  removeObserver: function(element) {  // element instead of obsever fixes mem leaks
+    for(var i = 0; i < this.observers.length; i++)
+      if(this.observers[i].element && (this.observers[i].element == element))
+        this.observers.splice(i,1);
+  },
+  notify: function(eventName, draggable) {  // 'onStart', 'onEnd'
+    for(var i = 0; i < this.observers.length; i++)
+      this.observers[i][eventName](draggable);
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Draggable = Class.create();
+Draggable.prototype = {
+  initialize: function(element) {
+    var options = Object.extend({
+      handle: false,
+      starteffect: function(element) { 
+        new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); 
+      },
+      reverteffect: function(element, top_offset, left_offset) {
+        new Effect.MoveBy(element, -top_offset, -left_offset, {duration:0.4});
+      },
+      endeffect: function(element) { 
+         new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0}); 
+      },
+      zindex: 1000,
+      revert: false
+    }, arguments[1] || {});
+    
+    this.element      = $(element);
+    this.handle       = options.handle ? $(options.handle) : this.element;
+    
+    Element.makePositioned(this.element); // fix IE
+    
+    this.offsetX      = 0;
+    this.offsetY      = 0;
+    this.originalLeft = this.currentLeft();
+    this.originalTop  = this.currentTop();
+    this.originalX    = this.element.offsetLeft;
+    this.originalY    = this.element.offsetTop;
+    this.originalZ    = parseInt(this.element.style.zIndex || "0");
+    
+    this.options      = options;
+    
+    this.active       = false;
+    this.dragging     = false;   
+    
+    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
+    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
+    this.eventMouseMove = this.update.bindAsEventListener(this);
+    this.eventKeypress  = this.keyPress.bindAsEventListener(this);
+    
+    Event.observe(this.handle, "mousedown", this.eventMouseDown);
+    Event.observe(document, "mouseup", this.eventMouseUp);
+    Event.observe(document, "mousemove", this.eventMouseMove);
+    Event.observe(document, "keypress", this.eventKeypress);
+  },
+  destroy: function() {
+    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
+    Event.stopObserving(document, "mouseup", this.eventMouseUp);
+    Event.stopObserving(document, "mousemove", this.eventMouseMove);
+    Event.stopObserving(document, "keypress", this.eventKeypress);
+  },
+  currentLeft: function() {
+    return parseInt(this.element.style.left || '0');
+  },
+  currentTop: function() {
+    return parseInt(this.element.style.top || '0')
+  },
+  startDrag: function(event) {
+    if(Event.isLeftClick(event)) {
+      this.active = true;
+      
+      var style = this.element.style;
+      this.originalY = this.element.offsetTop  - this.currentTop()  - this.originalTop;
+      this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft;
+      this.offsetY =  event.clientY - this.originalY - this.originalTop;
+      this.offsetX =  event.clientX - this.originalX - this.originalLeft;
+      
+      Event.stop(event);
+    }
+  },
+  finishDrag: function(event, success) {
+    this.active = false;
+    this.dragging = false;
+    
+    if(success) Droppables.fire(event, this.element);
+    Draggables.notify('onEnd', this);
+    
+    var revert = this.options.revert;
+    if(revert && typeof revert == 'function') revert = revert(this.element);
+      
+    if(revert && this.options.reverteffect) {
+      this.options.reverteffect(this.element, 
+      this.currentTop()-this.originalTop,
+      this.currentLeft()-this.originalLeft);
+    } else {
+      this.originalLeft = this.currentLeft();
+      this.originalTop  = this.currentTop();
+    }
+    
+    this.element.style.zIndex = this.originalZ;
+      
+    if(this.options.endeffect) 
+      this.options.endeffect(this.element);
+      
+    Droppables.reset();
+  },
+  keyPress: function(event) {
+    if(this.active) {
+      if(event.keyCode==Event.KEY_ESC) {
+        this.finishDrag(event, false);
+        Event.stop(event);
+      }
+    }
+  },
+  endDrag: function(event) {
+    if(this.active && this.dragging) {
+      this.finishDrag(event, true);
+      Event.stop(event);
+    }
+    this.active = false;
+    this.dragging = false;
+  },
+  draw: function(event) {
+    var style = this.element.style;
+    this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft;
+    this.originalY = this.element.offsetTop  - this.currentTop()  - this.originalTop;
+    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
+      style.left = ((event.clientX - this.originalX) - this.offsetX) + "px";
+    if((!this.options.constraint) || (this.options.constraint=='vertical'))
+      style.top  = ((event.clientY - this.originalY) - this.offsetY) + "px";
+    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
+  },
+  update: function(event) {
+   if(this.active) {
+      if(!this.dragging) {
+        var style = this.element.style;
+        this.dragging = true;
+        if(style.position=="") style.position = "relative";
+        style.zIndex = this.options.zindex;
+        Draggables.notify('onStart', this);
+        if(this.options.starteffect) this.options.starteffect(this.element);
+      }
+      
+      Droppables.show(event, this.element);
+      this.draw(event);
+      if(this.options.change) this.options.change(this);
+      
+      // fix AppleWebKit rendering
+      if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); 
+      
+      Event.stop(event);
+   }
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SortableObserver = Class.create();
+SortableObserver.prototype = {
+  initialize: function(element, observer) {
+    this.element   = $(element);
+    this.observer  = observer;
+    this.lastValue = Sortable.serialize(this.element);
+  },
+  onStart: function() {
+    this.lastValue = Sortable.serialize(this.element);
+  },
+  onEnd: function() {    
+    if(this.lastValue != Sortable.serialize(this.element))
+      this.observer(this.element)
+  }
+}
+
+Sortable = {
+  sortables: new Array(),
+  options: function(element){
+    var element = $(element);
+    for(var i=0;i<this.sortables.length;i++)
+      if(this.sortables[i].element == element)
+        return this.sortables[i];
+    return null;        
+  },
+  destroy: function(element){
+    var element = $(element);
+    for(var i=0;i<this.sortables.length;i++) {
+      if(this.sortables[i].element == element) {
+        var s = this.sortables[i];
+        Draggables.removeObserver(s.element);
+        for(var j=0;j<s.droppables.length;j++)
+          Droppables.remove(s.droppables[j]);
+        for(var j=0;j<s.draggables.length;j++)
+          s.draggables[j].destroy();
+        this.sortables.splice(i,1);
+      }
+    }
+  },
+  create: function(element) {
+    var element = $(element);
+    var options = Object.extend({ 
+      element:     element,
+      tag:         'li',       // assumes li children, override with tag: 'tagname'
+      overlap:     'vertical', // one of 'vertical', 'horizontal'
+      constraint:  'vertical', // one of 'vertical', 'horizontal', false
+      containment: element,    // also takes array of elements (or id's); or false
+      handle:      false,      // or a CSS class
+      only:        false,
+      hoverclass:  null,
+      onChange:    function() {},
+      onUpdate:    function() {}
+    }, arguments[1] || {});
+    
+    // clear any old sortable with same element
+    this.destroy(element);
+    
+    // build options for the draggables
+    var options_for_draggable = {
+      revert:      true,
+      constraint:  options.constraint,
+      handle:      handle };
+    if(options.starteffect)
+      options_for_draggable.starteffect = options.starteffect;
+    if(options.reverteffect)
+      options_for_draggable.reverteffect = options.reverteffect;
+    if(options.endeffect)
+      options_for_draggable.endeffect = options.endeffect;
+    if(options.zindex)
+      options_for_draggable.zindex = options.zindex;
+    
+    // build options for the droppables  
+    var options_for_droppable = {
+      overlap:     options.overlap,
+      containment: options.containment,
+      hoverclass:  options.hoverclass,
+      onHover: function(element, dropon, overlap) { 
+        if(overlap>0.5) {
+          if(dropon.previousSibling != element) {
+            var oldParentNode = element.parentNode;
+            element.style.visibility = "hidden"; // fix gecko rendering
+            dropon.parentNode.insertBefore(element, dropon);
+            if(dropon.parentNode!=oldParentNode && oldParentNode.sortable) 
+              oldParentNode.sortable.onChange(element);
+            if(dropon.parentNode.sortable)
+              dropon.parentNode.sortable.onChange(element);
+          }
+        } else {                
+          var nextElement = dropon.nextSibling || null;
+          if(nextElement != element) {
+            var oldParentNode = element.parentNode;
+            element.style.visibility = "hidden"; // fix gecko rendering
+            dropon.parentNode.insertBefore(element, nextElement);
+            if(dropon.parentNode!=oldParentNode && oldParentNode.sortable) 
+              oldParentNode.sortable.onChange(element);
+            if(dropon.parentNode.sortable)
+              dropon.parentNode.sortable.onChange(element);
+          }
+        }
+      }
+    }
+
+    // fix for gecko engine
+    Element.cleanWhitespace(element); 
+    
+    options.draggables = [];
+    options.droppables = [];
+    
+    // make it so 
+    var elements = element.childNodes;
+    for (var i = 0; i < elements.length; i++) 
+      if(elements[i].tagName && elements[i].tagName==options.tag.toUpperCase() &&
+        (!options.only || (Element.Class.has(elements[i], options.only)))) {
+        
+        // handles are per-draggable
+        var handle = options.handle ? 
+          Element.Class.childrenWith(elements[i], options.handle)[0] : elements[i];
+        
+        options.draggables.push(new Draggable(elements[i], Object.extend(options_for_draggable, { handle: handle })));
+        
+        Droppables.add(elements[i], options_for_droppable);
+        options.droppables.push(elements[i]);
+        
+      }
+      
+    // keep reference
+    this.sortables.push(options);
+    
+    // for onupdate
+    Draggables.addObserver(new SortableObserver(element, options.onUpdate));
+
+  },
+  serialize: function(element) {
+    var element = $(element);
+    var sortableOptions = this.options(element);
+    var options = Object.extend({
+      tag:  sortableOptions.tag,
+      only: sortableOptions.only,
+      name: element.id
+    }, arguments[1] || {});
+    
+    var items = $(element).childNodes;
+    var queryComponents = new Array();
+ 
+    for(var i=0; i<items.length; i++)
+      if(items[i].tagName && items[i].tagName==options.tag.toUpperCase() &&
+        (!options.only || (Element.Class.has(items[i], options.only))))
+        queryComponents.push(
+          encodeURIComponent(options.name) + "[]=" + 
+          encodeURIComponent(items[i].id.split("_")[1]));
+
+    return queryComponents.join("&");
+  }
+} 
Index: /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/controls.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/controls.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/controls.js	(revision 1328)
@@ -0,0 +1,434 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//           (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
+  var children = $(element).childNodes;
+  var text     = "";
+  var classtest = new RegExp("^([^ ]+ )*" + ignoreclass+ "( [^ ]+)*$","i");
+  
+  for (var i = 0; i < children.length; i++) {
+    if(children[i].nodeType==3) {
+      text+=children[i].nodeValue;
+    } else {
+      if((!children[i].className.match(classtest)) && children[i].hasChildNodes())
+        text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass);
+    }
+  }
+  
+  return text;
+}
+
+// Autocompleter.Base handles all the autocompletion functionality 
+// that's independent of the data source for autocompletion. This
+// includes drawing the autocompletion menu, observing keyboard
+// and mouse events, and similar.
+//
+// Specific autocompleters need to provide, at the very least, 
+// a getUpdatedChoices function that will be invoked every time
+// the text inside the monitored textbox changes. This method 
+// should get the text for which to provide autocompletion by
+// invoking this.getEntry(), NOT by directly accessing
+// this.element.value. This is to allow incremental tokenized
+// autocompletion. Specific auto-completion logic (AJAX, etc)
+// belongs in getUpdatedChoices.
+//
+// Tokenized incremental autocompletion is enabled automatically
+// when an autocompleter is instantiated with the 'tokens' option
+// in the options parameter, e.g.:
+// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+// will incrementally autocomplete with a comma as the token.
+// Additionally, ',' in the above example can be replaced with
+// a token array, e.g. { tokens: new Array (',', '\n') } which
+// enables autocompletion on multiple tokens. This is most 
+// useful when one of the tokens is \n (a newline), as it 
+// allows smart autocompletion after linebreaks.
+
+var Autocompleter = {}
+Autocompleter.Base = function() {};
+Autocompleter.Base.prototype = {
+  base_initialize: function(element, update, options) {
+    this.element     = $(element); 
+    this.update      = $(update);  
+    this.has_focus   = false; 
+    this.changed     = false; 
+    this.active      = false; 
+    this.index       = 0;     
+    this.entry_count = 0;
+
+    if (this.setOptions)
+      this.setOptions(options);
+    else
+      this.options = {}
+     
+    this.options.tokens       = this.options.tokens || new Array();
+    this.options.frequency    = this.options.frequency || 0.4;
+    this.options.min_chars    = this.options.min_chars || 1;
+    this.options.onShow       = this.options.onShow || 
+    function(element, update){ 
+      if(!update.style.position || update.style.position=='absolute') {
+        update.style.position = 'absolute';
+          var offsets = Position.cumulativeOffset(element);
+          update.style.left = offsets[0] + 'px';
+          update.style.top  = (offsets[1] + element.offsetHeight) + 'px';
+          update.style.width = element.offsetWidth + 'px';
+      }
+      new Effect.Appear(update,{duration:0.15});
+    };
+    this.options.onHide = this.options.onHide || 
+    function(element, update){ new Effect.Fade(update,{duration:0.15}) };
+    
+    if(this.options.indicator)
+      this.indicator = $(this.options.indicator);
+
+    if (typeof(this.options.tokens) == 'string') 
+      this.options.tokens = new Array(this.options.tokens);
+       
+    this.observer = null;
+    
+    Element.hide(this.update);
+    
+    Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
+    Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
+  },
+
+  show: function() {
+    if(this.update.style.display=='none') this.options.onShow(this.element, this.update);
+    if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && this.update.style.position=='absolute') {
+      new Insertion.After(this.update, 
+       '<iframe id="' + this.update.id + '_iefix" '+
+       'style="display:none;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
+       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
+      this.iefix = $(this.update.id+'_iefix');
+    }
+    if(this.iefix) {
+      Position.clone(this.update, this.iefix);
+      this.iefix.style.zIndex = 1;
+      this.update.style.zIndex = 2;
+      Element.show(this.iefix);
+    }
+  },
+  
+  hide: function() {
+    if(this.update.style.display=='') this.options.onHide(this.element, this.update);
+    if(this.iefix) Element.hide(this.iefix);
+  },
+  
+  startIndicator: function() {
+    if(this.indicator) Element.show(this.indicator);
+  },
+  
+  stopIndicator: function() {
+    if(this.indicator) Element.hide(this.indicator);
+  },
+
+  onKeyPress: function(event) {
+    if(this.active)
+      switch(event.keyCode) {
+       case Event.KEY_TAB:
+       case Event.KEY_RETURN:
+         this.select_entry();
+         Event.stop(event);
+       case Event.KEY_ESC:
+         this.hide();
+         this.active = false;
+         return;
+       case Event.KEY_LEFT:
+       case Event.KEY_RIGHT:
+         return;
+       case Event.KEY_UP:
+         this.mark_previous();
+         this.render();
+         if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
+         return;
+       case Event.KEY_DOWN:
+         this.mark_next();
+         this.render();
+         if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
+         return;
+      }
+     else 
+      if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN) 
+        return;
+    
+    this.changed = true;
+    this.has_focus = true;
+    
+    if(this.observer) clearTimeout(this.observer);
+      this.observer = 
+        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
+  },
+  
+  onHover: function(event) {
+    var element = Event.findElement(event, 'LI');
+    if(this.index != element.autocompleteIndex) 
+    {
+        this.index = element.autocompleteIndex;
+        this.render();
+    }
+    Event.stop(event);
+  },
+  
+  onClick: function(event) {
+    var element = Event.findElement(event, 'LI');
+    this.index = element.autocompleteIndex;
+    this.select_entry();
+    Event.stop(event);
+  },
+  
+  onBlur: function(event) {
+    // needed to make click events working
+    setTimeout(this.hide.bind(this), 250);
+    this.has_focus = false;
+    this.active = false;     
+  }, 
+  
+  render: function() {
+    if(this.entry_count > 0) {
+      for (var i = 0; i < this.entry_count; i++)
+        this.index==i ? 
+          Element.addClassName(this.get_entry(i),"selected") : 
+          Element.removeClassName(this.get_entry(i),"selected");
+        
+      if(this.has_focus) { 
+        if(this.get_current_entry().scrollIntoView) 
+          this.get_current_entry().scrollIntoView(false);
+        
+        this.show();
+        this.active = true;
+      }
+    } else this.hide();
+  },
+  
+  mark_previous: function() {
+    if(this.index > 0) this.index--
+      else this.index = this.entry_count-1;
+  },
+  
+  mark_next: function() {
+    if(this.index < this.entry_count-1) this.index++
+      else this.index = 0;
+  },
+  
+  get_entry: function(index) {
+    return this.update.firstChild.childNodes[index];
+  },
+  
+  get_current_entry: function() {
+    return this.get_entry(this.index);
+  },
+  
+  select_entry: function() {
+    this.active = false;
+    value = Element.collectTextNodesIgnoreClass(this.get_current_entry(), 'informal').unescapeHTML();
+    this.updateElement(value);
+    this.element.focus();
+  },
+
+  updateElement: function(value) {
+    var last_token_pos = this.findLastToken();
+    if (last_token_pos != -1) {
+      var new_value = this.element.value.substr(0, last_token_pos + 1);
+      var whitespace = this.element.value.substr(last_token_pos + 1).match(/^\s+/);
+      if (whitespace)
+        new_value += whitespace[0];
+      this.element.value = new_value + value;
+    } else {
+      this.element.value = value;
+    } 
+  },
+  
+  updateChoices: function(choices) {
+    if(!this.changed && this.has_focus) {
+      this.update.innerHTML = choices;
+      Element.cleanWhitespace(this.update);
+      Element.cleanWhitespace(this.update.firstChild);
+
+      if(this.update.firstChild && this.update.firstChild.childNodes) {
+        this.entry_count = 
+          this.update.firstChild.childNodes.length;
+        for (var i = 0; i < this.entry_count; i++) {
+          entry = this.get_entry(i);
+          entry.autocompleteIndex = i;
+          this.addObservers(entry);
+        }
+      } else { 
+        this.entry_count = 0;
+      }
+      
+      this.stopIndicator();
+      
+      this.index = 0;
+      this.render();
+    }
+  },
+
+  addObservers: function(element) {
+    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+  },
+
+  onObserverEvent: function() {
+    this.changed = false;   
+    if(this.getEntry().length>=this.options.min_chars) {
+      this.startIndicator();
+      this.getUpdatedChoices();
+    } else {
+      this.active = false;
+      this.hide();
+    }
+  },
+
+  getEntry: function() {
+    var token_pos = this.findLastToken();
+    if (token_pos != -1)
+      var ret = this.element.value.substr(token_pos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
+    else
+      var ret = this.element.value;
+    
+    return /\n/.test(ret) ? '' : ret;
+  },
+
+  findLastToken: function() {
+    var last_token_pos = -1;
+
+    for (var i=0; i<this.options.tokens.length; i++) {
+      var this_token_pos = this.element.value.lastIndexOf(this.options.tokens[i]);
+      if (this_token_pos > last_token_pos)
+        last_token_pos = this_token_pos;
+    }
+    return last_token_pos;
+  }
+}
+
+Ajax.Autocompleter = Class.create();
+Ajax.Autocompleter.prototype = Object.extend(new Autocompleter.Base(), 
+Object.extend(new Ajax.Base(), {
+  initialize: function(element, update, url, options) {
+	  this.base_initialize(element, update, options);
+    this.options.asynchronous = true;
+    this.options.onComplete   = this.onComplete.bind(this)
+    this.options.method       = 'post';
+    this.url                  = url;
+  },
+  
+  getUpdatedChoices: function() {
+    entry = encodeURIComponent(this.element.name) + '=' + 
+      encodeURIComponent(this.getEntry());
+    
+    this.options.parameters = this.options.callback ?
+      this.options.callback(this.element, entry) : entry;
+    new Ajax.Request(this.url, this.options);
+  },
+  
+  onComplete: function(request) {
+    this.updateChoices(request.responseText);
+  }
+
+}));
+
+// The local array autocompleter. Used when you'd prefer to
+// inject an array of autocompletion options into the page, rather
+// than sending out Ajax queries, which can be quite slow sometimes.
+//
+// The constructor takes four parameters. The first two are, as usual,
+// the id of the monitored textbox, and id of the autocompletion menu.
+// The third is the array you want to autocomplete from, and the fourth
+// is the options block.
+//
+// Extra local autocompletion options:
+// - choices - How many autocompletion choices to offer
+//
+// - partial_search - If false, the autocompleter will match entered
+//                    text only at the beginning of strings in the 
+//                    autocomplete array. Defaults to true, which will
+//                    match text at the beginning of any *word* in the
+//                    strings in the autocomplete array. If you want to
+//                    search anywhere in the string, additionally set
+//                    the option full_search to true (default: off).
+//
+// - full_search - Search anywhere in autocomplete array strings.
+//
+// - partial_chars - How many characters to enter before triggering
+//                   a partial match (unlike min_chars, which defines
+//                   how many characters are required to do any match
+//                   at all). Defaults to 2.
+//
+// - ignore_case - Whether to ignore case when autocompleting.
+//                 Defaults to true.
+//
+// It's possible to pass in a custom function as the 'selector' 
+// option, if you prefer to write your own autocompletion logic.
+// In that case, the other options above will not apply unless
+// you support them.
+
+Autocompleter.Local = Class.create();
+Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
+  initialize: function(element, update, array, options) {
+    this.base_initialize(element, update, options);
+    this.options.array = array;
+  },
+
+  getUpdatedChoices: function() {
+    this.updateChoices(this.options.selector(this));
+  },
+
+  setOptions: function(options) {
+    this.options = Object.extend({
+      choices: 10,
+      partial_search: true,
+      partial_chars: 2,
+      ignore_case: true,
+      full_search: false,
+      selector: function(instance) {
+        var ret       = new Array(); // Beginning matches
+        var partial   = new Array(); // Inside matches
+        var entry     = instance.getEntry();
+        var count     = 0;
+        
+        for (var i = 0; i < instance.options.array.length &&  
+            ret.length < instance.options.choices ; i++) { 
+          var elem = instance.options.array[i];
+          var found_pos = instance.options.ignore_case ? 
+            elem.toLowerCase().indexOf(entry.toLowerCase()) : 
+            elem.indexOf(entry);
+
+          if (found_pos == 0 && elem.length == entry.length) 
+            continue;
+          else if (found_pos == 0) 
+            ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 
+              elem.substr(entry.length) + "</li>");
+          else if (entry.length >= instance.options.partial_chars && 
+            instance.options.partial_search && found_pos != -1) {
+            if (!instance.options.full_search && !/\s/.test(elem.substr(found_pos-1,1)))
+              continue;
+            partial.push("<li>" + elem.substr(0, found_pos) + "<strong>" +
+              elem.substr(found_pos, entry.length) + "</strong>" + elem.substr(
+              found_pos + entry.length) + "</li>")
+          }
+        }
+        if (partial.length)
+          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+        return "<ul>" + ret.join('') + "</ul>";
+      }
+    }, options || {});
+  }
+});
Index: /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/prototype.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/prototype.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/dragdrop.files/prototype.js	(revision 1328)
@@ -0,0 +1,1044 @@
+/*  Prototype JavaScript framework, version 1.3.0
+ *  (c) 2005 Sam Stephenson <sam@conio.net>
+ *
+ *  THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
+ *  against the source tree, available from the Prototype darcs repository. 
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *
+ *  For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
+
+var Prototype = {
+  Version: '1.3.0',
+  emptyFunction: function() {}
+}
+
+var Class = {
+  create: function() {
+    return function() { 
+      this.initialize.apply(this, arguments);
+    }
+  }
+}
+
+var Abstract = new Object();
+
+Object.extend = function(destination, source) {
+  for (property in source) {
+    destination[property] = source[property];
+  }
+  return destination;
+}
+/*
+Object.prototype.extend = function(object) {
+  return Object.extend.apply(this, [this, object]);
+}
+*/
+Function.prototype.bind = function(object) {
+  var __method = this;
+  return function() {
+    __method.apply(object, arguments);
+  }
+}
+
+Function.prototype.bindAsEventListener = function(object) {
+  var __method = this;
+  return function(event) {
+    __method.call(object, event || window.event);
+  }
+}
+
+Number.prototype.toColorPart = function() {
+  var digits = this.toString(16);
+  if (this < 16) return '0' + digits;
+  return digits;
+}
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0; i < arguments.length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) {}
+    }
+
+    return returnValue;
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try { 
+        this.currentlyExecuting = true;
+        this.callback(); 
+      } finally { 
+        this.currentlyExecuting = false;
+      }
+    }
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+function $() {
+  var elements = new Array();
+
+  for (var i = 0; i < arguments.length; i++) {
+    var element = arguments[i];
+    if (typeof element == 'string')
+      element = document.getElementById(element);
+
+    if (arguments.length == 1) 
+      return element;
+
+    elements.push(element);
+  }
+
+  return elements;
+}
+
+if (!Array.prototype.push) {
+  Array.prototype.push = function() {
+		var startLength = this.length;
+		for (var i = 0; i < arguments.length; i++)
+      this[startLength + i] = arguments[i];
+	  return this.length;
+  }
+}
+
+if (!Function.prototype.apply) {
+  // Based on code from http://www.youngpup.net/
+  Function.prototype.apply = function(object, parameters) {
+    var parameterStrings = new Array();
+    if (!object)     object = window;
+    if (!parameters) parameters = new Array();
+    
+    for (var i = 0; i < parameters.length; i++)
+      parameterStrings[i] = 'parameters[' + i + ']';
+    
+    object.__apply__ = this;
+    var result = eval('object.__apply__(' + 
+      parameterStrings[i].join(', ') + ')');
+    object.__apply__ = null;
+    
+    return result;
+  }
+}
+
+Object.extend(String.prototype, {
+  stripTags: function() {
+    return this.replace(/<\/?[^>]+>/gi, '');
+  },
+
+  escapeHTML: function() {
+    var div = document.createElement('div');
+    var text = document.createTextNode(this);
+    div.appendChild(text);
+    return div.innerHTML;
+  },
+
+  unescapeHTML: function() {
+    var div = document.createElement('div');
+    div.innerHTML = this.stripTags();
+    return div.childNodes[0].nodeValue;
+  }
+});
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
+      function() {return new XMLHttpRequest()}
+    ) || false;
+  }
+}
+
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+  setOptions: function(options) {
+    this.options = Object.extend({
+      method:       'post',
+      asynchronous: true,
+      parameters:   ''
+    }, options || {});
+  },
+
+  responseIsSuccess: function() {
+    return this.transport.status == undefined
+        || this.transport.status == 0 
+        || (this.transport.status >= 200 && this.transport.status < 300);
+  },
+
+  responseIsFailure: function() {
+    return !this.responseIsSuccess();
+  }
+}
+
+Ajax.Request = Class.create();
+Ajax.Request.Events = 
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(url, options) {
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+    this.request(url);
+  },
+
+  request: function(url) {
+    var parameters = this.options.parameters || '';
+    if (parameters.length > 0) parameters += '&_=';
+
+    try {
+      if (this.options.method == 'get')
+        url += '?' + parameters;
+
+      this.transport.open(this.options.method, url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) {
+        this.transport.onreadystatechange = this.onStateChange.bind(this);
+        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
+      }
+
+      this.setRequestHeaders();
+
+      var body = this.options.postBody ? this.options.postBody : parameters;
+      this.transport.send(this.options.method == 'post' ? body : null);
+
+    } catch (e) {
+    }
+  },
+
+  setRequestHeaders: function() {
+    var requestHeaders = 
+      ['X-Requested-With', 'XMLHttpRequest',
+       'X-Prototype-Version', Prototype.Version];
+
+    if (this.options.method == 'post') {
+      requestHeaders.push('Content-type', 
+        'application/x-www-form-urlencoded');
+
+      /* Force "Connection: close" for Mozilla browsers to work around
+       * a bug where XMLHttpReqeuest sends an incorrect Content-length
+       * header. See Mozilla Bugzilla #246651. 
+       */
+      if (this.transport.overrideMimeType)
+        requestHeaders.push('Connection', 'close');
+    }
+
+    if (this.options.requestHeaders)
+      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
+
+    for (var i = 0; i < requestHeaders.length; i += 2)
+      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState != 1)
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  respondToReadyState: function(readyState) {
+    var event = Ajax.Request.Events[readyState];
+
+    if (event == 'Complete')
+      (this.options['on' + this.transport.status]
+       || this.options['on' + this.responseIsSuccess ? 'Success' : 'Failure']
+       || Prototype.emptyFunction)(this.transport);       
+
+    (this.options['on' + event] || Prototype.emptyFunction)(this.transport);    
+  }
+});
+
+Ajax.Updater = Class.create();
+Ajax.Updater.ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:<\/script>)';
+
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
+  initialize: function(container, url, options) {
+    this.containers = {
+      success: container.success ? $(container.success) : $(container),
+      failure: container.failure ? $(container.failure) :
+        (container.success ? null : $(container))
+    }
+
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+
+    var onComplete = this.options.onComplete || Prototype.emptyFunction;
+    this.options.onComplete = (function() {
+      this.updateContent();
+      onComplete(this.transport);      
+    }).bind(this);
+
+    this.request(url);
+  },
+
+  updateContent: function() {
+    var receiver = this.responseIsSuccess() ?
+      this.containers.success : this.containers.failure;
+
+    var match    = new RegExp(Ajax.Updater.ScriptFragment, 'img');
+    var response = this.transport.responseText.replace(match, '');
+    var scripts  = this.transport.responseText.match(match);
+
+    if (receiver) {
+      if (this.options.insertion) {
+        new this.options.insertion(receiver, response);
+      } else {
+        receiver.innerHTML = response;
+      }
+    }
+
+    if (this.responseIsSuccess()) {
+      if (this.onComplete)
+        setTimeout((function() {this.onComplete(
+          this.transport)}).bind(this), 10);
+    }
+
+    if (this.options.evalScripts && scripts) {
+      match = new RegExp(Ajax.Updater.ScriptFragment, 'im');
+      setTimeout((function() {
+        for (var i = 0; i < scripts.length; i++)
+          eval(scripts[i].match(match)[1]);
+      }).bind(this), 10);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create();
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(container, url, options) {
+    this.setOptions(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = 1;
+
+    this.updater = {};
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Ajax.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(request) {
+    if (this.options.decay) {
+      this.decay = (request.responseText == this.lastText ? 
+        this.decay * this.options.decay : 1);
+
+      this.lastText = request.responseText;
+    }
+    this.timer = setTimeout(this.onTimerEvent.bind(this), 
+      this.decay * this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+
+document.getElementsByClassName = function(className) {
+  var children = document.getElementsByTagName('*') || document.all;
+  var elements = new Array();
+  
+  for (var i = 0; i < children.length; i++) {
+    var child = children[i];
+    var classNames = child.className.split(' ');
+    for (var j = 0; j < classNames.length; j++) {
+      if (classNames[j] == className) {
+        elements.push(child);
+        break;
+      }
+    }
+  }
+  
+  return elements;
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Element) {
+  var Element = new Object();
+}
+
+Object.extend(Element, {
+  toggle: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = 
+        (element.style.display == 'none' ? '' : 'none');
+    }
+  },
+
+  hide: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = 'none';
+    }
+  },
+
+  show: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = '';
+    }
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+  },
+   
+  getHeight: function(element) {
+    element = $(element);
+    return element.offsetHeight; 
+  },
+
+  hasClassName: function(element, className) {
+    element = $(element);
+    if (!element)
+      return;
+    var a = element.className.split(' ');
+    for (var i = 0; i < a.length; i++) {
+      if (a[i] == className)
+        return true;
+    }
+    return false;
+  },
+
+  addClassName: function(element, className) {
+    element = $(element);
+    Element.removeClassName(element, className);
+    element.className += ' ' + className;
+  },
+
+  removeClassName: function(element, className) {
+    element = $(element);
+    if (!element)
+      return;
+    var newClassName = '';
+    var a = element.className.split(' ');
+    for (var i = 0; i < a.length; i++) {
+      if (a[i] != className) {
+        if (i > 0)
+          newClassName += ' ';
+        newClassName += a[i];
+      }
+    }
+    element.className = newClassName;
+  },
+  
+  // removes whitespace-only text node children
+  cleanWhitespace: function(element) {
+    var element = $(element);
+    for (var i = 0; i < element.childNodes.length; i++) {
+      var node = element.childNodes[i];
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
+        Element.remove(node);
+    }
+  }
+});
+
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.Insertion = function(adjacency) {
+  this.adjacency = adjacency;
+}
+
+Abstract.Insertion.prototype = {
+  initialize: function(element, content) {
+    this.element = $(element);
+    this.content = content;
+    
+    if (this.adjacency && this.element.insertAdjacentHTML) {
+      this.element.insertAdjacentHTML(this.adjacency, this.content);
+    } else {
+      this.range = this.element.ownerDocument.createRange();
+      if (this.initializeRange) this.initializeRange();
+      this.fragment = this.range.createContextualFragment(this.content);
+      this.insertContent();
+    }
+  }
+}
+
+var Insertion = new Object();
+
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+  initializeRange: function() {
+    this.range.setStartBefore(this.element);
+  },
+  
+  insertContent: function() {
+    this.element.parentNode.insertBefore(this.fragment, this.element);
+  }
+});
+
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(true);
+  },
+  
+  insertContent: function() {  
+    this.element.insertBefore(this.fragment, this.element.firstChild);
+  }
+});
+
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(this.element);
+  },
+  
+  insertContent: function() {
+    this.element.appendChild(this.fragment);
+  }
+});
+
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+  initializeRange: function() {
+    this.range.setStartAfter(this.element);
+  },
+  
+  insertContent: function() {
+    this.element.parentNode.insertBefore(this.fragment, 
+      this.element.nextSibling);
+  }
+});
+
+var Field = {
+  clear: function() {
+    for (var i = 0; i < arguments.length; i++)
+      $(arguments[i]).value = '';
+  },
+
+  focus: function(element) {
+    $(element).focus();
+  },
+  
+  present: function() {
+    for (var i = 0; i < arguments.length; i++)
+      if ($(arguments[i]).value == '') return false;
+    return true;
+  },
+  
+  select: function(element) {
+    $(element).select();
+  },
+   
+  activate: function(element) {
+    $(element).focus();
+    $(element).select();
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Form = {
+  serialize: function(form) {
+    var elements = Form.getElements($(form));
+    var queryComponents = new Array();
+    
+    for (var i = 0; i < elements.length; i++) {
+      var queryComponent = Form.Element.serialize(elements[i]);
+      if (queryComponent)
+        queryComponents.push(queryComponent);
+    }
+    
+    return queryComponents.join('&');
+  },
+  
+  getElements: function(form) {
+    var form = $(form);
+    var elements = new Array();
+
+    for (tagName in Form.Element.Serializers) {
+      var tagElements = form.getElementsByTagName(tagName);
+      for (var j = 0; j < tagElements.length; j++)
+        elements.push(tagElements[j]);
+    }
+    return elements;
+  },
+  
+  getInputs: function(form, typeName, name) {
+    var form = $(form);
+    var inputs = form.getElementsByTagName('input');
+    
+    if (!typeName && !name)
+      return inputs;
+      
+    var matchingInputs = new Array();
+    for (var i = 0; i < inputs.length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) ||
+          (name && input.name != name)) 
+        continue;
+      matchingInputs.push(input);
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      element.blur();
+      element.disabled = 'true';
+    }
+  },
+
+  enable: function(form) {
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      element.disabled = '';
+    }
+  },
+
+  focusFirstElement: function(form) {
+    var form = $(form);
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      if (element.type != 'hidden' && !element.disabled) {
+        Field.activate(element);
+        break;
+      }
+    }
+  },
+
+  reset: function(form) {
+    $(form).reset();
+  }
+}
+
+Form.Element = {
+  serialize: function(element) {
+    var element = $(element);
+    var method = element.tagName.toLowerCase();
+    var parameter = Form.Element.Serializers[method](element);
+    
+    if (parameter)
+      return encodeURIComponent(parameter[0]) + '=' + 
+        encodeURIComponent(parameter[1]);                   
+  },
+  
+  getValue: function(element) {
+    var element = $(element);
+    var method = element.tagName.toLowerCase();
+    var parameter = Form.Element.Serializers[method](element);
+    
+    if (parameter) 
+      return parameter[1];
+  }
+}
+
+Form.Element.Serializers = {
+  input: function(element) {
+    switch (element.type.toLowerCase()) {
+      case 'submit':
+      case 'hidden':
+      case 'password':
+      case 'text':
+        return Form.Element.Serializers.textarea(element);
+      case 'checkbox':  
+      case 'radio':
+        return Form.Element.Serializers.inputSelector(element);
+    }
+    return false;
+  },
+
+  inputSelector: function(element) {
+    if (element.checked)
+      return [element.name, element.value];
+  },
+
+  textarea: function(element) {
+    return [element.name, element.value];
+  },
+
+  select: function(element) {
+    var value = '';
+    if (element.type == 'select-one') {
+      var index = element.selectedIndex;
+      if (index >= 0)
+        value = element.options[index].value || element.options[index].text;
+    } else {
+      value = new Array();
+      for (var i = 0; i < element.length; i++) {
+        var opt = element.options[i];
+        if (opt.selected)
+          value.push(opt.value || opt.text);
+      }
+    }
+    return [element.name, value];
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var $F = Form.Element.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+  initialize: function(element, frequency, callback) {
+    this.frequency = frequency;
+    this.element   = $(element);
+    this.callback  = callback;
+    
+    this.lastValue = this.getValue();
+    this.registerCallback();
+  },
+  
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+  
+  onTimerEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+}
+
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+    
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+  
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+  
+  registerFormCallbacks: function() {
+    var elements = Form.getElements(this.element);
+    for (var i = 0; i < elements.length; i++)
+      this.registerCallback(elements[i]);
+  },
+  
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':  
+        case 'radio':
+          element.target = this;
+          element.prev_onclick = element.onclick || Prototype.emptyFunction;
+          element.onclick = function() {
+            this.prev_onclick(); 
+            this.target.onElementEvent();
+          }
+          break;
+        case 'password':
+        case 'text':
+        case 'textarea':
+        case 'select-one':
+        case 'select-multiple':
+          element.target = this;
+          element.prev_onchange = element.onchange || Prototype.emptyFunction;
+          element.onchange = function() {
+            this.prev_onchange(); 
+            this.target.onElementEvent();
+          }
+          break;
+      }
+    }    
+  }
+}
+
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+
+if (!window.Event) {
+  var Event = new Object();
+}
+
+Object.extend(Event, {
+  KEY_BACKSPACE: 8,
+  KEY_TAB:       9,
+  KEY_RETURN:   13,
+  KEY_ESC:      27,
+  KEY_LEFT:     37,
+  KEY_UP:       38,
+  KEY_RIGHT:    39,
+  KEY_DOWN:     40,
+  KEY_DELETE:   46,
+
+  element: function(event) {
+    return event.target || event.srcElement;
+  },
+
+  isLeftClick: function(event) {
+    return (((event.which) && (event.which == 1)) ||
+            ((event.button) && (event.button == 1)));
+  },
+
+  pointerX: function(event) {
+    return event.pageX || (event.clientX + 
+      (document.documentElement.scrollLeft || document.body.scrollLeft));
+  },
+
+  pointerY: function(event) {
+    return event.pageY || (event.clientY + 
+      (document.documentElement.scrollTop || document.body.scrollTop));
+  },
+
+  stop: function(event) {
+    if (event.preventDefault) { 
+      event.preventDefault(); 
+      event.stopPropagation(); 
+    } else {
+      event.returnValue = false;
+    }
+  },
+
+  // find the first node with the given tagName, starting from the
+  // node the event was triggered on; traverses the DOM upwards
+  findElement: function(event, tagName) {
+    var element = Event.element(event);
+    while (element.parentNode && (!element.tagName ||
+        (element.tagName.toUpperCase() != tagName.toUpperCase())))
+      element = element.parentNode;
+    return element;
+  },
+  
+  observers: false,
+  
+  _observeAndCache: function(element, name, observer, useCapture) {
+    if(!this.observers) this.observers = [];
+    if(element.addEventListener) {
+      this.observers.push([element,name,observer,useCapture]);
+      element.addEventListener(name, observer, useCapture);
+    } else if (element.attachEvent) {
+      this.observers.push([element,name,observer,useCapture]);
+      element.attachEvent('on'+name, observer);
+    }
+  },
+  
+  unloadCache: function() {
+    if(!Event.observers) return;
+    for(var i=0; i<Event.observers.length; i++) {
+      Event.stopObserving(Event.observers[i][0],Event.observers[i][1],Event.observers[i][2],Event.observers[i][3]);
+      Event.observers[i][0] = null;
+    }
+    Event.observers = false;
+  },
+
+  observe: function(element, name, observer, useCapture) {
+    var element = $(element);
+    useCapture = useCapture || false;
+    
+    if (name == 'keypress') {
+      if (navigator.appVersion.indexOf('AppleWebKit') > 0) {
+        this._observeAndCache(element, 'keydown', observer, useCapture);
+        return;
+      }
+      this._observeAndCache(element, 'keypress', observer, useCapture);
+    } else {
+      this._observeAndCache(element, name, observer, useCapture);
+    }
+  },
+
+  stopObserving: function(element, name, observer, useCapture) {
+    var element = $(element);
+    useCapture = useCapture || false;
+    
+    if (name == 'keypress') {
+      if (navigator.appVersion.indexOf('AppleWebKit') > 0) {
+        element.removeEventListener('keydown', observer, useCapture);
+        return;
+      }
+      if (element.removeEventListener) {
+        element.removeEventListener('keypress', observer, useCapture);
+      } else if (element.detachEvent) {
+        element.detachEvent('onkeydown', observer);
+      }
+    } else {
+      if (element.removeEventListener) {
+        element.removeEventListener(name, observer, useCapture);
+      } else if (element.detachEvent) {
+        element.detachEvent('on' + name, observer);
+      }
+    }
+  }
+});
+
+// prevent memory leaks
+Event.observe(window,'unload', Event.unloadCache, false);
+
+var Position = {
+
+  // set to true if needed, warning: firefox performance problems
+  // NOT neeeded for page scrolling, only if draggable contained in
+  // scrollable elements
+  includeScrollOffsets: false, 
+
+  // must be called before calling withinIncludingScrolloffset, every time the
+  // page is scrolled
+  prepare: function() {
+    this.deltaX =  window.pageXOffset 
+                || document.documentElement.scrollLeft 
+                || document.body.scrollLeft 
+                || 0;
+    this.deltaY =  window.pageYOffset 
+                || document.documentElement.scrollTop 
+                || document.body.scrollTop 
+                || 0;
+  },
+
+  realOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0; 
+      element = element.parentNode;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  cumulativeOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  // caches x/y coordinate pair to use with overlap
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = this.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] && 
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = this.realOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = this.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] && 
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  // within must be called directly before
+  overlap: function(mode, element) {  
+    if (!mode) return 0;  
+    if (mode == 'vertical') 
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) / 
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) / 
+        element.offsetWidth;
+  },
+
+  clone: function(source, target) {
+    source = $(source);
+    target = $(target);
+    target.style.position = 'absolute';
+    var offsets = this.cumulativeOffset(source);
+    target.style.top    = offsets[1] + 'px';
+    target.style.left   = offsets[0] + 'px';
+    target.style.width  = source.offsetWidth + 'px';
+    target.style.height = source.offsetHeight + 'px';
+  }
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/recv_post.php
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/recv_post.php	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/recv_post.php	(revision 1328)
@@ -0,0 +1,9 @@
+<?php
+	foreach($_POST as $key => $val){
+		if(ereg("^item", $key)) {
+			if($val == 'in') {
+				print($key . "¤¬¡¢¥Õ¥ì¡¼¥àÆâ¤ËÂ¸ºß¤·¤Þ¤¹¡£</br>\n");
+			}
+		}
+	}
+?>
Index: /temp/trunk/html/test/kakinaka/dragdrop/cart.html
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/cart.html	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/cart.html	(revision 1328)
@@ -0,0 +1,228 @@
+ï»?!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
+<!-- saved from url=(0032)http://demo.script.aculo.us/shop -->
+<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>script.aculo.us - web 2.0 javascript demos</TITLE>
+<META http-equiv=content-type content="text/html; charset=utf-8"><LINK 
+media=screen href="dragdrop.files/script.aculo.us.css" type=text/css 
+rel=Stylesheet>
+<SCRIPT src="dragdrop.files/prototype.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="dragdrop.files/effects.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="dragdrop.files/dragdrop.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="dragdrop.files/controls.js" type=text/javascript></SCRIPT>
+
+<STYLE type=text/css>DIV.auto_complete {
+	BORDER-RIGHT: #888 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #888 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: #888 1px solid; WIDTH: 250px; PADDING-TOP: 0px; BORDER-BOTTOM: #888 1px solid; POSITION: absolute; BACKGROUND-COLOR: white
+}
+UL.contacts {
+	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
+}
+UL.contacts LI.selected {
+	BACKGROUND-COLOR: #ffb
+}
+LI.contact {
+	PADDING-RIGHT: 2px; DISPLAY: block; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN: 0px; PADDING-TOP: 2px; LIST-STYLE-TYPE: none; HEIGHT: 32px
+}
+LI.contact DIV.image {
+	FLOAT: left; WIDTH: 32px; MARGIN-RIGHT: 8px; HEIGHT: 32px
+}
+LI.contact DIV.name {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; LINE-HEIGHT: 1.2em
+}
+LI.contact DIV.email {
+	FONT-SIZE: 10px; COLOR: #888
+}
+#list {
+	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 10px 0px 0px; WIDTH: 250px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
+}
+#list LI {
+	BORDER-RIGHT: #888 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #888 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; MARGIN: 0px 0px 4px; BORDER-LEFT: #888 1px solid; CURSOR: move; PADDING-TOP: 5px; BORDER-BOTTOM: #888 1px solid
+}
+</STYLE>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<DIV id=header><IMG id=logo alt="script.aculo.us - web 2.0 javascript demos" 
+src="dragdrop.files/logo.gif"> </DIV>
+<UL id=menu>
+  <LI><A href="http://script.aculo.us/">Back to site</A> </LI>
+  <LI><A class=active href="http://demo.script.aculo.us/">Demos</A> </LI></UL>
+<DIV id=tagline>This site demonstrates the <B>Ruby on Rails 0.13</B> AJAX 
+helpers, <BR>which use script.aculo.us effects, drag-and-drop and 
+autocompletion. </DIV>
+<DIV id=sidebar-container>
+<DIV id=sidebar>
+<H1>rails 0.13 Demos</H1>
+<P>script.aculo.us helpers</P>
+<UL>
+  <LI><A href="http://demo.script.aculo.us/ajax/autocompleter">Autocompleting 
+  text fields (basic)</A> 
+  <LI><A 
+  href="http://demo.script.aculo.us/ajax/autocompleter_customized">Autocompleting 
+  text fields (customized)</A> 
+  <LI><A href="http://demo.script.aculo.us/shop">Shopping cart</A> 
+  <LI><A href="http://demo.script.aculo.us/ajax/sortable_elements">Sortable 
+  elements</A> </LI></UL>
+<P>New AJAX features</P>
+<UL>
+  <LI><A href="http://demo.script.aculo.us/ajax/error_handling">Error 
+  handling</A> 
+  <LI><A href="http://demo.script.aculo.us/ajax/update_element">Update element 
+  helper</A> </LI></UL></DIV>
+<DIV class=links><A href="http://www.rubyonrails.org/"><IMG alt="Ruby on Rails" 
+src="dragdrop.files/rails.jpg"></A> <EM>Rails is a full-stack, open-source web 
+framework in Ruby for writing real-world applications with joy and less code 
+than most frameworks spend doing XML sit-ups.</EM> That quite sums it up. So, if 
+you're still working late hours writing definitions of what's in your database 
+because the framework you use works against and not for you -- do yourself a 
+favour, and check out <A href="http://www.rubyonrails.org/">Ruby on Rails</A>. 
+</DIV></DIV>
+<DIV id=content>
+<H1>Silly easy shopping</H1>
+<P>Drag products to the cart to fill it:</P>
+<DIV style="MARGIN-BOTTOM: 20px; HEIGHT: 120px"><IMG class=products id=product_1 
+alt=Mug src="dragdrop.files/product1.png">
+<SCRIPT type=text/javascript>new Draggable('product_1', {revert:true})</SCRIPT>
+ <IMG class=products id=product_2 alt=T-Shirt src="dragdrop.files/product2.png">
+<SCRIPT type=text/javascript>new Draggable('product_2', {revert:true})</SCRIPT>
+ </DIV>
+<H2>Your cart:</H2>
+<DIV class=cart id=cart style="CLEAR: left; MARGIN-TOP: 10px; HEIGHT: 132px">
+<DIV id=items>Here's your shopping cart. We would very much appreciate it if you 
+fill it with stuff. </DIV>
+<DIV style="CLEAR: both"></DIV></DIV>
+<DIV id=wastebin>Drop items here to remove them from the cart. </DIV>
+<DIV style="PADDING-TOP: 10px; HEIGHT: 40px">
+<P id=indicator style="MARGIN-TOP: 0px; DISPLAY: none"><IMG alt=Indicator 
+src="dragdrop.files/indicator.gif"> Updating cart... </P></DIV>
+<SCRIPT type=text/javascript>Droppables.add('cart', {accept:'products', onDrop:function(element){new Ajax.Updater('items', '/shop/add', {onLoading:function(request){Element.show('indicator')}, onComplete:function(request){Element.hide('indicator')}, parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}, hoverclass:'cart-active'})</SCRIPT>
+
+<SCRIPT type=text/javascript>Droppables.add('wastebin', {accept:'cart-items', onDrop:function(element){Element.hide(element); new Ajax.Updater('items', '/shop/remove', {onLoading:function(request){Element.show('indicator')}, onComplete:function(request){Element.hide('indicator')}, parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}, hoverclass:'wastebin-active'})</SCRIPT>
+
+<P><A onclick="new Effect.SlideDown('source'); return false;" href="http://demo.script.aculo.us/shop#">View source</A></P><PRE id=source style="DISPLAY: none"><CODE>
+# view
+&lt;div style="margin-bottom:20px;height:120px;"&gt;
+&lt;% for product in @products %&gt;
+  &lt;%= image_tag "/images/products/product#{product.id}",
+        :id =&gt; "product_#{product.id}",
+        :alt =&gt; product.title, 
+        :class =&gt; "products"  %&gt;
+  &lt;%= draggable_element "product_#{product.id}", :revert =&gt; true %&gt;
+&lt;% end %&gt;
+&lt;/div&gt;
+
+&lt;h2&gt;Your cart:&lt;/h2&gt;
+
+&lt;div id="cart" class="cart" style="clear:left; height:132px;margin-top:10px;"&gt;
+  &lt;div id="wastebin"&gt;
+    Drop items here to remove them from the cart.
+  &lt;/div&gt;
+  &lt;div id="items"&gt;
+    &lt;%= render :partial =&gt; "cart" %&gt;
+  &lt;/div&gt;
+  &lt;div style="clear:both;"&gt;&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style="height:40px;padding-top:10px;"&gt;
+&lt;p id="indicator" style="display:none;margin-top:0px;"&gt;
+  &lt;%= image_tag "indicator.gif" %&gt; Updating cart...
+&lt;/p&gt;
+&lt;/div&gt;
+
+&lt;%= drop_receiving_element "cart", 
+      :update =&gt; "items", :url =&gt; { :action =&gt; "add" },
+      :accept =&gt; "products", :hoverclass =&gt; "cart-active",
+      :loading =&gt; "Element.show('indicator')",
+      :complete =&gt; "Element.hide('indicator')" %&gt;
+      
+&lt;%= drop_receiving_element "wastebin", 
+      :update =&gt; "items", :url =&gt; { :action =&gt; "remove" },
+      :accept =&gt; "cart-items", :hoverclass =&gt; "wastebin-active",
+      :before =&gt; "Element.hide(element)",
+      :loading =&gt; "Element.show('indicator')",
+      :complete =&gt; "Element.hide('indicator')" %&gt;
+    
+# controller
+class ShopController &lt; ApplicationController
+  
+  def index
+    session[:cart] ||= {}
+    @products = Product.find(:all)
+  end
+  
+  def add
+    product_id = params[:id].split("_")[1]
+    
+    session[:cart][product_id] = 
+      session[:cart].include?(product_id) ?  
+      session[:cart][product_id]+1 : 1
+  
+    render :partial =&gt; 'cart'
+  end
+  
+  def remove
+    product_id = params[:id].split("_")[1]
+    
+    if session[:cart][product_id] &gt; 1 
+      session[:cart][product_id] = session[:cart][product_id]-1
+    else
+      session[:cart].delete(product_id)
+    end
+    
+    render :partial =&gt; 'cart'
+  end
+  
+end
+
+
+# _cart.rhtml partial
+&lt;% session[:cart].each do |product,quantity| %&gt;
+&lt;div&gt;
+  &lt;% quantity.times do |i| %&gt;
+    &lt;%= image_tag "/images/products/product#{product}", 
+          :class =&gt; "cart-items", 
+          :id =&gt; "item_#{product}_#{i}", 
+          :style =&gt; "position:relative;" %&gt;
+    &lt;%= draggable_element "item_#{product}_#{i}", :revert =&gt; true %&gt;
+  &lt;% end %&gt;
+  &lt;span class="title"&gt;
+    &lt;%= Product.find(product).title + " (#{quantity})" %&gt;
+  &lt;/span&gt;
+&lt;/div&gt;
+&lt;% end %&gt;
+&lt;%= "Here's your shopping cart." if session[:cart].empty? %&gt;
+</CODE></PRE></DIV>
+<DIV id=footer>
+<P>Â© 2005 Thomas Fuchs <A 
+onclick="new Effect.BlindDown('license'); return false;" 
+href="http://demo.script.aculo.us/shop#">License</A> <A 
+href="http://validator.w3.org/check?uri=referer">validate</A> <A 
+href="http://mir.aculo.us/">mir.aculo.us</A> </P>
+<P class=info><A href="http://script.aculo.us/">script.aculo.us</A> demo site 
+version <EM>2005/07/04</EM> </P>
+<DIV id=license style="DISPLAY: none"><PRE>      script.aculo.us:
+      
+      Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+      
+      Permission is hereby granted, free of charge, to any person obtaining
+      a copy of this software and associated documentation files (the
+      "Software"), to deal in the Software without restriction, including
+      without limitation the rights to use, copy, modify, merge, publish,
+      distribute, sublicense, and/or sell copies of the Software, and to
+      permit persons to whom the Software is furnished to do so, subject to
+      the following conditions:
+      
+      The above copyright notice and this permission notice shall be
+      included in all copies or substantial portions of the Software.
+      
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+      LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+      OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+      WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+      
+      <A onclick="new Effect.BlindUp('license'); return false;" href="http://demo.script.aculo.us/shop#">Hide</A>
+      </PRE></DIV></DIV></BODY></HTML>
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecom.html
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecom.html	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecom.html	(revision 1328)
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0105)http://members.cms.drecom.jp/sec/SidefuncOrder.blog%3bjsessionid=E8DA4FE5C69A98F200C5E619643544B4.cms-ap1 -->
+<HTML lang=ja><HEAD><TITLE>¥Ñ¡¼¥ÄÁªÂò¡¦ÊÂ¤ÓÂØ¤¨ - ¥É¥ê¥³¥àCMS</TITLE>
+<META http-equiv=Content-Type content=text/html;charset=EUC-JP>
+<META content=CMS,¥É¥ê¥³¥à name=keywords>
+<META content=¥É¥ê¥³¥àCMS name=abstract>
+<META content=¥É¥ê¥³¥àCMS name=description>
+<SCRIPT src="files/style.js" type=text/javascript></SCRIPT>
+<LINK href="files/style.css" type=text/css rel=stylesheet><LINK 
+href="files/text.css" type=text/css rel=stylesheet>
+<SCRIPT src="files/common.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="files/xbs.js" type=text/javascript></SCRIPT>
+<!-- added by Takanori Ishikawa, 04/04/06 -->
+<SCRIPT src="files/sidefunc_order.js" type=text/javascript></SCRIPT>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY bottomMargin=0 leftMargin=0 topMargin=10 marginwidth="0" marginheight="0">
+
+ <SCRIPT language=JavaScript>
+    <!--
+      var help_add_sidefunc= '<b>¥µ¥¤¥É¥Ñ¡¼¥Ä¤ÎÄÉ²Ã¡¦ÊÔ½¸</b>¤ò¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£';
+    //-->
+</SCRIPT>
+
+<SCRIPT src="files/access_key.js" type=text/javascript></SCRIPT>
+
+<SCRIPT language=JavaScript>
+<!--
+function showUpdatedMessage() {
+	if (document.SidefuncOrderForm.isUpdated.value == 'true') {
+		htmlAlert("¥µ¥¤¥É¥Ð¡¼¤ÎÊÑ¹¹¤òÊÝÂ¸¤·¤Þ¤·¤¿¡£", 150, 300);
+	}
+}
+
+function nonSelectable(){
+	//
+	// Internet Explorer DHTML
+	// selection object -> empty method
+	// 
+	// ÁªÂò¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
+	if (document.selection && document.selection.empty) {
+		document.selection.empty();
+	}
+}
+
+/* onload */
+sidefunc_order_body_onload = function() {
+	// ¥µ¥¤¥É¥Ð¡¼ÊÂ¤ÓÂØ¤¨¥Ñ¥Í¥ë¤Î½é´ü²½
+	resizeBox();
+	SFDragManager.onload();
+	showUpdatedMessage();
+
+	
+	document.onkeydown = access_key_onkeydown_hock;
+}
+
+// invoked by document.onkeydown: Cntl + s
+function execSave()
+{
+	document.SidefuncOrderForm ? document.SidefuncOrderForm.submit() : void(0);
+}
+
+function resizeBox()
+{
+	var divs_ids = Array("out_box", "DISABLE", "in_box", "LEFT", "RIGHT");
+	var div = null;
+	var nBoxiesHeight = (BoxConfig.height + BoxConfig.padding) * 4;
+	nBoxiesHeight = (nBoxiesHeight < MIN_BOXIES_HEIGHT ? MIN_BOXIES_HEIGHT : nBoxiesHeight);
+		
+	
+	for (var i = 0; i < divs_ids.length; i++) {
+		div = XBSLayer.makeLayer(divs_ids[i]);
+		div.setHeight(div.getHeight() + nBoxiesHeight);
+	}
+}	
+	
+UtilKit.addhook(window, 'onload', sidefunc_order_body_onload);
+
+//-->
+</SCRIPT>
+
+      <TABLE class=sidebodybox onmousemove=nonSelectable(); height=400 cellSpacing=0 cellPadding=10 width=620 border=0>
+        <TBODY>
+		<TR>
+        <FORM name=SidefuncOrderForm action="./test.php" method=post><INPUT type=hidden name=isUpdated> 
+          <TD vAlign=top align=middle><BR>
+            <TABLE onmousemove=nonSelectable(); cellSpacing=0 cellPadding=0 
+            width=450 border=0>
+              <TBODY>
+              <TR>
+                <TD width=140>
+                  <DIV id=out_box 
+                  style="BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-LEFT: #000 1px solid; WIDTH: 140px; BORDER-BOTTOM: #000 1px solid; POSITION: relative; HEIGHT: 52px">
+                  <DIV class=normalfont 
+                  style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; BACKGROUND: #eee; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #000 1px solid" 
+                  align=center>»ÈÍÑ¤·¤Ê¤¤¥Ñ¡¼¥Ä</DIV>
+                  <DIV id=DISABLE 
+                  style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; LEFT: 4px; BORDER-LEFT: #ccc 1px solid; WIDTH: 130px; BORDER-BOTTOM: #ccc 1px solid; POSITION: relative; TOP: 4px; HEIGHT: 20px; BACKGROUND-COLOR: #ffffee"></DIV></DIV></TD>
+                <TD width=10><IMG height=1 src="files/spacer.gif" 
+                  width=10></TD>
+                <TD width=350>
+                  <DIV id=in_box 
+                  style="BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-LEFT: #000 1px solid; WIDTH: 350px; BORDER-BOTTOM: #000 1px solid; POSITION: relative; HEIGHT: 52px">
+                  <DIV class=normalfont 
+                  style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; BACKGROUND: #eee; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #000 1px solid" 
+                  align=center>»ÈÍÑ¤¹¤ë¥Ñ¡¼¥Ä</DIV>
+                  <DIV id=LEFT 
+                  style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; LEFT: 4px; BORDER-LEFT: #ccc 1px solid; WIDTH: 130px; BORDER-BOTTOM: #ccc 1px solid; POSITION: absolute; TOP: 26px; HEIGHT: 20px; BACKGROUND-COLOR: #eaf2ff"></DIV>
+                  <DIV id=RIGHT 
+                  style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; RIGHT: 4px; BORDER-LEFT: #ccc 1px solid; WIDTH: 130px; BORDER-BOTTOM: #ccc 1px solid; POSITION: absolute; TOP: 26px; HEIGHT: 20px; BACKGROUND-COLOR: #eaf2ff"></DIV></DIV></TD></TR></TBODY></TABLE><BR>
+            <DIV id=checkline 
+            style="VISIBILITY: hidden; WIDTH: 130px; POSITION: absolute; HEIGHT: 1px">
+            <HR color=#ff5555>
+            </DIV>
+            <DIV id=f0 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>ºÇ¿·¥³¥á¥ó¥È </DIV><INPUT type=hidden value=4 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=ºÇ¿·¥³¥á¥ó¥È name=sidefuncName> <INPUT type=hidden 
+            value=0 name=order> <INPUT type=hidden value=0 name=position> 
+            <DIV id=f1 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>ºÇ¿·¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ </DIV><INPUT type=hidden value=5 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=ºÇ¿·¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ name=sidefuncName> <INPUT type=hidden 
+            value=1 name=order> <INPUT type=hidden value=0 name=position> 
+            <DIV id=f2 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>RSS¥¢¥¤¥³¥ó </DIV><INPUT type=hidden value=9 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=RSS¥¢¥¤¥³¥ó name=sidefuncName> <INPUT type=hidden 
+            value=1 name=order> <INPUT type=hidden value=1 name=position> 
+            <DIV id=f3 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>¥µ¥¤¥É¥á¥Ë¥å¡¼ </DIV><INPUT type=hidden value=10 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=¥µ¥¤¥É¥á¥Ë¥å¡¼ name=sidefuncName> <INPUT type=hidden 
+            value=0 name=order> <INPUT type=hidden value=1 name=position> 
+            <DIV style="MARGIN: 20px 0px" align=center><INPUT class=button type=submit value=¡¡ÊÝ¡¡Â¸¡¡></DIV></TD></FORM></TR></TBODY></TABLE></A></TD></TR>
+</TBODY></TABLE>
+</TD></TR></TBODY></TABLE></BODY></HTML>
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/style.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/style.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/style.js	(revision 1328)
@@ -0,0 +1,23 @@
+
+var d = document;
+var n = navigator;
+var Mac = n.appVersion.indexOf('Mac');
+var MSIE = n.userAgent.indexOf('MSIE');
+var Safari = n.userAgent.indexOf('Safari');
+var Netscape = n.userAgent.indexOf('Netscape');
+var css = null;
+	
+if(Mac>-1){
+	if((Safari>1)||(MSIE>1)){
+		css = 'mac-webkit.css';
+	}else{
+		css = 'mac.css';
+	}
+}else{
+	if(MSIE>1){
+		css = 'win-ie.css';
+	}else{
+		css = 'win.css';
+	}
+}
+d.write('<link rel="stylesheet" href="/drecomcms/css/' + css + '" type="text/css">\n');
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/popup.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/popup.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/popup.js	(revision 1328)
@@ -0,0 +1,73 @@
+/*
+ * PopUp for tooltip
+ *
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+var POPUP_ID       = 'popup';
+var POPUP_HTML     = '<div id="'+POPUP_ID+'" class="popup" align="left"></div>';
+
+var POPUP_OFFSET   = 15;
+// div Ìå«³ªÂÏÌ½ßAXBSLayer.LEFT_TOP µ©wèÅ«Ü¹ñ
+var POPUP_POSITION = XBSLayer.LEFT_TOP; // |bvAbvÌ¶ãª}EXÊu
+
+var gPopUpLayer = null;
+
+
+/**
+ * |bvAbvð\¦·éÖ
+ * 
+ * @param theEvent CxgIuWFNgiK{j
+ * @param text |bvAbvÉ\¦·éàeiK{j
+ *
+ * @param offsetX XûüÉ±Ì£¾¯CxgÌÊu©ç£·iIvVj
+ * @param offsetY YûüÉ±Ì£¾¯CxgÌÊu©ç£·iIvVj
+ * @param axisType |bvAbvÌæÌ¸_Ì¤¿AÇêðîÉ\¦·é©BiIvVj
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP     ¶ã¸_ðî</li>
+ * <li>XBSLayer.LEFT_BOTTOM  ¶º¸_ðî</li>
+ * <li>XBSLayer.RIGHT_TOP    Eã¸_ðî</li>
+ * <li>XBSLayer.RIGHT_BOTTOM Eº¸_ðî</li>
+ * </ul>
+ * 
+ */
+function showPopup(theEvent, text, axisType, offsetX, offsetY)
+{
+	var position;
+	var x, y;
+	
+	if (null == gPopUpLayer) {
+		gPopUpLayer = XBSLayer.makeLayer(POPUP_ID);
+	}
+	gPopUpLayer.setInnerHTML(text);
+	
+	if (axisType == null) {
+		axisType = POPUP_POSITION;
+	}
+	if (offsetX == null) {
+		offsetX = POPUP_OFFSET;
+	}
+	if (offsetY == null) {
+		offsetY = POPUP_OFFSET;
+	}
+	
+	gPopUpLayer.popUpAtEventLocation(theEvent, axisType, offsetX, offsetY);
+}
+
+/**
+  * hidePopup()
+  * 
+  * C[Å|bvAbvð\¦·éÖ
+  */
+function hidePopup(e) 
+{
+	if (gPopUpLayer != null) {
+		gPopUpLayer.setVisible(false);
+	}
+}
+// |bvAbvp html ðoÍµÄ¨­
+document.write(POPUP_HTML);
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/common.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/common.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/common.js	(revision 1328)
@@ -0,0 +1,467 @@
+/*
+ * ¤Ê JavaScript
+ *
+ *
+ * Copyright (c) 2003 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * uEUæÊÌæÌðæ¾
+ */
+function getWidth(win)
+{
+	var tmp_width;
+    
+	if (win.document.documentElement) { 
+		tmp_width = win.document.documentElement.clientWidth;
+		if (tmp_width > 0) {
+			return tmp_width;
+		}
+	}
+    if (win.document.all) {
+    	tmp_width = win.document.body.clientWidth;
+		return tmp_width;
+	}
+	return win.innerWidth;
+}
+       
+/**
+ * uEUæÊÌæÌ³ðæ¾
+ */
+function getHeight(win)
+{
+	var tmp_height;
+    
+	if (win.document.documentElement) {
+		tmp_height = win.document.documentElement.clientHeight;
+		if (tmp_height > 0) {
+			return(tmp_height);
+		}
+	}
+    if (win.document.all) {
+		return(win.document.body.clientHeight);
+	}
+	return(win.innerHeight);
+}
+
+/**
+ * WindowðSÉÚ®
+ */
+function moveWindowToCenter(win) {
+	x = (screen.width  - getWidth(win)) / 2;
+	y = (screen.height - getHeight(win)) / 2;
+	win.moveTo(x,y);
+}
+
+/**
+ * íÉèOÉ\¦·éEBhEðJ­
+ */
+function openModalWindow(url, name, height, width, scrollbars, resizable, status)
+{
+	ModalWindow = openWindow(url, name, height, width, scrollbars, resizable, status);
+	onfocus = function onFocus(){
+		if (null !=ModalWindow && !ModalWindow.closed) {
+			try {
+				ModalWindow.focus();
+			} catch(e) {
+				document.onmousemove = null;
+			}
+		} else {
+			document.onmousemove = null;
+		}
+	}
+	
+	document.onmousemove = onfocus;
+	
+	return ModalWindow;
+}
+
+/**
+ * EBhEðJ­
+ */
+function openWindow(url, name, height, width, scrollbars, resizable, status, left, top)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					((left) ? ",left=" + left : "") + ((top) ? ",top=" + top : "") +
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status;
+
+	subWindow = window.open(url, name, window_condition);
+	// |bvAbvubJ[ÈÇÅubN³ê½êÉJavaScriptG[ÉÈçÈ¢æ¤É
+	if (subWindow) {
+		subWindow.focus();
+	}
+
+	return subWindow;
+}
+
+/**
+ * EBhEðãëÉJ­
+ */
+function openWindowBack(url, name, height, width, scrollbars, resizable, status)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status +
+					",left=" + window.screen.width;
+	subWindow = window.open(url, name, window_condition);
+	subWindow.blur();
+	window.focus();
+	subWindow.moveTo(0,0);
+	return subWindow;
+}
+
+/**
+ * EscL[ÅEBhEðÂ¶éCxg
+ * 
+ * ¦TuEBhEÌonloadÅ
+ *   document.body.onkeypress = subwinCloseOnEsc;
+ * Ìæ¤ÉgÁÄ­¾³¢B
+ */
+function subwinCloseOnEsc(ev)
+{
+	ev || (ev = window.event);
+	if (ev.keyCode == 27) {
+		window.close();
+		return false;
+	}
+	return true;
+}
+
+
+
+// 2004-06-09 Takanori Ishikawa 
+// -----------------------------------------------------------
+// htmlAlert(), htmlConfirm() Í html ð»ÌÜÜ
+// oÍ¹¸ATj^CY·éæ¤Éµ½B
+
+// sanitize html message
+function sanitize_msg(msg)
+{
+	msg = msg.replace(/</g, '&lt;');
+	msg = msg.replace(/>/g, '&gt;');
+	msg = msg.replace(/&lt;br\s*&gt;/g, '<br>');
+
+	return msg;
+}
+// alert
+function htmlAlert(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	msg = sanitize_msg(msg);
+	
+	if (defined(window.showModalDialog)) {
+		showModalDialog("/drecomcms/html/message_box.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+  	} else {
+		dialogArguments = msg;
+		ModalWindow = open("/drecomcms/html/message_box.html", "sub_alert","height=" + height + ",width=" + width + 
+					",scrollbars=no,resizable=no,toolbar=no,status=no,alwaysRaised=yes");
+		onfocus = function onFocus(){
+			if (null !=ModalWindow && !ModalWindow.closed) {
+				ModalWindow.focus();
+			}
+		}
+		document.onmousemove = onfocus;
+		return ModalWindow;
+	}
+}
+// confirm
+function htmlConfirm(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	if (defined(window.showModalDialog)) {
+		var value = showModalDialog("/drecomcms/html/confirm.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+		if (typeof value == "undefined") {
+			value = false;
+		} 
+		return value;
+	} else {
+		return window.confirm(msg.replace(/<br[^>]*\/?>/, '\n'));
+	}
+}
+
+/**
+  * júðæ¾·éÖ
+  * year:  N
+  * month: 
+  * day:   ú
+  */
+function getDayOfWeek(year, month, day) {
+
+	DateOfWeek	= new Date();
+	DateOfWeek.setYear(year);
+	DateOfWeek.setMonth(month - 1);
+	DateOfWeek.setDate(day);
+	day_of_week_number	= DateOfWeek.getDay();
+
+	days = new Array('ú','','Î','
+','Ø','à','y');
+	return days[day_of_week_number];
+}
+
+
+// -----------------------------------------------------------
+// |[^Awb_
+// -----------------------------------------------------------
+/**
+ * INPUT FORM ÌwiFÏX
+ */
+function focusForm(obj,flag){
+	if (obj == null || obj.style == null) {
+		return;	
+	}
+	obj.style.backgroundColor = flag ? '#FFFFCC' : '#FFFFFF' 
+}
+function Skinup(fnr){
+	win = window.open('/contents/skinpop_'+fnr,'skin','width=455,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
+	win.focus();
+}
+function imgSwap(name,gifPath) {
+	document.images[name].src = gifPath ;
+}
+
+
+// -----------------------------------------------------------
+// æ
+// -----------------------------------------------------------
+/**
+ * æÌ\¦TCY²®
+ */
+function adjustImageSize(imgElementName, widthMax, heightMax) {
+	var imgs = document.getElementsByName(imgElementName);
+	if (imgs) {
+		if (!imgs.length) {
+			if (widthMax && imgs.width > widthMax) {
+				imgs.height = imgs.height * widthMax / imgs.width;
+				imgs.width = widthMax;
+			}
+			if (heightMax && imgs.height > heightMax) {
+				imgs.width = imgs.width * heightMax / imgs.height;
+				imgs.height = heightMax;
+			}
+		} else {
+			for (i=0; i<imgs.length; i++) {
+				if (widthMax && imgs[i].width > widthMax) {
+					imgs[i].height = imgs[i].height * widthMax / imgs[i].width;
+					imgs[i].width = widthMax;
+				}
+				if (heightMax && imgs[i].height > heightMax) {
+					imgs[i].width = imgs[i].width * heightMax / imgs[i].height;
+					imgs[i].height = heightMax;
+				}
+			}
+		}
+	}
+}
+
+/**
+ * {¶ÌHTML\[XæèOæURL("http://`")ðPickUp
+ */
+function getExternalImageList(orgHtml) {
+
+	var extImageList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+	
+	exp = new RegExp("<img [^>]*src=[\"']?http://[^\"']*[\"']?[^>]*>", 'ig');
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("src=[\"']?");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp("[\"'\\s>]|/>");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+				
+				var isExist = false;
+				for (var j = 0; j < extImageList.length; j++) {
+					if (extImageList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extImageList[n++] = str; }
+			}
+		}
+	}
+	return extImageList;
+}
+
+/**
+ * {¶ÌHTML\[XæèOFlashURL("http://`")ðPickUp
+ */
+function getExternalFlashList(orgHtml) {
+
+	var extFlashList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+
+	var flashTag = "\\{\\\$CMSInclude [^\\\$\\}]*name=\"flash\"\\s*param=\"[^\"]*Movie=http://[^\"]*\"\\s*\\\$\\}";	
+	exp = new RegExp(flashTag, 'ig');	
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("Movie=");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp(";");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+
+				var isExist = false;				
+				for (var j = 0; j < extFlashList.length; j++) {
+					if (extFlashList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extFlashList[n++] = str; }
+			}
+		}
+	}
+	return extFlashList;
+}
+ 
+/**
+ * NÌJÚæð³øÉ·éB
+ * i<a>^OÌhref®«ð"javascript:void(0)"Éu·j
+ */
+function replaceLinkInvalid(html) {
+	html = html.replace(/<a [^>]*>/ig, '<a href="javascript:void(0);">');
+	html = html.replace(/openPermLink\([^)]*\)/ig, 'void(0)');
+	return html;
+}
+
+/**
+ * URLpÌGXP[vðs¢Ü·B
+ * '&' -> '&amp;'
+ * '>' -> '&gt;'
+ * '<' -> '&lt;'
+ * '"' -> '&quot;'
+ * ¼[ÌóÍ Trim
+ * ' ' -> '%20'
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ escapeUrl(/*: String :*/ src) {
+	var s = replaceAll(src, '&', '&amp;');
+	s = replaceAll(s, '>', '&gt;');
+	s = replaceAll(s, '<', '&lt;');
+	s = replaceAll(s, '"', '&quot;');
+	s = trim(s);
+	s = replaceAll(s, ' ', '%20');
+	return s;
+}
+function /*: String :*/ escapeScript(/*: String :*/ src) {
+	var s = replaceAll(src, "\\", "\\\\");
+	s = replaceAll(s, "'", "\\'");
+	s = replaceAll(s, "\"", "\\\"");
+	return s;
+}
+/**
+ * ¶ñÌSu·ðs¢Ü·B
+ * @param src ÎÛ¶ñ
+ * @param oldc ¶ñ
+ * @param newc V¶ñ
+ */
+function /*: String :*/ replaceAll(/*: String :*/src, /*: String :*/oldc, /*: String :*/newc) {
+ var h = "";
+ var b = src;
+ var index = 0;
+ while (true) {
+  index = b.indexOf(oldc, 0);
+  if (index == -1) {
+   break;
+  }
+  src = b.replace(oldc, newc);
+  h += src.substring(0, index + newc.length);
+  b = src.substring(index + newc.length, src.length);
+ }
+ return h + b;
+}
+/**
+ * ¼[Ì¼p/SpXy[Xðæè«Ü·B
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ trim(/*: String :*/src ) {
+	var s = trimR(src);
+	return trimL(s);
+}
+/**
+ * E[Ì¼p/SpXy[Xðæè«Ü·B
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ trimR(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(strFinal.length - 1, strFinal.length) == " ") || (strFinal.substring(strFinal.length - 1, strFinal.length) == "@")) {
+			strFinal = strTemp.substring(0, strTemp.length - (nLoop + 1));
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+/**
+ * ¶[Ì¼p/SpXy[Xðæè«Ü·B
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ trimL(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(0, 1) == " ") || (strFinal.substring(0, 1) == "@")) {
+			strFinal = strTemp.substring(nLoop + 1, strTemp.length );
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+
+/**
+ * p³
+ */
+function extend(subClass, superClass) {
+    for (var prop in superClass.prototype) {
+        subClass.prototype[prop] = superClass.prototype[prop];
+    }
+}
+
+
+/**
+ * |bvAbvubJ[Îô
+ * window.onPopupBlocked,window.onPopupNonBlockedðI[o[ChµÄ­¾³¢B
+ */
+window.onPopupBlocked = function(){
+	alert('EBhEðJ¯Ü¹ñÅµ½B|bvAbvubJ[ðLøÉµÄ¢éêÍA³øÉµÄ­¾³¢B');
+};
+
+window.onPopupNonBlocked = function(){}
+
+if (typeof window.org_open == 'undefined'){
+	window.org_open = window.open;
+	window.open = function() {
+		var win = (2 == window.open.arguments.length)
+					? window.org_open(window.open.arguments[0], window.open.arguments[1])
+					: window.org_open(window.open.arguments[0], window.open.arguments[1], window.open.arguments[2]);
+		if (null == win) {
+			window.onPopupBlocked(window.open.arguments);
+		} else {
+			window.onPopupNonBlocked(window.open.arguments);
+		}
+		return win;
+	}
+}
+
+
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/access_key.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/access_key.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/access_key.js	(revision 1328)
@@ -0,0 +1,51 @@
+/*
+ * Access Key Utilities
+ *
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * Û¶V[gJbgðLøÉ·é©Ç¤©B
+ * V[gJbgæèàæÉAuEUÌÛ¶_CAOªoéêÍ³øÉ·éB
+ * 
+ * @return Û¶V[gJbgðLøÉ·é©Ç¤©
+ */
+function shortCutSupported()
+{
+	return (document.all != null && null == XBSUtil.opera);
+}
+
+function access_key_onkeydown_hock(theEvent) 
+{
+	if (false == shortCutSupported()) {
+		return true;
+	}
+
+	if (theEvent == null) {
+		theEvent = window.event;
+	}
+	var willCancel = false;
+	var k = XBSEvent.getKeyCode(theEvent);
+	var m = XBSEvent.getModifierFlags(theEvent);
+	if (m & XBSEvent.CONTROL_KEY_MASK){
+		if (k == 83) {  // 's'
+			execSave != null ? execSave() : void(0);
+			willCancel = true;
+		}
+	} else if (m & XBSEvent.ALT_KEY_MASK){
+		if (k == 80) {  // 'p'
+			execPrint != null ? execPrint() : void(0);
+			willCancel = true;
+		}
+	}
+	if (willCancel) {
+		theEvent.returnValue = false;
+		return false;
+	}
+	
+	return true;
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/sidefunc_order.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/sidefunc_order.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/sidefunc_order.js	(revision 1328)
@@ -0,0 +1,1021 @@
+/**
+ * 
+ * TCho[ÒW JavaScript
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+
+//---------------------------------------------------------------------------------
+// Ýè
+//---------------------------------------------------------------------------------
+
+// *** úÝèÏ *** //
+
+var gSidefuncOrderForm = null;
+var SIDEFUNC_ORDER_FORM_NAME = "SidefuncOrderForm";
+
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+//
+// Mac Ì IE5 ÍÀWÖAÌ@\i¾¯¶áÈ¢¯ÇjÌ½­ª¶ÁÄ¢é
+// ÌÅKÉÎ
+//
+// QlF
+// Mac ÌH¦È¢ìYÇà
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+var MAC_IE5_PITCH_X;
+var MAC_IE5_PITCH_Y;
+
+MAC_IE5_PITCH_X = MAC_IE5_PITCH_Y = 0;	/* BITCH */
+if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+	MAC_IE5_PITCH_X = -10;
+	MAC_IE5_PITCH_Y = 0;
+}
+
+
+// *** CheckLine *** //
+var CHECKLINE_ID = 'checkline';
+
+
+// --- Panel ---
+// ¯Êq
+var PANEL_NAME_DISABLE	= 'DISABLE';	// O@\BOXÌID
+var PANEL_NAME_LEFT		= 'LEFT';		// àE¶@\BOXÌID
+var PANEL_NAME_RIGHT	= 'RIGHT';		// àEE@\BOXÌID
+
+//·×ÄÌ Panel ðvpeBÉàÂIuWFNg
+// key Í name
+var gAllPanels         = new Object();
+
+// ¶©çÌÔ
+var gPanelNames         = [PANEL_NAME_DISABLE, PANEL_NAME_LEFT, PANEL_NAME_RIGHT];
+
+
+// --- Box ---
+var BOX_ID_PREFIX 		= 'f';			// Box Ì ID vtBbNX
+var BoxConfig = {
+	width: 		120,	// Box 
+	height: 	20,		// Box ³
+	padding: 	10,		// Box ÔÌXy[X
+	marginTop: 	5,		// êÔãÌBoxÆeplÆÌXy[X
+	marginLeft: 5		// Box ÆeplÌ¶¤ÌXy[X
+};
+
+// Box zuÌæÌÅ¬³
+var MIN_BOXIES_HEIGHT	= 200;
+
+// ·×ÄÌ Box ðvpeBÉàÂIuWFNg
+var gAllBoxes           = new Object();
+
+/**
+ * plÉi[Å«éÅå Box ðL^µ½IuWFNg
+ * 
+ * key: pl¼ value: plÉi[Å«éÅå Box 
+ * 
+ */
+
+BoxConfig.maxNBoxes = new Object();
+BoxConfig.maxNBoxes[PANEL_NAME_DISABLE]	= OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES;	// ugpµÈ¢@\v
+BoxConfig.maxNBoxes[PANEL_NAME_LEFT]	= OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES;		// ugp·é@\v¶
+BoxConfig.maxNBoxes[PANEL_NAME_RIGHT]	= OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES;		// ugp·é@\vE
+
+/**
+ * y[WÇÝÝÌzuf[^
+ */
+gInitialBoxPositionsData = null;
+
+//---------------------------------------------------------
+// zuÈÇ
+//---------------------------------------------------------
+/**
+ * HTML Ì hidden input vf©çÚÌzuÈÇÌîñðÇÝæéIuWFNg
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+SFSettings = new Object();
+
+/**
+ * HTML Ì hidden input vf©çÝèlðÇÝæé
+ */
+SFSettings.loadBoxPositions = function()
+{
+	var positions = new Object();
+	var orders       = new Array();
+	var panelNames   = new Array();	
+	
+	// hidden©çbox_positionðæ¾
+	positions[PANEL_NAME_DISABLE]	= new Array();
+	positions[PANEL_NAME_LEFT]		= new Array();
+	positions[PANEL_NAME_RIGHT]		= new Array();
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			var idx = XBSUtil.parseIntNoError(elem.value);
+			panelNames[panelNames.length] = gPanelNames[idx];
+		} else if (Box.ID_PROPERTY_NAME == elem.name) {
+			;
+		}
+	}
+	for (var i = 0; i < orders.length; i++) {
+		var pnm = panelNames[i];
+		var bid = i;
+		var ord = orders[i];
+		
+		positions[pnm][bid] = ord;
+	}
+	
+	orders     = null;
+	panelNames = null;
+	return positions;
+}
+
+/**
+ * »ÝÌóÔðPêÌIuWFNgÉGR[hµÄÔ·B
+ */
+SFSettings.getObjectForPersistent = function()
+{
+	var orders = new Array();
+	var pidxes = new Array();
+	var result = '';
+	
+	if (gSidefuncOrderForm == null) {
+		return result;
+	}
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			pidxes[pidxes.length] = XBSUtil.parseIntNoError(elem.value);
+		}
+	}
+	result += pidxes.join('');
+	result += orders.join('');
+	pidxes = null;
+	orders = null;
+	
+	return result;
+}
+
+//---------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------
+/**
+ * TCho[ÌÏXðÄ·éIuWFNg
+ * ContentsChangedListener ÌTuNX
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+function SFChangedListener(/* Optional */ aName) /* extends ContentsChangedListener */
+{
+}
+SFChangedListener.prototype = new ContentsChangedListener();
+SFChangedListener.prototype.setChanged = function(b) 
+{
+	var persistent = SFSettings.getObjectForPersistent();
+	
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// ±±Å prototype Ì\bhðÄÑoµÄà¤Ü­¢©È¢B
+
+	this.changed = (gInitialBoxPositionsData != persistent);
+}
+
+//---------------------------------------------------------
+// Drag & Drop: SFDragManager (Sidebar Function DragManager)
+//---------------------------------------------------------
+/**
+ * hbOÌLø»ArÌóÔðÛ·é½ßÌIuWFNg
+ * hbOÍêxÉÐÆÂµ©N±çÈ¢ÌÅA¢ÜÌÆ±ë
+ * Singleton ÆµÄÀ
+ * 
+ * For example:
+ * <pre>
+ * // prepare for dragging, enable event handler.
+ * SFDragManager.enableEventHandler();
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+SFDragManager = new Object();
+
+// *** Event Handler *** //
+SFDragManager.ondrop = null;  // zuªÏX³ê½
+
+
+// hbOÉp·é document ÌCxgnhðÝè
+SFDragManager.enableEventHandler = function ()
+{
+	document.onmousemove = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.moveBox(e);
+	};
+	
+	document.onmouseup = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.downBox(e);
+	};
+	
+	for (var key in gAllBoxes) {
+		var box = gAllBoxes[key];
+		var src = box ? box.getHTMLElement() : null;
+		
+		if (src != null) {
+			src.onmousedown = SFDragManager.pickUpBox;
+		}
+	}
+}
+
+// hbOÉp·é document ÌCxgnhðð
+SFDragManager.disbleEventHandler= function()
+{
+	document.onmousemove	= '';
+	document.onmouseup		= '';
+}
+
+
+//hbOÌIuWFNg
+
+SFDragManager.destination = null;	/* Ú®æ Panel */
+SFDragManager.source      = null;	/* Ú®³ Panel */
+SFDragManager.box         = null;	/* hbOÌ Panel */
+
+/**
+ * TCho[ÚÌÏXðÄ·éIuWFNgðÔ·B
+ */
+SFDragManager.getChangedListener = function()
+{
+	if (SFDragManager.getChangedListener.$instance == null) {
+		
+		SFDragManager.getChangedListener.$instance = 
+			new SFChangedListener("[Sidebar Function Order]");
+	}
+	return SFDragManager.getChangedListener.$instance;
+}
+SFDragManager.setUpContentsChangedListener = function()
+{
+	// 2004-04-23  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// TCho[ÌzuªÏX³ê½©Ç¤©ðL^
+	
+	var listener = SFDragManager.getChangedListener();
+	
+	listener.listenEvent(SFDragManager, 'ondrop');
+	OEMBlogGlobal.watchOtherLinks(document, listener);
+}
+
+/**
+  * setOnLoad()
+  *
+  * y[WÇÝÝÌú
+  */
+SFDragManager.loaded = false;
+SFDragManager.onload = function() 
+{
+	// tH[ú»
+	gSidefuncOrderForm = UtilKit.getPropertyNotNull(document, SIDEFUNC_ORDER_FORM_NAME);
+	
+	// e Panel, Box IuWFNg¶¬
+	var boxPositions = SFSettings.loadBoxPositions();
+	gInitialBoxPositionsData = SFSettings.getObjectForPersistent();
+	for (var i = 0; i < gPanelNames.length; i++) {
+		var nm = gPanelNames[i];
+		var panel;
+		
+		panel = new Panel(nm, boxPositions[nm]);
+		
+		for(var key in panel.box_position) {
+			gAllBoxes[key] = new Box(key);
+		}
+		
+		// Box Ìúzu
+		panel.setBoxPosition();
+		Panel[nm] = panel;
+		
+		gAllPanels[nm] = panel;
+	}
+	
+	
+	// hbOÌõ
+	SFDragManager.setUpContentsChangedListener();
+	SFDragManager.enableEventHandler();
+	
+	// onload àCxg
+	resetPositionsInEventHandler();
+	window.onresize = resetPositionsInEventHandler;
+	
+	SFDragManager.loaded = true;
+	// 2004-04-20  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// Opera ÅÍ onload _ÅC[ÌÄ`æªÔÉíÈ¢B
+	// ±ÌÖðgÁÄA³âèÄ`æ·éB
+	if (window.opera) {
+		SFDragManager.loaded = false;
+		setTimeout("refreshDisplay()", 0.8*1000);
+	}
+	
+}
+
+
+//---------------------------------------------------------
+// Cxg
+//---------------------------------------------------------
+// CheckLine
+/**
+ *  hbOÌ Box ª}ü³êéÓðwµ¦·½ßÌC 
+ *
+ * @return XBSLayer
+ * @see xbs.js 
+ */
+function getCheckLineLayer()
+{
+	if (null == getCheckLineLayer.layer) {
+		getCheckLineLayer.layer = XBSLayer.makeLayer(CHECKLINE_ID);
+	}
+	return getCheckLineLayer.layer;
+}
+function getPanelAtPosition(x, y)
+{
+	var panel = null;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+			
+		if (x > panel.panel_section['left']  &&
+			x < panel.panel_section['right'] &&
+			y > panel.panel_section['top']   &&
+			y < panel.panel_section['under']) 
+		{ break; }
+	}
+	return panel;
+}
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+// Mac IE ÅÍCxgnhÌÅÀWÖWÌìðs¤Æ¤Ü­¢©È¢ÌÅ
+// ·±µxç¹ÄÀs
+function resetPositionsInEventHandler()
+{
+	if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+		setTimeout("resetPositions()", 1*1000);	
+	} else {
+		resetPositions();
+	}
+}
+
+// *** Reset *** //
+/**
+  * ·×ÄÌ Box ðÄzu
+  */
+function resetPositions() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setSections(); 
+			panel.setBoxPosition(); 
+		}
+	}
+}
+
+/**
+ * ·×ÄÌ Box ðêxÁµA·®É·×Ä\¦
+ */
+function refreshDisplay() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setBoxVisible(false);
+			panel.setBoxVisible(true);		
+		}
+	}
+	SFDragManager.loaded = true;
+}
+
+// -----------------------------------------------------------------
+// {bNXÌhbOhbv
+// -----------------------------------------------------------------
+
+/**
+  * pickUpBox()
+  * theEvent: Cxg
+  *
+  * Boxð¿ã°½(NbN³ê½)Ìð·éÖ
+  */
+SFDragManager.pickUpBox = function(theEvent) {
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	if (SFDragManager.box != null || SFDragManager.loaded == false)
+		return;
+	
+	// }EXÊuæ¾
+	var mouse_x	    = XBSEvent.getMouseX(theEvent);
+	var mouse_y	    = XBSEvent.getMouseY(theEvent);
+	var pickedPanel = getPanelAtPosition(mouse_x, mouse_y);
+
+	if (null == pickedPanel) 
+		return;
+
+	// Ið³ê½BoxÌÀÑÔÆ id ðæ¾
+	var beforeId = pickedPanel.orderIndexOfBoxAt(mouse_x, mouse_y);
+	var funcId	= UtilKit.getKeyForValue(pickedPanel.box_position, beforeId);
+	
+	if (null == funcId)
+		return;
+	
+	//BoxGgæ¾E
+	var selected = new XBSLayer(BOX_ID_PREFIX + funcId);
+	if (null == selected) 
+		return;
+
+	selected.setZIndex(selected.getZIndex() +1);
+
+	//Ið³ê½BoxÌX,YÀWðÛ¶
+	before_box_x	= selected.getX() + MAC_IE5_PITCH_X;
+	before_box_y	= selected.getY() + MAC_IE5_PITCH_Y;
+
+	//}EXÆBox´_Ì·
+	box_to_mouse_x	= mouse_x - before_box_x;
+	box_to_mouse_y	= mouse_y - before_box_y;
+	
+	// hbOJn
+	SFDragManager.box = selected;
+	SFDragManager.source = pickedPanel;
+	before_order_id = beforeId;
+	function_id = funcId;
+}
+
+
+/**
+ * 
+ * BoxðÚ®·éÖ
+ * 
+ * @param theEvent mousemove Cxg
+ */
+SFDragManager.moveBox = function(theEvent) {
+	var selected = SFDragManager.box;
+	
+	if (null == selected || SFDragManager.loaded == false)
+		return;
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	//
+	// hbOAEBhE©çoéZbgµÄIíé
+	//
+	if (false == Box.canMoveWithEvent(theEvent)) {
+		gAllBoxes[function_id].setPosition(before_box_x, before_box_y);
+		clearMove();
+		
+		return;
+	}
+
+	var mouse_x  = XBSEvent.getMouseX(theEvent);
+	var mouse_y  = XBSEvent.getMouseY(theEvent);
+	var curPanel = getPanelAtPosition(mouse_x, mouse_y);
+	if (null == curPanel) 
+		return;
+	
+	if (curPanel.canDropAtPosition(SFDragManager.source, selected, mouse_x, mouse_y)) {
+		// `FbNC\¦
+		curPanel.showCheckLineAtPosition(mouse_x, mouse_y);
+	}
+
+	//BoxÚ®
+	move_to_x = mouse_x - box_to_mouse_x;
+	move_to_y = mouse_y - box_to_mouse_y;
+	
+	selected.setLeftTopPosition(move_to_x, move_to_y);
+}
+
+
+
+/**
+ * Box ðºëµ½Ì
+ * 
+ * @param theEvent Cxg
+ */
+SFDragManager.downBox = function(theEvent)
+{
+	if (SFDragManager.loaded == false) {
+		return;
+	}
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// `FbNCðÁ·
+	getCheckLineLayer().setVisible(false);
+
+	// }EXÊuæ¾
+	var mouse_x = XBSEvent.getMouseX(theEvent);
+	var mouse_y = XBSEvent.getMouseY(theEvent);
+	
+	// -------------------------------------
+	// Ú®Ìæà©O©`FbN
+	// -------------------------------------
+	// Ú®æÌplðæ¾µAhbOîñðXV
+	// hbOOãÌpl
+	var beforePanel = SFDragManager.source;
+	var afterPanel  = getPanelAtPosition(mouse_x, mouse_y);
+	
+	SFDragManager.destination = afterPanel;
+	if (null == beforePanel) {
+		throw ASSERT_EXCEPTION + 'SFDragManager.source must be not null';
+	}
+	
+	var droppedBox = gAllBoxes[function_id];
+	var after_order_id = afterPanel.orderIndexOfMovingAt(mouse_x, mouse_y);
+	
+	// hbvÅ«È¢êABox ðßµÄAhbOðI¹·é
+	if (false == afterPanel.canDropAtPosition(beforePanel, droppedBox, mouse_x, mouse_y)) {
+		droppedBox.setPosition(before_box_x, before_box_y);
+		clearMove();
+		return;
+	}
+
+	// Ú®·éBoxðpl©çíµAÔð®·é
+	delete beforePanel.box_position[function_id];	
+	for (key in beforePanel.box_position) {
+		if (before_order_id < beforePanel.box_position[key]) {
+			--beforePanel.box_position[key];
+		}
+	}
+
+	//after_order_idÌ
+	if (!(beforePanel.equals(afterPanel) && before_order_id <= after_order_id)) {
+		++after_order_id;
+	}
+
+
+	// ÅåÌCfbNXðXV
+	if (after_order_id > afterPanel.getMaxOrderIndex() + 1) {
+		after_order_id = afterPanel.getMaxOrderIndex() + 1;
+	}
+
+	//}ü·éÔðÂ­èA}ü·é
+	for (key in afterPanel.box_position) {
+		if (after_order_id <= afterPanel.box_position[key]) {
+			++afterPanel.box_position[key];
+		}
+	}
+	afterPanel.box_position[function_id] = after_order_id;
+
+	//BoxÄzu
+	if (false == beforePanel.equals(afterPanel)) {
+		beforePanel.setBoxPosition();
+	}
+	afterPanel.setBoxPosition();
+
+	// HTMLÌhiddenlÏX
+	for (var nm in gAllPanels) {
+		var p = gAllPanels[nm];
+
+		for (key in p.box_position) {
+			gSidefuncOrderForm.elements['order'][key].value = p.box_position[key];
+			gSidefuncOrderForm.elements['position'][key].value = p.getPosition();
+		}
+	}
+
+	// Ú®Ìð
+	clearMove();
+	if (SFDragManager.ondrop != null && typeof SFDragManager.ondrop == 'function') {
+		SFDragManager.ondrop();
+	}	
+}
+
+
+/**
+  * clearMove()
+  *
+  * BoxÚ®ðI¹·éÖ
+  */
+function clearMove() {
+	var selected = SFDragManager.box;
+	
+	selected.setZIndex(selected.getZIndex() -1);
+	SFDragManager.box = null;
+}
+
+
+
+
+//---------------------------------------------------------------------------------
+// Panel
+//---------------------------------------------------------------------------------
+/**
+  * ÂXÌhbOÂ\ÈÚðÛ·éÌæ
+  * 
+  * ¢ÜÌÆ±ëA¶©çugpµÈ¢@\vugp·é@\E¶vugp·é@\EEv
+  *
+  * @param aPanelName    plÌ¼O
+  * @param aPositionArray BoxÌzuîñzñ
+  *
+  * @author Yusuke Saito
+  * @version 2003/10/10
+  * 
+  * @author Takanori Ishikawa
+  * @version 2004/04/20
+  */
+function Panel(aPanelName, aPositionArray)
+{
+	this.name			   = aPanelName;						// plÌ¼O(divÌid)
+	this.box_position	   = aPositionArray;					// BoxÌzuîñzñ
+	this.box_limit_number  = BoxConfig.maxNBoxes[aPanelName];	// plàÌÅåBox
+	
+	this.position = -1;
+	for (var i = 0; i < gPanelNames.length; i++) {
+		if (this.name == gPanelNames[i]) {
+			this.position = i;
+			break;
+		}
+	}
+	
+	// plE{bNXEÚ®ÌeÌæðÝè
+	this.setSections();
+}
+
+/**
+ * Box Ì Y offset
+ * 
+ * @param anIndex order index
+ */
+Panel.getBoxSectionOffsetY = function(anIndex)
+{
+	if (Panel.box_section_y == null) {  // Box ÊuÝè
+		var nboxs = BoxConfig.maxNBoxes[PANEL_NAME_DISABLE];
+		Panel.box_section_y = new Array(nboxs);
+		
+		for (var i = 0; i < nboxs; ++i) {
+			Panel.box_section_y[i] = (BoxConfig.height + BoxConfig.padding) * i + BoxConfig.marginTop;
+		}
+	}
+	return Panel.box_section_y[anIndex];
+}
+
+Panel.prototype.getPosition = function() {
+	return this.position;
+}
+
+/**
+ * description
+ */
+Panel.prototype.toString = function()
+{
+	return '[Panel] ' + this.name;
+}
+
+/**
+ * är
+ * 
+ * @param aPanel pl
+ */
+Panel.prototype.equals = function(aPanel)
+{
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// instanceof Í IE 6 Åà¢T|[g	
+	if (aPanel == null || /*false == (aPanel instanceof Panel)*/ typeof aPanel.name == 'undefined') {
+		return false;
+	}	
+	return this.name == aPanel.name;
+}
+
+
+/**
+  * setSections()
+  * 
+  * EBhEð´_Æµ½plÌSÓÌX,YÀWðÝè·éÖ
+  * left:¶ÓX right:EÓX top:ãÓY under:ºÓY
+  */
+Panel.prototype.setSections = function() {
+
+	// eC[ÌÊuæ¾
+	this.setUpPanelSections();
+
+	//BoxÌæÌÝè
+	this.setBoxSection();
+
+	//BoxÚ®æÌæÌÝè
+	this.setMoveSection();
+}
+
+
+/**
+  * setUpPanelSections()
+  * 
+  * EBhEð´_Æµ½plÌSÓÌX,YÀWðÝè·éÖ
+  * left:¶ÓX right:EÓX top:ãÓY under:ºÓY
+  */
+Panel.prototype.setUpPanelSections = function() 
+{
+	var psec    = new Object;
+	var lyer = XBSLayer.makeLayer(this.name);
+	
+	psec['left'] = MAC_IE5_PITCH_X; 
+	psec['top']  = MAC_IE5_PITCH_Y;
+	
+	psec['right'] = lyer.getWidth();
+	psec['under'] = lyer.getHeight();
+	while (lyer != null && lyer.isValid() && lyer.hasID()) {
+		
+		psec['left'] += lyer.getX();	
+		psec['top']  += lyer.getY();
+		lyer = lyer.getParent();
+	}
+	psec['right'] += psec['left'];
+	psec['under'] += psec['top'];
+
+	this.panel_section = psec;
+}
+
+/**
+  * setBoxSection()
+  * 
+  * BoxÌûÜéÌæðÝè·éÖ
+  * box_section[ÀÑÔ] => (left => ¶ÓX, right => EÓX, top => ãÓY, under => ºÓY)
+  */
+Panel.prototype.setBoxSection = function() {
+
+	//BoxÌæÌÝè
+	this.box_section_left_x		= this.panel_section['left'] + BoxConfig.marginLeft;
+	this.box_section_right_x	= this.box_section_left_x + BoxConfig.width
+
+	this.box_section			= new Array(this.box_limit_number);
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.box_section[i]				= new Array(4);
+		this.box_section[i]['left']		= this.box_section_left_x;
+		this.box_section[i]['right']	= this.box_section_right_x;
+		this.box_section[i]['top']		= Panel.getBoxSectionOffsetY(i) + this.panel_section['top'];
+		this.box_section[i]['under']	= this.box_section[i]['top'] + BoxConfig.height;
+	}
+}
+
+/**
+ * plÌÅêÔºÌ Box ÌCfbNXðÔ·
+ * 
+ * @return êÔºÌ Box ÌCfbNXB
+ */
+Panel.prototype.getMaxOrderIndex = function()
+{
+	var max = -1;
+	for(key in this.box_position) {
+		max = (max < this.box_position[key]) ? this.box_position[key] : max;
+	}
+	return Number(max);
+}
+
+/**
+ * wè³ê½ÊuÉÅàß¢ABox ð}üÂ\ÈÓÉ`FbNCð\¦·éB
+ * 
+ * @param x x ÀW
+ * @param y y ÀW
+ */
+Panel.prototype.showCheckLineAtPosition = function(x, y)
+{
+	if (typeof x != typeof 0 || typeof y != typeof 0) {
+		throw ASSERT_EXCEPTION + 'x or y arg';
+	}
+	
+	var moveOrderId   = this.orderIndexOfMovingAt(x, y);
+	var maxOrderIndex = this.getMaxOrderIndex();
+	
+	if (null == moveOrderId)
+		return;
+	
+	if (maxOrderIndex < moveOrderId) {
+		moveOrderId = maxOrderIndex;
+	}
+	if (moveOrderId < this.box_limit_number) {
+		// `FbNCÚ®
+		var check_line_left = this.panel_section['left'];
+		var check_line_top = this.move_section[moveOrderId]['top'];
+
+		// êU`FbNCðÁ·
+		getCheckLineLayer().setVisible(false);
+		getCheckLineLayer().setLeftTopPosition(check_line_left, check_line_top);
+		getCheckLineLayer().setVisible(true);
+	}
+}
+
+
+/**
+  * setMoveSection()
+  * 
+  * BoxðÚ®Å«éÌæðÝè·éÖ
+  * move_section[ÀÑÔ] => (left => ¶ÓX, right => EÓX, top => ãÓY, under => ºÓY)
+  */
+Panel.prototype.setMoveSection = function() {
+
+	//Ú®ÌæÌÝè
+	this.move_section_left_x	= this.panel_section['left'];
+	this.move_section_right_x	= this.move_section_left_x + BoxConfig.width + (BoxConfig.marginLeft * 2);
+	this.move_section			= new Array(this.box_limit_number + 1);
+
+	this.move_section[-1]			= new Array(4);
+	this.move_section[-1]['left']	= this.move_section_left_x;
+	this.move_section[-1]['right']	= this.move_section_right_x;
+	this.move_section[-1]['top']	= this.panel_section['top'] - 7;
+	this.move_section[-1]['under']	= this.panel_section['top'] + (BoxConfig.marginTop / 2) + BoxConfig.height;
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.move_section[i]			= new Array(4);
+		this.move_section[i]['left']	= this.move_section_left_x;
+		this.move_section[i]['right']	= this.move_section_right_x;
+		this.move_section[i]['top']		= this.move_section[i - 1]['under'];
+		this.move_section[i]['under']	= this.move_section[i]['top'] + BoxConfig.height + BoxConfig.padding;
+	}
+}
+
+
+
+Panel.prototype.canDropAtPosition = function(aSourcePanel, aBox, x, y)
+{
+	var orderIndex = this.orderIndexOfMovingAt(x, y);
+	var maxIndex = this.getMaxOrderIndex() + 1;
+
+	// pl©çOê½A
+	// plÌÅå Box ð´¦é = false
+	return (orderIndex != null && (this.equals(aSourcePanel) || this.box_limit_number > maxIndex));
+}
+
+/**
+ * Ú®A}ü³êéÓÌCfbNXðÔ·B
+ * 
+ * @param x x ÀW
+ * @param y y ÀW
+ * @return }ü³êéCfbNXAÈ¯êÎ null
+ */
+Panel.prototype.orderIndexOfMovingAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.move_section, x, y);
+}
+Panel.prototype.orderIndexOfBoxAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.box_section, x, y);
+}
+// private
+Panel.prototype.findOrderIndexOf_ = function(sectionDataArray, x, y)
+{
+	for (var i = -1; i < sectionDataArray.length; i++) {
+		var sec = sectionDataArray[i];
+		if (sec == null)
+			continue;
+		
+		if (x >= sec['left'] && x <= sec['right'] &&
+			y >= sec['top']  && y <= sec['under']) {
+	
+			return i
+		}
+	}
+	return null;
+}
+
+/**
+  * setBoxPosition()
+  *
+  * BoxðÄzu·éÖ
+  */
+Panel.prototype.setBoxPosition = function() {
+	for (key in this.box_position) {
+		gAllBoxes[key].setPosition(
+			this.panel_section['left'] + BoxConfig.marginLeft,
+			this.panel_section['top']  + Panel.getBoxSectionOffsetY(this.box_position[key]) );
+	}
+}
+
+Panel.prototype.setBoxVisible = function(flag)
+{
+	for (key in this.box_position) {
+		gAllBoxes[key].setVisible(flag);
+	}
+}
+
+
+
+//---------------------------------------------------------------------------------
+// Box
+//---------------------------------------------------------------------------------
+/**
+ * ÂXÌhbOÅÚ®Â\ÈÚ
+ * 
+ * @param anId HTML vfÌ id ®«
+ * 
+ * @author Yusuke Saito
+ * @version 2003/10/10
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/21
+ */
+function Box(anId)
+{	
+	this.uniqID     = anId;
+	this.srcElement = XBSLayer.getLayerImpById(BOX_ID_PREFIX + anId);
+
+	this.setUpSize();
+	this.x = this.y = 0;	
+}
+
+Box.prototype.getFormID = function() { return this.uniqID; }
+Box.prototype.getHTMLElement = function() { return this.srcElement; }
+
+/**
+ * HTML Ì hidden input vfÅn³êévpeBÌ¼O
+ */
+Box.POSITION_PROPERTY_NAME = "position";
+Box.ORDER_PROPERTY_NAME    = "order";
+Box.NAME_PROPERTY_NAME     = "sidefuncName";
+Box.AUTHOR_PROPERTY_NAME   = "authorCd";
+Box.ID_PROPERTY_NAME       = "sidefuncId";
+
+
+/**
+ * hbOÌÅÉÄÎêéB
+ * 
+ * @param theEvent mousemove
+ * @return hbOðLZ·éêÍAfalse ðÔ·B
+ */
+Box.MOVABLE_INSET = 5;	/* hL
+gÌ[ - Box.MOVABLE_INSET = hbOÂ\ÈÌæ */
+Box.canMoveWithEvent = function(theEvent) 
+{
+	// ÎIÈÊuªÙµ¢ÌÅAXBSDocument.getPageOffsetX/Y() ðø­
+	var mouse_x = XBSEvent.getMouseX(theEvent) - XBSDocument.getPageOffsetX();
+	var mouse_y = XBSEvent.getMouseY(theEvent) - XBSDocument.getPageOffsetY();
+	
+	if (mouse_x < Box.MOVABLE_INSET || mouse_y < Box.MOVABLE_INSET) {
+		return false;
+	}
+	
+	var maxX = XBSDocument.getWidth() - Box.MOVABLE_INSET;
+	var maxY = XBSDocument.getHeight() - Box.MOVABLE_INSET;
+	
+	if (mouse_x > maxX || mouse_y > maxY) {
+		return false;
+	}
+	
+	return true;
+}
+
+/**
+  * setUpSize()
+  * 
+  * BoxÌå«³ðÝè·éÖ
+  */
+Box.prototype.setUpSize = function() 
+{
+	var imp = this.getHTMLElement();
+	
+	// style.height ÅÈ¢Æ opera Å¤Ü­¢©È¢
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = BoxConfig.height;	
+		imp.style.width = BoxConfig.width;	
+	} else {
+		XBSLayer.setHeightWithLayerImp(imp, BoxConfig.height);
+		XBSLayer.setWidthWithLayerImp(imp, BoxConfig.width);
+	}
+	XBSLayer.setCursorWithLayerImp(imp, 'move');
+}
+
+/**
+  * BoxÌÊuðÝè
+  * 
+  * @param left x
+  * @param top  y
+  */
+Box.prototype.setPosition = function(left, top) 
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top);
+	this.x = left; this.y = top;
+}
+/**
+ * Box ÌÂ®«ðÝè
+ */
+Box.prototype.setVisible = function(flag)
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.setVisibilityWithLayerImp(imp, flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/xbs.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/xbs.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/drecomcms/xbs.js	(revision 1328)
@@ -0,0 +1,1466 @@
+/**
+ * XBS (Cross Browser Scripting) Utilities
+ *
+ * Copyright (c) 2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+//---------------------------------------------------------------------------------
+// Debugging 
+//---------------------------------------------------------------------------------
+/**
+ * Assertion É¸sµ½Æ«É±êð throw
+ */
+ASSERT_EXCEPTION = '*** Assertion Failur *** ';
+
+/**
+ * dprint, dinspect ÌoÍðXgbv·éÆ«Í true ÉÝè
+ */
+BLOCK_DEBUG_PRINT  = true;
+
+
+/**
+ * v ª undefined ÅÈ¯êÎ true
+ */
+function defined(v) { return (typeof v != 'undefined'); }
+
+/**
+ * IuWFNgÌ·×ÄÌvpeBð dprint ÖÅ\¦
+ * 
+ * @param IuWFNg
+ */
+function dinspect(anObj)
+{
+	if (null == anObj) return;
+	for (key in anObj) {
+		dprint(key + ": " + anObj[key]);
+	}
+
+}
+
+function dprint(obj)
+{
+	if (BLOCK_DEBUG_PRINT) {
+		return;
+	}
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("/drecomcms/js/Console.html", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+	}
+	
+	var t = dprint.window.document.getElementById('console');
+	
+	if (t != null) {
+		t.value = t.value + "\n> " + obj.toString();
+	}
+// Takanori Ishiakwa 04/04/06
+// -----------------------------------------
+// Safari â Opera Å¤Ü­®ìµÈ¢½ß
+// TextArea o[WÉØèÖ¦½
+/*
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+		dprint.window.document.open("text/plain");	
+	}
+	var d = dprint.window.document;
+	
+	if (d == null) return;
+
+	d.writeln("> " + obj.toString());
+	
+	// Opera: mime text/plain ðwèµÄà HTML ÆµÄðß
+	// ³êÄ¢éæ¤ÈÌÅAüs³¹é½ßÉ^OðoÍ
+	if (window.opera) d.writeln("<br>");
+*/
+}
+
+// ---------------------------------------------------------
+// XBSUtil
+// ---------------------------------------------------------
+// for the purpose of namespace
+/**
+ * uEUÝ·ðÚwµÄA[eBeBQðÜÆß½IuWFNg
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSUtil = new Object();
+
+/**
+ * vfðÜÞ document IuWFNgðÔ·B
+ * 
+ * @param document
+ */
+XBSUtil.getOwnerDocument = function(anElement) 
+{
+	if (anElement.document) {
+		return anElement.document;
+	} else if (anElement.ownerDocument) {
+		return anElement.ownerDocument;
+	}
+	return null;
+}
+
+
+/**
+ * Unicode code points collection
+ * 
+ * vOÅg¤¶R[hðWß½àÌ
+ * 
+ * @author Takanori Ishikawa
+ * @version 1.0
+ */
+XBSCType = new Object();
+
+// *** XBSCType ú» *** //
+// ú»e[u
+// key: property name
+// value: string (length must be 1)
+XBSCType.template_ = {
+	CR:    '\r',
+	LF:    '\n',
+	TAB:   '\t',
+	SPACE: ' ',
+	LT:    '<',
+	GT:    '>',
+	SLASH: '/',
+	COLON: ':',
+	AMP:   '&',
+	LBRACE:'{',
+	RBRACE:'}'
+};
+
+for (var key in XBSCType.template_) {
+	var c = XBSCType.template_[key];
+	
+	if (c.length != 1) {
+		throw ASSERT_EXCEPTION + 'XBSCType.template_[' + key + '] length must be 1.';
+	}
+	c = c.charCodeAt(0);
+	XBSCType[key] = c;
+}
+// í
+delete XBSCType.template_;
+
+/**
+ * isspace
+ */
+XBSCType.isspace = function(c) 
+{
+	return (c == XBSCType.SPACE || c == XBSCType.TAB || c == XBSCType.CR || c == XBSCType.LF);
+}
+
+
+/**
+ * DOM T|[gïÉæéuEU»Ê
+ * 
+ * <ul>
+ * <li>IE4:   IE4 </li>
+ * <li>IE5:   IE5 </li>
+ * <li>NN4:   NN4 </li>
+ * <li>NN6:   NN6 </li>
+ * <li>OTHER: ãLÈO</li>
+ * </ul>
+ */
+OTHER = 0;
+IE4   = 1;
+IE5   = 2;
+NN4   = 3;
+NN6   = 4;
+XBSUtil.DOM = document.all 
+				? (document.getElementById ? IE5 : IE4)
+				: (document.getElementById 
+					? NN6
+					: (document.layers ? NN4 : OTHER));
+
+/**
+ * eLXgì API ÌT|[gïÉæéuEU»Ê
+ */
+XBSUtil.Range = null;
+if (document.selection != null && defined(document.selection.createRange)) {
+	XBSUtil.Range = IE5;
+}
+
+
+// G[ÉÍ 0 ðÔ· parseInt(), 10 i
+XBSUtil.parseIntNoError = function(anObj) {
+	var v = 0;	
+
+	try {
+		v = parseInt(anObj, 10);
+	} catch (e) {
+
+	}
+	if ((typeof v != typeof 0) || isNaN(v)) {
+		v = 0;
+	}
+
+	return v;
+}
+
+/**
+ * DOM:
+ * DocumentImplementation - feature list
+ */
+if (null == XBSUtil.DOM) {
+	throw ASSERT_EXCEPTION + 'XBSUtil.DOM must be not null.';
+}
+XBSUtil.DOM.HTMLEvent = false;
+
+if (document.implementation) {
+	XBSUtil.DOM.HTMLEvent = document.implementation.hasFeature('HTMLEvents', '2.0');
+}
+
+
+/**
+ * Mac: AppleWebKit
+ * 
+ * Apple Ì WebKit framework ÌãÉ\z³ê½uEUÈç
+ * ±±Å XBSUtil.appleWebKit IuWFNgð¶¬B
+ * 
+ * @field major WebKit W[o[WÔ (Number)
+ * @field minor WebKit }Ci[o[WÔ (Number)
+ */
+XBSUtil.appleWebKit = null;
+var _webKitMatch = navigator.userAgent.match(/AppleWebKit\/(\d+)\.?(\d+)?/i);
+if (_webKitMatch != null) {
+	var o = new Object();
+	
+	o.major = XBSUtil.parseIntNoError(_webKitMatch[1]);
+	o.minor = XBSUtil.parseIntNoError(_webKitMatch[2]);	
+	XBSUtil.appleWebKit = o;
+}
+
+/**
+ * Mac IE
+ * 
+ * Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
+ */
+/**
+ * Mac: IE
+ * 
+ * IE Ì Mac ÅÈç
+ * ±±Å XBSUtil.macIE IuWFNgð¶¬B
+ * 
+ * @field major IE W[o[WÔ (Number)
+ * @field minor IE }Ci[o[WÔ (Number)
+ */
+//
+// QlF 
+// Mac ÌH¦È¢ìYÇà
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+XBSUtil.macIE = null;
+if (navigator.userAgent.match(/Mac/i)) {
+	var _macIEMatch;
+	
+	_macIEMatch = navigator.userAgent.match(/MSIE\s+(\d+)\.?(\d+)?/i);
+	if (_macIEMatch) {
+		var o = new Object();
+
+		o.major = XBSUtil.parseIntNoError(_macIEMatch[1]);
+		o.minor = XBSUtil.parseIntNoError(_macIEMatch[2]);	
+		XBSUtil.macIE = o;
+	}
+}
+/**
+ * Opera
+ *
+ * Opera Èç±±Å XBSUtil.opera IuWFNgð¶¬B
+ * 
+ * @field major opera W[o[WÔ (Number)
+ * @field minor opera }Ci[o[WÔ (Number)
+ */
+XBSUtil.opera = null;
+if (window.opera) {
+	var o = new Object();
+	
+	o.major = 6;
+	if (document.documentElement)
+		o.major = 7;
+	
+	o.minor = 0;
+	XBSUtil.opera = o;
+}
+
+
+// ---------------------------------------------------------
+// XBSLayer
+// ---------------------------------------------------------
+/**
+ * div vfÈÇðC[ÆµÄµ¤½ßÌIuWFNg
+ * 
+ * For example:
+ * <pre>
+ *    var layer = new XBSLayer(anIdOfDivElement);
+ *    // some operation...
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ * @see     document.layer
+ * @see     style
+ * 
+ * @param     uniqId  div vfÌ id ®«
+ * @param     doc     document IuWFNgiIvVFftHgÍwindow.documentj
+ */
+function XBSLayer(uniqId, doc)
+{
+	if (uniqId) {
+		this.setLayerImp(XBSLayer.getLayerImpById(uniqId, doc));
+	}
+}
+/**
+ * wè³ê½ div vfªÈ¯êÎáOð°é
+ * 
+ * Ç¤¹A½¢µ½ÌC[ÍÈ¢ÌÅLbV
+
+ */
+XBSLayer.makeLayer = function(uniqId, doc)
+{
+	var lyer = null;
+	
+	if (XBSLayer.makeLayer.$cache == null) {
+		XBSLayer.makeLayer.$cache = new Object();
+	}
+	
+	lyer = XBSLayer.makeLayer.$cache[uniqId];
+	if (null == lyer || (doc && doc != XBSUtil.getOwnerDocument(lyer.getLayerImp()))) {
+		lyer = new XBSLayer(uniqId, doc);
+		
+		if (null == lyer || null == lyer.getLayerImp()) {
+			//b throw ASSERT_EXCEPTION + 'div element (id:' + uniqId + ') is required.';
+		}
+		XBSLayer.makeLayer.$cache[uniqId] = lyer;
+	}
+	
+	return lyer;
+}
+
+/* ---- class properties ---- */
+
+// Visibility constants
+/**
+ * C[ÌÂ®«ð\·è
+ */
+XBSLayer.VISIBLE   = 1;
+XBSLayer.HIDDEN    = 2;
+XBSLayer.INHERIT   = 3;
+XBSLayer.UNDEFINED = 4;
+
+/**
+ * C[ÌìÉg¤ÀIuWFNgð¾é
+ *
+ * @param     anId  div vfÌ id ®«
+ * @param     doc   document IuWFNgiIvVFftHgÍwindow.documentj
+ * @return    DOM: element.style, NN: layer
+ */
+XBSLayer.getLayerImpById = function(anId, doc) 
+{
+	var imp = null;
+	
+	if (null == doc) {
+		doc = document;
+	}
+	if (doc.getElementById || doc.all) {
+		imp = doc.getElementById 
+				? doc.getElementById(anId)
+				: doc.all(anId);
+	} else if (doc.layers) {
+		imp = doc.layers[anId];
+	}
+	return imp;
+}
+XBSLayer.getStyleObjectWithLayerImp = function(imp)
+{
+	if (document.getElementById || document.all) {
+		return imp.style;
+	} else {
+		return imp;
+	}
+}
+
+/**
+ * evfð¾é
+ *
+ * @param     imp  ÀIuWFNg
+ * @return    evf
+ */
+XBSLayer.getParentOfLayerImp = function(imp)
+{
+	var parent = null;
+	
+	if (null == imp) {
+		;
+	} else if (defined(imp.parentElement)) {
+		parent = imp.parentElement;
+	} else if (defined(imp.offsetParent)) {
+		parent = imp.offsetParent;
+	}
+
+	return parent;
+}
+
+
+/**
+ * C[ÌìÉg¤ÀIuWFNgÌÂ®«ðÔ·B
+ *
+ * @param     imp  ÀIuWFNg
+ * @return    Â®«ð\·è
+ * <ul>
+ * <li>XBSLayer.VISIBLE</li>
+ * <li>XBSLayer.HIDDEN</li>
+ * <li>XBSLayer.INHERIT</li>
+ * <li>XBSLayer.UNDEFINED</li>
+ * </ul>
+ */
+XBSLayer.getVisibilityWithLayerImp = function(imp)
+{
+	var v;
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	v = imp.visibility;
+	if (document.all) {
+		if (v == '') return XBSLayer.INHERIT;
+	} else if (!document.getElementById && document.layers) {
+		if (v == 'show') return XBSLayer.VISIBLE;
+		if (v == 'hide') return XBSLayer.HIDDEN;
+	}
+	
+	if (v == 'visible') return XBSLayer.VISIBLE;
+	if (v == 'hidden') return XBSLayer.HIDDEN;
+	if (v == 'inherit') return XBSLayer.INHERIT;
+		
+	return XBSLayer.UNDEFINED;
+}
+XBSLayer.setVisibilityWithLayerImp = function(imp, anEnum)
+{
+	var v = '';
+	
+	if (!document.getElementById && document.layers) {
+		if (anEnum == XBSLayer.VISIBLE) v = 'show';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hide';
+	} else {
+		if (anEnum == XBSLayer.VISIBLE) v = 'visible';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hidden';
+		if (anEnum == XBSLayer.INHERIT) v = 'inherit';
+	}
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	return imp.visibility = v;
+}
+/**
+ * C[Ì display ®«
+ * 
+ * @return C[ªÌæðÂêÍ true
+ */
+XBSLayer.isBlockWithLayerImp = function(imp)
+{
+	var b = true;
+	
+	if (imp.style.display != null) {
+		b = (imp.style.display != 'none');
+	}
+	return b;
+}
+XBSLayer.setBlockWithLayerImp = function(imp, b)
+{
+	if (imp.style != null) {
+		imp.style.display = b ? 'block' : 'none';
+	}
+}
+
+// Position & Size
+
+
+// zIndex
+XBSLayer.getZIndexWithLayerImp = function(imp)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	return imp.zIndex;
+}
+XBSLayer.setZIndexWithLayerImp = function(imp, z)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	imp.zIndex = z;
+}
+
+
+// Position
+/**
+ * ÊuwèÉg¤è
+ */
+XBSLayer.LEFT_TOP     = 1;
+XBSLayer.LEFT_BOTTOM  = 2;
+XBSLayer.RIGHT_TOP    = 3;
+XBSLayer.RIGHT_BOTTOM = 4;
+
+/**
+ * [eBeBF wè³ê½CxgÌÊuÉC[ðÚ®A\¦
+ * 
+ * @param imp div vf
+ * @param theEvent CxgIuWFNg
+ * @param axisType ÀWðwè·éÊu
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ *
+ * @param offsetX ±Ì£¾¯CxgÌÊu©ç£· (x ÀW)
+ * @param offsetY ±Ì£¾¯CxgÌÊu©ç£· (y ÀW)
+ * 
+ */
+XBSLayer.popUpWithLayerImpAtEventLocation = function(imp, theEvent, axisType, offsetX, offsetY)
+{
+	var left   = XBSEvent.getMouseX(theEvent) + offsetX;
+	var top    = XBSEvent.getMouseY(theEvent) + offsetY;
+		
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setPositionWIthLayerImp(imp, left, top, axisType);
+	XBSLayer.setVisibilityWithLayerImp(imp, XBSLayer.VISIBLE);
+}
+
+/**
+ * C[ÌÊuwè
+ * 
+ * @param imp div vf
+ * @param x x ÀW
+ * @param y y ÀW
+ * @param axisType ÀWðwè·éÊu (default: LEFT_TOP)
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.setPositionWIthLayerImp = function(imp, x, y, axisType)
+{
+	var left = x;
+	var top  = y;
+	var w = XBSLayer.getWidthWithLayerImp(imp);
+	var h = XBSLayer.getHeightWithLayerImp(imp);
+	
+	if (XBSLayer.LEFT_BOTTOM == axisType) {
+		top -= h;
+	} else if (XBSLayer.RIGHT_TOP == axisType) {
+		left -= w;
+	} else if (XBSLayer.RIGHT_BOTTOM == axisType) {
+		top -= h;
+		left -= w;
+	}
+	if (left < 0) left = 0;
+	if (top < 0) top = 0;
+	
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top)
+}
+/**
+ * C[ÌÊui¶ãjðwèB
+ * 
+ * @param imp div vf
+ * @param top ¶ã x ÀW
+ * @param left ¶ã y ÀW
+ */
+XBSLayer.setLeftTopPositionWithLayerImp = function(imp, left, top)
+{	
+	if (XBSUtil.DOM == NN4) {
+		imp.moveTo(left, top);
+	}else if (imp.style != null) {	
+		imp.style.left = left; imp.style.top = top;
+	}
+}
+/**
+ * C[ÌÊuîñðú»BuEUÉæÁÄÍ±ÌÖð
+ * ¼ÌÊuÖWÖæèàOÉÄÎÈ¢ÆÊªsèÉÈéB
+ * 
+ * @param imp div
+ */
+XBSLayer.initPositionStyle = function(imp)
+{
+	if (document.layers) {
+		return;
+	} else if (typeof imp.style.left == "string") {
+		imp.style.left = imp.offsetLeft + 'px';
+		imp.style.top  = imp.offsetTop  + 'px';
+	} else if (typeof imp.style.pixelLeft != "undefined") {
+		imp.style.pixelLeft = imp.offsetLeft;
+		imp.style.pixelTop  = imp.offsetTop;
+	}
+}
+
+XBSLayer.getLeftWithLayerImp = function(imp)
+{
+	var x = 0;
+
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		x = imp.offsetLeft;
+	} else if (XBSUtil.DOM == IE4) {
+		x = imp.style.pixelLeft;
+	} else if (XBSUtil.DOM == NN4) {
+		x = imp.clip.left;
+	}
+	return x;
+}
+
+XBSLayer.getTopWithLayerImp = function(imp)
+{
+	var y = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		y = imp.offsetTop;
+	} else if (XBSUtil.DOM == IE4) {
+		y = imp.style.pixelTop;
+	} else if (XBSUtil.DOM == NN4) {
+		y = imp.clip.top;
+	}
+	return y;
+}
+
+// Size
+XBSLayer.getWidthWithLayerImp = function(imp) 
+{
+	var w = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		w = imp.offsetWidth;
+	} else if (XBSUtil.DOM == IE4) {
+		w = imp.style.pixelWidth;
+	} else if (XBSUtil.DOM == NN4) {
+		w = imp.clip.width;
+	}
+	return w;
+}
+XBSLayer.getHeightWithLayerImp = function(imp)
+{
+	var h = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		h = imp.offsetHeight;
+	} else if (XBSUtil.DOM == IE4) {
+		h = imp.style.pixelHeight;
+	} else if (XBSUtil.DOM == NN4) {
+		h = imp.clip.height;
+	}
+	return h;
+}
+XBSLayer.setWidthWithLayerImp = function(imp, w) 
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.width = w;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelWidth = w;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(w, imp.clip.height);
+
+	}
+}
+XBSLayer.setHeightWithLayerImp = function(imp, h)
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = h;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelHeight = h;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(imp.clip.width, h);
+	}
+}
+
+// HTML
+XBSLayer.getInnerHTMLWithLayerImp = function(imp)
+{
+	if (defined(imp.innerHTML)) {
+		return imp.innerHTML;
+	}
+	return '';
+}
+XBSLayer.setInnerHTMLWithLayerImp = function(imp, htmlText)
+{
+	if (defined(imp.innerHTML)) {
+		imp.innerHTML = htmlText;
+	} else if (document.layers != null) {
+		imp.document.open();
+		imp.document.write(htmlText);
+		imp.document.close();
+	}
+}
+
+// Cursor
+XBSLayer.setCursorWithLayerImp = function(imp, aName) 
+{
+	if (imp.style != null && defined(imp.style.cursor)) {
+		imp.style.cursor = aName;
+	}
+}
+
+
+
+/* ---- Instance properties ---- */
+/**
+ * evfÌ XBSLayer ðÔ·
+ */
+XBSLayer.prototype.getParent = function()
+{
+	var imp = XBSLayer.getParentOfLayerImp(this.getLayerImp());
+	if (null == imp) {
+		return null;
+	}
+	var lyer = new XBSLayer();
+	
+	lyer.setLayerImp(imp);
+	return lyer;
+}
+XBSLayer.prototype.getID = function() { 
+	return this.getLayerImp().id;
+}
+XBSLayer.prototype.hasID = function() {
+	var id = this.getID();
+	
+	return id != null && id != '';
+}
+XBSLayer.prototype.isValid = function() {
+	return (this.getLayerImp() != null);
+}
+// Visibility
+XBSLayer.prototype.getVisibility = function()
+{
+	return XBSLayer.getVisibilityWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setVisibility = function(aEnum)
+{
+	XBSLayer.setVisibilityWithLayerImp(this.getLayerImp(), aEnum);
+}
+
+/**
+ * C[ªÂ©Ç¤©ðÔ·B
+ *
+ * @return    boolean
+ */
+XBSLayer.prototype.isVisible  = function()
+{
+	return this.getVisibility() == XBSLayer.HIDDEN ? false : true;
+}
+XBSLayer.prototype.setVisible = function(/* boolean */ flag)
+{
+	this.setVisibility(flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
+XBSLayer.prototype.toggleVisibility = function()
+{
+	this.setVisible(false == this.isVisible())
+}
+/**
+ * C[Ì display ®«
+ * 
+ * @return C[ªÌæðÂêÍ true
+ */
+XBSLayer.prototype.isBlock  = function()  
+{ return XBSLayer.isBlockWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setBlock = function(b) 
+{ XBSLayer.setBlockWithLayerImp(this.getLayerImp(), b); }
+
+
+/**
+ * C[Ì z ÀW
+ */
+XBSLayer.prototype.getZIndex = function()
+{
+	return XBSLayer.getZIndexWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setZIndex = function(z)
+{
+	XBSLayer.setZIndexWithLayerImp(this.getLayerImp(), z);
+}
+
+
+XBSLayer.prototype.getStyleObject = function() 
+{
+	return XBSLayer.getStyleObjectWithLayerImp(this.imp);
+}
+XBSLayer.prototype.getLayerImp = function() { return this.imp; }
+XBSLayer.prototype.setLayerImp = function(imp) { this.imp = imp; }
+
+// Position & Size
+XBSLayer.prototype.popUpAtEventLocation = function(theEvent, axisType, offsetX, offsetY)
+{ XBSLayer.popUpWithLayerImpAtEventLocation(this.getLayerImp(), theEvent, axisType, offsetX, offsetY); }
+
+/**
+ * C[ÌÊuwè
+ * 
+ * @param x x ÀW
+ * @param y y ÀW
+ * @param axisType ÀWðwè·éÊu
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.prototype.setPosition = function(x, y, axisType)
+{ XBSLayer.setPositionWIthLayerImp(this.getLayerImp(), x, y, axisType); }
+XBSLayer.prototype.setLeftTopPosition = function(left, top) 
+{ 
+	XBSLayer.setLeftTopPositionWithLayerImp(this.getLayerImp(), left, top); 
+}
+
+XBSLayer.prototype.getX = function() { return XBSLayer.getLeftWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getY = function() { return XBSLayer.getTopWithLayerImp(this.getLayerImp()); }
+/**
+ * ÀWðâÎlÅæ¾
+ */
+XBSLayer.prototype.getAbsolute_ = function(fnName)
+{
+	var ret = 0;
+	var lyer = this;
+	
+	while (lyer != null && lyer.isValid()) {
+		ret += lyer[fnName]();	
+		lyer = lyer.getParent();
+	}
+	return ret;
+	
+}
+XBSLayer.prototype.getAbsoluteX = function()
+{
+	return this.getAbsolute_("getX");
+}
+XBSLayer.prototype.getAbsoluteY = function()
+{
+	return this.getAbsolute_("getY");
+}
+
+XBSLayer.prototype.getWidth  = function() { return XBSLayer.getWidthWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getHeight = function() { return XBSLayer.getHeightWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setWidth  = function(w) { return XBSLayer.setWidthWithLayerImp(this.getLayerImp(), w); }
+XBSLayer.prototype.setHeight = function(h) { return XBSLayer.setHeightWithLayerImp(this.getLayerImp(), h); }
+
+// HTML
+XBSLayer.prototype.getInnerHTML = function()
+{
+	return XBSLayer.getInnerHTMLWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setInnerHTML= function(htmlText)
+{
+	XBSLayer.setInnerHTMLWithLayerImp(this.getLayerImp(), htmlText);
+}
+
+// Cursor
+XBSLayer.prototype.setCursor = function(aName) { XBSLayer.setCursorWithLayerImp(this.getLayerImp(), aName); }
+
+//---------------------------------------------------------
+// XBSDocument
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * hL
+gîñÌæ¾
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSDocument = new Object();
+
+
+/**
+ * hL
+gSÌÌå«³
+ * 
+ * @return A³
+ */
+XBSDocument.getWidth = function()
+{
+	var w = 0;
+	
+	if (window.innerWidth != null) {
+		w = window.innerWidth;
+	
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ªÔÁÄ­é
+	/*
+	} else if (document.documentElement && document.documentElement.clientWidth != null) {
+		w = document.documentElement.clientWidth;
+	*/
+	} else if (document.body && document.body.clientWidth != null) {
+		w = document.body.clientWidth;
+	} 
+	return w;
+}
+
+XBSDocument.getHeight = function()
+{
+	var h = 0;
+	
+	if (window.innerHeight != null) {
+		h = window.innerHeight;
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ªÔÁÄ­é
+	/*
+	} else if (document.documentElement && document.documentElement.clientHeight != null) {
+		h = document.documentElement.clientHeight;
+	*/
+	} else if (document.body && document.body.clientHeight != null) {
+		h = document.body.clientHeight;
+	} 
+	return h;
+}
+
+/**
+ * hL
+gÌÂÌæÌ¶ãÀW
+ * 
+ * @return x, y
+ */
+XBSDocument.getPageOffsetX = function()
+{
+	var x = 0;
+	
+	if (document.body && document.body.scrollLeft != null) {
+		x = document.body.scrollLeft;
+	} else if (document.documentElement && document.documentElement.scrollLeft != null) {
+		x = document.documentElement.scrollLeft;
+	} else if (window.scrollX != null) {
+		x = window.scrollX;
+	} else if (window.pageXOffset != null) {
+		x = window.pageXOffset;
+	}
+	
+	return x;
+}
+XBSDocument.getPageOffsetY = function()
+{
+	var y = 0;
+	
+	if (document.body && document.body.scrollTop != null) {
+		y = document.body.scrollTop;
+	} else if (document.documentElement && document.documentElement.scrollTop != null) {
+		y = document.documentElement.scrollTop;
+	} else if (window.scrollY != null) {
+		y = window.scrollY;
+	} else if (window.pageYOffset != null) {
+		y = window.pageYOffset;
+	}
+	
+	return y;
+}
+
+//---------------------------------------------------------
+//XBSEvent
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * CxgIuWFNgÌì
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSEvent = new Object();
+
+// *** Key code *** //
+/**
+ * Key code (unicode)
+ * 
+ * @see http://www.unicode.org
+ */
+// 0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;;
+XBSEvent.BACKSPACE_KEY = 0x08;
+// 0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;;
+XBSEvent.TAB_KEY = 0x09;
+// 000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;;
+XBSEvent.LINE_FEED_KEY = 0x0A;
+// 000D;<control>;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;;
+XBSEvent.NEW_LINE_KEY = 0x0D;
+
+
+// Modifier keys
+XBSEvent.ALT_KEY_MASK     = 1;
+XBSEvent.SHIFT_KEY_MASK   = 1 << 1;
+XBSEvent.CONTROL_KEY_MASK = 1 << 2;
+XBSEvent.META_KEY_MASK    = 1 << 3;
+
+/**
+  * getMouseX(e), getMouseY(e)
+  *
+  * }EXªCxgðN±µ½É
+  * XÀWAYÀWðÔ·Ö
+  * 
+  * @param theEvent }EXCxg
+  * @return ÀW
+  */
+XBSEvent.getMouseX = function(theEvent)
+{
+	var x = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// Safari Í clientX àâÎÀWÅÔµÄ­é
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageX
+	}
+	
+	if (theEvent.clientX != null) {
+		x = XBSDocument.getPageOffsetX() + theEvent.clientX;
+	} else if (theEvent.pageX != null) {
+		x = theEvent.pageX;
+	} else if (window.opera != null) {  // OÌ½ßB®ìmFµ½o[WÅÍ±È¢
+		x = (document.documentElement ? window.pageXOffset : 0) + theEvent.clientX;
+	}
+	
+	return x;
+}
+XBSEvent.getMouseY = function(theEvent) {
+	var y = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	
+	// Safari Í clientY àâÎÀWÅÔµÄ­é
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageY;
+	}
+	
+	if (theEvent.clientY != null) {
+		y = XBSDocument.getPageOffsetY() + theEvent.clientY;
+	} else if (theEvent.pageY != null) {
+		y = theEvent.pageY;
+	} else if (window.opera != null) {  // OÌ½ßB®ìmFµ½o[WÅÍ±È¢
+		y = (document.documentElement ? window.pageYOffset : 0) + theEvent.clientY;
+	}
+	
+	return y;
+}
+
+
+/**
+ * Key Event Ì Unicode R[h|Cgð¾é
+ * 
+ * @return code, È¯êÎ null
+ */
+XBSEvent.getKeyCode = function(theEvent) 
+{
+	if (theEvent.which != null) {
+		return theEvent.which;
+	} else if (theEvent.keyCode != null) {
+		return theEvent.keyCode;
+	}
+	return null;
+}
+XBSEvent.getTarget = function(theEvent) 
+{
+	if (theEvent.target != null) {
+		return theEvent.target;
+	} else if (theEvent.srcElement != null) {
+		return theEvent.srcElement;
+	}
+	return null;
+}
+
+
+XBSEvent.getModifierFlags = function(theEvent)
+{
+	var flags = 0;
+	
+
+	if (defined(theEvent.ctrlKey)) {
+		if (theEvent.altKey) flags |= XBSEvent.ALT_KEY_MASK;
+		if (theEvent.shiftKey) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (theEvent.ctrlKey) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (theEvent.metaKey) flags |= XBSEvent.META_KEY_MASK;
+	} else if (defined(theEvent.modifiers)) {
+		var m = theEvent.modifiers;
+		
+		if (Event.ALT_MASK & m) flags |= XBSEvent.ALT_KEY_MASK;
+		if (Event.SHIFT_KEY_MASK & m) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (Event.CONTROL_MASK & m) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (Event.META_MASK & m) flags |= XBSEvent.META_KEY_MASK;
+	}
+	return flags;
+}
+
+
+//---------------------------------------------------------------------------------
+// Utilities
+//---------------------------------------------------------------------------------
+UtilKit = new Object();
+
+/**
+ * wè³ê½IuWFNgÌvpeBÉÖð *** ÇÁ *** ·éB
+ * ÈOÉÊÌÖªo^³êÄ¢êÎ»êðÄÑoµÄ©çAo^³ê½ÖðÄÑo·B
+ * 
+ * NOTE: n¹éøÍÆè ¦¸ 5 ÂÜÅÆµ½B±ê¾¯ êÎ\ªÈÌÅB
+ * 
+ * @param anObject IuWFNg
+ * @param funcName vpeB¼
+ * @param func     Ö{Ì
+ */
+UtilKit.addhook = function(anObject, funcName, func)
+{
+	var prev = anObject[funcName];
+	var fns  = new Array();
+	if (typeof prev == typeof UtilKit.addhook) {
+		fns[fns.length] = prev;
+	}
+	fns[fns.length] = func;
+	
+	// dprint("UtilKit.addhook(" + anObject + ", " + funcName + ") nfunc = " + fns.length);
+	anObject[funcName] = function() {
+		// dprint("funcName: " + funcName + ": " + this);
+		for (var i = 0; i < fns.length; i++) {
+			// dprint(fns[i]);
+			
+			// 2004-04-20  Takanori Ishikawa  
+			// -------------------------------------------------------------------
+			// ÖàÅøÌÂð`FbNµÄ¢éÂ\«à éÌÅA{ÍøÂÅªò·×«©à
+			// ½¾A»ÌêAøª«èÈ¢êÈÇàl¶·éÆÊ|­³¢ÌÅè²«
+			 fns[i](
+				arguments[0],
+				arguments[1],
+				arguments[2],
+				arguments[3],
+				arguments[4]);
+			/*
+			var f = fns[i]; var args = arguments;
+			
+			switch (fns.length) {
+			case 0: f(); break;
+			case 1: f(args[0]); break;
+			case 2: f(args[0], args[1]); break;
+			case 3: f(args[0], args[1], args[2]); break;
+			default: ;
+			}
+			*/
+		}
+	};
+}
+
+/**
+ * IuWFNgÌvpeBðÔ·B
+ * null ÌêÍáOð°é
+ * 
+ * @param obj  object
+ * @param name property name
+ */
+UtilKit.getPropertyNotNull = function(obj, name)
+{
+	var v = obj[name];
+	
+	if (null == v) {
+		throw ASSERT_EXCEPTION + "object: " + obj + " name: " + name + ' must be nut null.';
+	}
+	
+	return v;	
+}
+
+/**
+ * IuWFNgð_lÉÏ·
+ */
+UtilKit.parseBoolean = function(v)
+{
+	if (typeof v == typeof true) {
+		return v;
+	} else if (typeof v == typeof "") {
+		if ('true' == v) 
+			return true;
+		else if ('false' == v) 
+			return false;
+		else
+			return true;
+	} else if (null == v) {
+		return false;
+	} else {
+		return true;
+	}
+}
+/**
+ * IuWFNgÌvpeB©çA»êÌo^³êÄ¢éL[ðõ
+ * 
+ * @param anObject IuWFNg
+ * @param aValue   vpeBl
+ */
+UtilKit.getKeyForValue = function(anObject, aValue)
+{
+	for (var key in anObject) {
+		if (aValue == anObject[key]) {
+			return key;
+		}
+	}
+	return null;
+}
+
+UtilKit.getBgColorById = function(anId, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	return UtilKit.normalizeRGBColorRep(style.backgroundColor);
+}
+UtilKit.setBgColorById = function(anId, aColor, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+		
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	style.backgroundColor = aColor;
+}
+
+/**
+ * NN, Opera ÍwiFð rgb(r, g, b) Æ¢¤`®Å
+ * nµÄ­éÌÅA»êð #RGB ÉÏ·
+ */
+UtilKit.normalizeRGBColorRep = function(aColor)
+{
+	var m = aColor.match(/rgb\((\d+),\s*(\d+),\s+(\d+)\)/);
+	
+	if (null == m) {
+		return aColor;
+	}
+	var s = "#";
+	
+	for (var i = 1; i <= 3; i++) {
+		var n = m[i];
+		
+		n = XBSUtil.parseIntNoError(n);
+		n = n.toString(16);
+		if (n.length == 1){
+			n = '0' + n;
+		}
+		s += n;
+	}
+	return s;
+}
+
+/**
+ * InitialFirstResponder:
+ *   [UªÅÉüÍ·×«tH[vf
+ * 
+ * InitialFirstResponder ðÝè·éÖðÔ·B
+ * ±ÌÖÍÀs³êéÆAwindow.initialFirstResponder É»ÌtH[vfði[µA
+ * »ÌtH[vfð focus() ·éB
+ * window.onload Ågíêé±Æðzè
+ * 
+ */
+UtilKit.makeInitialFirstResponder = function(formName, elementName)
+{
+	return function() {
+		var frm = document.forms[formName];
+	
+		if (frm == null) return;
+		frm = frm[elementName];
+		if (frm == null) return;
+		
+		window.initialFirstResponder = frm;
+		setTimeout("window.initialFirstResponder.focus()", 500);
+	};
+}
+
+
+//---------------------------------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------------------------------
+/**
+ * 
+ * y[WÌàeªÏX³ê½©Ç¤©ðL^
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/20
+ */
+function ContentsChangedListener(/* Optional */ aName)
+{
+	this.name = aName;
+	if (this.name == null) {
+		this.name = '[undefined listener]';
+	}
+	this.changed = false;
+}
+ContentsChangedListener.prototype.toString = function()
+{ return '[ContentsChangedListener] ' + this.name; }
+
+ContentsChangedListener.prototype.isChanged = function() { return this.changed; }
+ContentsChangedListener.prototype.setChanged = function(b) {
+	if (this.changed != b) {
+		//alert(this + " changed: " + b);
+	}
+	this.changed = b; 
+}
+
+/**
+ * Cxgðo^µAo^µ½Cxgª­¶µ½Æ«É
+ * ÏXtOð true É·éB
+ * 
+ * åÉ html vfÌ onchange CxgÈÇðß¨µA
+ * ÏXtOð§ÄéÌÉg¤B
+ */
+ContentsChangedListener.prototype.listenEvent = function(anObject, eventName)
+{
+//	2004-04-20  Takanori Ishikawa  
+//	------------------------------------------------------------------------
+//	this ÍÖàÅÀsÉðß³êé½ßAêxÏÉüêÄ
+//	ÃIXR[vÉ©·éKvª éiðú³êÈ¢Hj
+	var me = this
+	var callback = function(){ me.setChanged(true); };
+	
+	UtilKit.addhook(anObject, eventName, callback);
+}
+
+
+//---------------------------------------------------------------------------------
+// Common
+//---------------------------------------------------------------------------------
+/**
+ * AvP[VSÌÌÝè
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+OEMBlogGlobal = new Object();
+
+/**
+ * LÒWÅ Blog |[^EJeSÌIððNbL[ÉÛ¶·é©
+ */
+OEMBlogGlobal.saveTbCategoryToCookie = false;
+
+/**
+ * LÒWÅ^OÒW@\i^O²ÆíAÚ®ÈÇjð HTML ^OÅàLøÉ·é©
+ */
+OEMBlogGlobal.enableTagEditingOnHTML = false;
+
+
+/**
+ * ÚÝèÌfBXN[WgCAOÈÇÅAj[VðLøÉ·é©
+ */
+OEMBlogGlobal.enableAnimationFeedback = true;
+
+/**
+ * æðAbv[h·éfBNgÌpX
+ * jsp ¤ÅKXXV³êéB
+ */
+OEMBlogGlobal.uploadImageDirectory = null;
+
+/**
+ * Abv[hÅ«éæt@C¼Ì`®
+ */
+OEMBlogGlobal.IMAGE_FILE_PATTERN = /{(¶:|E:)?([a-zA-Z0-9-_.!~'()]+\.[a-zA-Z]+)}/;
+
+/**
+ * TCho[FzuÅ«éÚÌÅå
+ * 
+ * @see sidefunc_order.js BoxConfig.maxNBoxes
+ */
+OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES	= 50;	// ugpµÈ¢@\v
+OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES		= 50;	// ugp·é@\v¶
+OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES	= 50;	// ugp·é@\vE
+
+
+/**
+ * 
+ * LÒWAVKì¬ÅÍÈºÌ¶ñðÜÞNðNbNµ½êA
+ * Ü¾ÏXªÛ¶³êÄ¢È¯êÎmF_CAOðo·B
+ * 
+ * @see entry_write_edit.js, entry_save_confirm.jsp
+ * @see OEMBlogGlobal.watchOtherLinks
+ */
+OEMBlogGlobal.DOCUMENT_EDITED_WARNING = "ÏXÍÛ¶³êÄ¢Ü¹ñB<br>Ìy[WÖÚÁÄàæëµ¢Å·©H"
+OEMBlogGlobal.WATCH_OTHER_LINK_LIST = [
+					/* ã */
+					'MyPage',			/* }Cy[W */
+					'EntryWrite',		/* LVKì¬ */
+					'EntryList',		/* Lê */
+					'TopicList',		/* NXg */
+					'SidefuncOrder',	/* TCho[ */
+					'DesignChange',		/* fUC */
+					'BlogSetup',		/* Ýè */
+					
+					/* ¶ */
+					'SidefuncOrder',	/* @\IðEÀÑÖ¦ */
+					'SidefuncSetup',	/* \¦¼ÏX */
+					'SidefuncEditList',		/* @\ÇÁ */
+					'LinksList',		/* NW  ÒW */
+					'CategoryList'		/* JeS  ÒW */
+					];
+
+
+/**
+ * eLXgÌu·ÈÇÅgp·éüsR[h
+ */
+/** TODO: dlÉµ½ªÁÄA»ÊR[hð­±ÆBÆè ¦¸ACRLF ÉµÄ¨­ */
+OEMBlogGlobal.lineSeparator = "\r\n";
+
+
+OEMBlogGlobal.makeWatchOtherLinkFunction = function(aListener, prevFunc)
+{
+	return function(e) {
+		var ret = true;
+			
+		if (prevFunc != null) {
+			ret = prevFunc(e);
+		}
+		if (aListener.isChanged() == false)
+			return ret;
+			
+		return (htmlConfirm(OEMBlogGlobal.DOCUMENT_EDITED_WARNING))
+	};
+}
+OEMBlogGlobal.watchOtherLinks = function(aDocument, aListener)
+{
+	var linkArray = aDocument.links;
+	var nms = OEMBlogGlobal.WATCH_OTHER_LINK_LIST;
+	var link;
+	var count = 0;
+	
+	for (var i = 0; i < linkArray.length; i++) {
+		
+		link = linkArray[i];
+		if (null == link) continue;
+		
+		for (var j = 0; j < nms.length; j++) {
+			if (link.href.indexOf(nms[j]) != -1) {
+				var prevFunc = link.onclick;
+				
+				if (typeof prevFunc != 'function') {
+					prevFunc = null;
+				}
+				link.onclick = OEMBlogGlobal.makeWatchOtherLinkFunction(aListener, prevFunc);
+				
+				count++;
+				break;
+			}
+		}
+		if (count == nms.length) {
+			break;
+		}
+	}
+}
Index: /temp/trunk/html/test/kakinaka/dragdrop/js/dragdrop.js
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/js/dragdrop.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/js/dragdrop.js	(revision 1328)
@@ -0,0 +1,196 @@
+var obj;
+var offsetX;
+var offsetY;
+var arrObj;
+var objParam;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Param() {
+	this.ITEM_MAX = 3;		
+}
+
+// ¥µ¥¤¥º´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Size() {
+	this.id = '';
+	this.left = 0;
+	this.top = 0;
+	this.width = 0;
+	this.height = 0;
+	this.obj;
+};
+
+// ¥ª¥ó¥í¡¼¥É½èÍý
+onload=function () {
+	// ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+	objParam = new SC_Param();
+	
+	// WIN-IE
+	if (document.all) {
+		objlist = document.all.tags("div");
+	// WIN-NN,WIN-FF   
+	} else if (document.getElementsByTagName) {
+		objlist = document.getElementsByTagName("div");
+	} else {
+		return;
+	}
+	
+	arrObj = new Array();
+	for (i = 0; i < objlist.length; i++) {
+		id = objlist[i].id;
+		arrObj[id] = new SC_Size();
+		arrObj[id].id = id;
+		arrObj[id].obj = objlist[id];
+		arrObj[id].left = objlist[id].style.left;
+		arrObj[id].top = objlist[id].style.top;
+		arrObj[id].width = objlist[id].style.width;
+		arrObj[id].height = objlist[id].style.height;
+		arrObj[id].left = Number(arrObj[id].left.replace(/px/, ''));
+		arrObj[id].top = Number(arrObj[id].top.replace(/px/, ''));
+		arrObj[id].width = Number(arrObj[id].width.replace(/px/, ''));
+		arrObj[id].height = Number(arrObj[id].height.replace(/px/, ''));
+		arrObj[id].right = Number(arrObj[id].left) + Number(arrObj[id].width);
+		arrObj[id].bottom =Number(arrObj[id].top) + Number(arrObj[id].height);
+	}
+	
+	// MouseDown¥¤¥Ù¥ó¥È½èÍý¤ÎÆþ¤ìÂØ¤¨
+	objlist['item0'].onmousedown = onMouseDown;
+	objlist['item1'].onmousedown = onMouseDown;
+	objlist['item2'].onmousedown = onMouseDown;
+	
+	document.onmousemove = onMouseMove;
+	document.onmouseup = onMouseUp;
+}
+
+// MouseDown¥¤¥Ù¥ó¥È
+function onMouseDown(e) {
+   obj = this;
+   // WIN-IE
+   if (document.all) {
+      offsetX = event.offsetX + 2;
+      offsetY = event.offsetY + 2;
+   // WIN-NN,WIN-FF
+   } else if (obj.getElementsByTagName) {
+      offsetX = e.pageX - parseInt(obj.style.left);
+      offsetY = e.pageY - parseInt(obj.style.top);
+   }
+   return false;
+}
+
+// MouseMove¥¤¥Ù¥ó¥È
+function onMouseMove(e) {
+	if (!obj) {
+		return true;
+	}	
+	// WIN-IE
+	if (document.all) {
+		x = event.clientX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = document.body.clientWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		y = event.clientY - offsetY;
+		if(y <= 0) {
+			y = 0;
+		}
+		top_max = document.body.clientHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;		
+	// WIN-NN,WIN-FF
+	} else if (obj.getElementsByTagName) {
+		x = e.pageX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = window.innerWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		
+		y = e.pageY - offsetY;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(y <= 0) {
+			y = 0;
+			obj.style.top = 0;
+		}
+		top_max = window.innerHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;
+	}
+	
+	if(isInFlame('flame0', obj)) {
+		document.getElementById('td1').style.backgroundColor = '#fffadd';
+	} else {
+		document.getElementById('td1').style.backgroundColor = '#ffffff';
+	}
+	return false;
+}
+
+// MouseUp¥¤¥Ù¥ó¥È
+function onMouseUp(e) {
+	if (!obj) {
+		return true;
+	}
+	
+	if(!isInFlame('flame0', obj)) {
+		// WIN-IE
+		if (document.all) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		// WIN-NN,WIN-FF
+		} else if (obj.getElementsByTagName) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		}
+	}	
+	document.getElementById('td1').style.backgroundColor = '#ffffff';	
+	obj = null;
+}
+
+// ¥Õ¥ì¡¼¥àÆâ¤Ë¥¢¥¤¥Æ¥à¤¬Â¸ºß¤¹¤ë¤«È½Äê¤¹¤ë¡¡
+function isInFlame(flame_id, item) {
+	top_val = item.style.top;
+	top_val = Number(top_val.replace(/px/, ''));
+	bottom_val = top_val + arrObj[item.id].height;
+	left_val = item.style.left;
+	left_val = Number(left_val.replace(/px/, ''))
+	right_val = left_val + arrObj[item.id].width;		
+	if(
+		top_val > arrObj[flame_id].top &&
+		bottom_val < arrObj[flame_id].bottom &&
+		left_val > arrObj[flame_id].left &&
+		right_val < arrObj[flame_id].right
+		) {
+		return true;
+	}
+	return false;
+}
+
+// Á÷¿®Á°¤Î½èÍý
+function preSubmit() {
+	for(i = 0; i < 3; i++) {
+		id = 'item' + i;
+		obj = arrObj[id].obj;
+		if(isInFlame ('flame0', obj)) {
+			document.form1[obj.id].value = "in";
+		} else {
+			document.form1[obj.id].value = "out";
+		}
+	}
+}
+
+
+
Index: /temp/trunk/html/test/kakinaka/dragdrop/simple.html
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/simple.html	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/simple.html	(revision 1328)
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0054)http://www.res-system.com/weblog/media/1/dragdrop.html -->
+<HTML><HEAD><TITLE>DragDrop Sample</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=utf-8">
+<SCRIPT type=text/javascript>
+<!--
+var obj;
+var offsetX;
+var offsetY;
+
+onload=function () {
+   if (document.all) {
+   	  // WIN-IE
+      objlist = document.all.tags("div");
+   } else if (document.getElementsByTagName) {
+      // WIN-NN,WIN-FF
+      objlist = document.getElementsByTagName("div");
+   } else {
+   	  alert("3");   
+      return;
+   }
+   for (i = 0; i < objlist.length; i++) {
+      objlist[i].onmousedown = onMouseDown;
+   }
+   document.onmousemove = onMouseMove;
+   document.onmouseup = onMouseUp;
+}
+function onMouseDown(e) {
+   obj = this;
+   if (document.all) {
+      offsetX = event.offsetX + 2;
+      offsetY = event.offsetY + 2;
+   } else if (obj.getElementsByTagName) {
+      offsetX = e.pageX - parseInt(obj.style.left);
+      offsetY = e.pageY - parseInt(obj.style.top);
+   }
+   return false;
+}
+function onMouseMove(e) {
+   if (!obj) {
+      return true;
+   }
+   if (document.all) {
+      obj.style.left = event.clientX - offsetX + document.body.scrollLeft;
+      obj.style.top = event.clientY - offsetY + document.body.scrollTop;
+   } else if (obj.getElementsByTagName) {
+      obj.style.left = e.pageX - offsetX;
+      obj.style.top = e.pageY - offsetY;
+   }
+   return false;
+}
+function onMouseUp(e) {
+   obj = null;
+}
+
+-->
+</SCRIPT>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<DIV 
+style="BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 5px; LEFT: 200px; PADDING-BOTTOM: 5px; BORDER-LEFT: #000000 1px solid; WIDTH: 200px; CURSOR: move; PADDING-TOP: 5px; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 100px; HEIGHT: 50px; BACKGROUND-COLOR: #eeeeee; TEXT-ALIGN: center">Web 
+Artisan Blog </DIV></BODY></HTML>
Index: /temp/trunk/html/test/kakinaka/dragdrop/naka1.html
===================================================================
--- /temp/trunk/html/test/kakinaka/dragdrop/naka1.html	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/dragdrop/naka1.html	(revision 1328)
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0054)http://www.res-system.com/weblog/media/1/dragdrop.html -->
+<HTML><HEAD><TITLE>DragDrop Sample</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=EUC-JP">
+<SCRIPT src="./js/dragdrop.js" type=text/javascript></SCRIPT>
+
+<STYLE TYPE="text/css">
+<!--
+.style_item0{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaaaff;
+	TEXT-ALIGN: center;
+}
+
+.style_item1{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #ffaaaa;
+	TEXT-ALIGN: center;
+}
+
+.style_item2{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaffaa;
+	TEXT-ALIGN: center;
+}
+
+.style_item2{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaffaa;
+	TEXT-ALIGN: center;
+}
+
+.style_flame{
+	POSITION: absolute;
+}
+
+-->
+</STYLE>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<table>
+	<tr><td height="150"></td></tr>
+</table>
+<table width="500" bgcolor="#cccccc"  border="0" cellspacing="1" cellpadding="10" summary=" ">
+<form name="form1" id="form1" method="post" action="./recv_post.php" onsubmit="preSubmit()">
+<input type="hidden" name="item0" value="0">
+<input type="hidden" name="item1" value="0">
+<input type="hidden" name="item2" value="0">
+	<tr>
+		<td bgcolor="#f5f5f5" align="center">flame1</td>
+	</tr>
+	<tr>
+		<td height="200" id="td1" bgcolor="#ffffff"><DIV id="flame0" class="style_flame" style="TOP: 200px; LEFT: 10px; WIDTH: 500px; HEIGHT: 200px;"></DIV></td>
+	</tr>
+</table>
+<table width="500">
+	<tr><td height="5"></td></tr>
+	<tr><td align="center"><input type="submit" name="subm" value="¥¢¥¤¥Æ¥à¤Î¾õ¶·¤òÁ÷¿®"></td></tr>
+</form>
+</table>
+
+<DIV id="item0" class="style_item0" style="TOP: 100px; LEFT: 45px; WIDTH: 100px; HEIGHT: 20px;">item0</DIV>
+<DIV id="item1" class="style_item1" style="TOP: 100px; LEFT: 195px; WIDTH: 100px; HEIGHT: 20px;">item1</DIV>
+<DIV id="item2" class="style_item2" style="TOP: 100px; LEFT: 345px; WIDTH: 100px; HEIGHT: 20px;">item2</DIV>
+</BODY>
+</HTML>
Index: /temp/trunk/html/test/kakinaka/ajax/jslb_ajax04.js
===================================================================
--- /temp/trunk/html/test/kakinaka/ajax/jslb_ajax04.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/ajax/jslb_ajax04.js	(revision 1328)
@@ -0,0 +1,108 @@
+////
+// »ÃÄêÈÇAjaxÍÑ¥é¥¤¥Ö¥é¥ê jslb_ajax04.js
+// ºÇ¿·¾ðÊó http://jsgt.org/mt/archives/01/000409.html 
+// ¾åµ­¥³¥á¥ó¥Èºï½üÉÔ²Ä¡£¾¦ÍÑÍøÍÑ¡¢²þÂ¤¡¢¼«Í³¡£Ï¢ÍíÉÔÍ×¤Ç¤¹¡£
+// 
+
+	////
+	// XMLHttpRequest¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+	//
+	// @sample oj=createHttpRequest()
+	// @return XMLHttpRequest¥ª¥Ö¥¸¥§¥¯¥È
+	//
+	function createHttpRequest()
+	{
+		if(window.ActiveXObject){
+			 //Win e4,e5,e6ÍÑ
+			try {
+				return new ActiveXObject("Msxml2.XMLHTTP") ;
+			} catch (e) {
+				try {
+					return new ActiveXObject("Microsoft.XMLHTTP") ;
+				} catch (e2) {
+					return null ;
+	 			}
+	 		}
+		} else if(window.XMLHttpRequest){
+			 //Win Mac Linux m1,f1,o8 Mac s1 Linux k3ÍÑ
+			return new XMLHttpRequest() ;
+		} else {
+			return null ;
+		}
+	}
+	
+	////
+	// Á÷¿®´Ø¿ô
+	//
+	// @sample sendRequest(onloaded,'&prog=1','POST','./about2.php',true,true)
+	// @param callback ¼õ¿®»þ¤Ëµ¯Æ°¤¹¤ë´Ø¿ôÌ¾
+	// @param data	 Á÷¿®¤¹¤ë¥Ç¡¼¥¿
+	// @param method "POST" or "GET"
+	// @param url¥ê¥¯¥¨¥¹¥È¤¹¤ë¥Õ¥¡¥¤¥ë¤ÎURL
+	// @param async	ÈóÆ±´ü¤Ê¤étrue Æ±´ü¤Ê¤éfalse
+	// @param sload	¥¹¡¼¥Ñ¡¼¥í¡¼¥É true¤Ç¶¯À©¡¢¾ÊÎ¬¤Þ¤¿¤Ïfalse¤Ç¥Ç¥Õ¥©¥ë¥È
+	//
+	function sendRequest(callback,data,method,url,async,sload)
+	{
+	
+		//XMLHttpRequest¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+		var oj = createHttpRequest()
+		if( oj == null ) return null
+		
+		//¶¯À©¥í¡¼¥É¤ÎÀßÄê
+		var sload = (!!sendRequest.arguments[5])?sload:false;
+		if(sload)url=url+"?t="+(new Date()).getTime()
+
+		//¥Ö¥é¥¦¥¶È½Äê
+		var ua = navigator.userAgent
+		var safari	= ua.indexOf("Safari")!=-1
+		var konqueror = ua.indexOf("Konqueror")!=-1
+		var mozes	 = ((a=navigator.userAgent.split("Gecko/")[1] )
+				?a.split(" ")[0]:0) >= 20011128 
+		
+		//¼õ¿®½èÍý
+		//opera¤Ïonreadystatechange¤ËÂ¿½Å¥ì¥¹¥Ð¥°¤¬¤¢¤ë¤Î¤Çonload¤¬°ÂÁ´
+		//Moz,FireFox¤Ïoj.readyState==3¤Ç¤â¼õ¿®¤¹¤ë¤Î¤ÇÄÌ¾ï¤Ïonload¤¬°ÂÁ´
+		//Win ie¤Ç¤Ïonload¤ÏÆ°ºî¤·¤Ê¤¤
+		//Konqueror¤Ïonload¤¬ÉÔ°ÂÄê
+		//»²¹Íhttp://jsgt.org/ajax/ref/test/response/responsetext/try1.php
+		if(window.opera || safari || mozes){
+			oj.onload = function () { callback(oj) }
+		} else {
+		
+			oj.onreadystatechange =function () 
+			{
+				if ( oj.readyState == 4 ){
+					callback(oj)
+				}
+			}
+			
+		}
+
+		//URL¥¨¥ó¥³¡¼¥É
+		if(method == 'GET') {
+		
+			var encdata = ''
+			var datas = data.split('&')
+			for(i=0;i<datas.length;i++)
+			{
+				var dataq = datas[i].split('=')
+				encdata += '&'+encodeURI(dataq[0])+'='+encodeURI(dataq[1])
+			}
+			url=url + encodeURI(data)
+		}		
+
+		//open ¥á¥½¥Ã¥É
+		oj.open( method , url , async )
+
+		//¥Ø¥Ã¥À¥»¥Ã¥È
+		if(method == 'POST') {
+			//¤³¤Î¥á¥½¥Ã¥É¤¬Win Opera8¤Ç¥¨¥é¡¼¤Ë¤Ê¤Ã¤¿¤Î¤ÇÊ¬´ô
+			if(!window.opera)
+				oj.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
+		} 
+
+		//send ¥á¥½¥Ã¥É
+		oj.send(data)
+
+	}
Index: /temp/trunk/html/test/kakinaka/ajax/eigo.txt
===================================================================
--- /temp/trunk/html/test/kakinaka/ajax/eigo.txt	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/ajax/eigo.txt	(revision 1328)
@@ -0,0 +1,1 @@
+[['%E5%90%8D%E5%89%8D','%E5%9B%BD%E8%AA%9E'],['%E5%B1%B1%E7%94%B0','12'],['%E7%94%B0%E4%B8%AD','28'],['%E4%B8%AD%E5%B1%B1','56'],['%E5%B1%B1%E6%9C%AC','98'],['%E6%9C%AC%E4%BA%95','12'],['%E4%BA%95%E4%B8%8A','18'],['%E4%B8%8A%E5%B1%B1','48']]
Index: /temp/trunk/html/test/kakinaka/ajax/test1.html
===================================================================
--- /temp/trunk/html/test/kakinaka/ajax/test1.html	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/ajax/test1.html	(revision 1328)
@@ -0,0 +1,212 @@
+<html>
+<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
+<head>
+<title></title>
+</head>
+<body>
+
+<!-- »ÃÄêAjax¥é¥¤¥Ö¥é¥ê jslb_ajax04.js -->
+<script language = "JavaScript" 
+        charset = "EUC-JP"
+        src     = "/test/kakinaka/ajax/jslb_ajax04.js"></script>
+
+<!-- ¥Æ¡¼¥Ö¥ë½èÍýÍÑjs -->
+<script language = "JavaScript" 
+        charset = "EUC-JP"
+        src     = "/test/kakinaka/ajax/jslb_writetable.js"></script>
+        
+
+<script type=text/javascript>
+<!--
+
+// ¥Ç¡¼¥¿¥Õ¥¡¥¤¥ëÆâ¤ÎÇÛÎó¤ò½ñ¤­´¹¤¨¤ë¤À¤±¤Ç
+// ¥Æ¡¼¥Ö¥ë¤ò½ñ¤­´¹¤¨¤é¤ì¤Þ¤¹¡£
+
+//¥Æ¡¼¥Ö¥ë¤ò½ÐÎÏ¤¹¤ëDIV¤ÎIDÌ¾
+var outputDivId = 'tdiv'
+
+
+//====================================================================
+// Ajax½èÍý
+//
+
+var dataAry            // ¼õ¿®¤·¤¿¥Ç¡¼¥¿ÇÛÎó
+
+//¥ê¥¯¥¨¥¹¥ÈÁ÷¿®
+function setData(dataFileName,data)
+{
+	sendRequest(onloaded, data, 'POST', dataFileName, true, false);
+}
+
+//¼õ¿®»þ½èÍý
+function onloaded(res)
+{
+	var resdata = res.responseText
+	
+	//¥Ç¥³¡¼¥É¤Èeval¤·¤ÆJavaScript²½
+	eval('dataAry='+ decodeURIComponent(resdata));
+	writeTable(outputDivId,dataAry);
+}
+
+
+////
+// ¥Æ¡¼¥Ö¥ëÀ¸À®
+// @param  tableId       ÂÐ¾Ý¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤¹DIV¤ÎIDÌ¾
+// @param  dataAry     ¥Ç¡¼¥¿
+//
+function mkTabletest(tableId) 
+{
+	var table, tbody, tr, td, text, i ,j          ; // ¥í¡¼¥«¥ëÊÑ¿ô
+//	var row = dataAry.length                    ; // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¹Ô¿ô
+//	var col = dataAry[0].length                 ; // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿Îó¿ô
+	var mydoc = document                          ; // document¥ª¥Ö¥¸¥§¥¯¥È
+	var row = 5                    ; // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¹Ô¿ô
+	var col = 3                 ; // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿Îó¿ô
+	
+
+	//table¤ÈtbodyÍ×ÁÇ¤òÀ¸À®
+	table = mydoc.createElement("TABLE")
+	tbody = mydoc.createElement("TBODY")
+	
+	//table¤ØtbodyÍ×ÁÇ¤òÁÞÆþ¤·¤µ¤é¤Ë½ÐÎÏÍÑDIV¤ØÁÞÆþ
+	table.insertBefore(tbody, null)
+	document.getElementById(tableId).insertBefore(table, null)
+
+
+	//¹Ô¤Î½èÍý
+	for (i=0; i<row; i++) {
+		tr	 = mydoc.createElement("TR")
+		tbody.insertBefore(tr, null)
+	
+		//Îó¤Î½èÍý
+		for (j=0; j<col; j++) {
+			td	 = mydoc.createElement("TD")
+			text = mydoc.createTextNode(j)
+			//text = "<INPUT TYPE=text NAME=sample>
+			tr.insertBefore(td, null)
+			td.insertBefore(text, null)
+			
+			div = mydoc.createElement("input");
+			td.insertBefore(div, null)
+			
+			div.setAttribute('name','col0:'+i+j);
+			div.setAttribute('type','text');
+			
+			
+			//¸«½Ð¤·¥»¥ë(1ÎóÌÜ¤È1¹ÔÌÜ)¤Ë´Ø¤¹¤ëCSSÍÑclassÌ¾¤òÀßÄê
+			var className=(typeof ScriptEngine=='function')?'className':'class';
+			
+			// 1ÎóÌÜ
+			if(j==0)td.setAttribute(className,'col0')
+			// 2ÎóÌÜ (À®ÀÓ)
+			if(j==1)td.setAttribute(className,'col1')
+			// 1¹ÔÌÜ
+			if(i==0)td.setAttribute(className,'row0')
+		}
+	}
+	return table
+}
+
+function RemoveTextBox() {
+  var obj = document.getElementById("tdiv");
+  var objs = document.getElementsByTagName("input");
+
+  for(var ctr = objs.length - 1; ctr >= 0; ctr--) {
+    if(objs[ctr].type == "text") {
+      obj.removeChild(objs[ctr]);
+//      break;
+    }
+  }
+}
+
+
+function getall(){
+  var objs = document.getElementsByTagName("input");
+
+  for(var ctr = objs.length - 1; ctr >= 0; ctr--) {
+	alert(objs[ctr].name);
+  }
+}
+
+
+//-->
+</script>
+
+<body>
+<input type="button" onclick="getall()" value="getall">
+¡¡¤³¤Î¥µ¥ó¥×¥ë¤Ï¡¢Á°²ó¤È¤Þ¤Ã¤¿¤¯Æ±¤¸Æ°ºî¤Ç¤¹¡£¡Ö»»¿ô¡×¡Ö¹ñ¸ì¡×¤Ê¤É¤Î¥ê¥ó¥¯¤Ë¿¨¤ë¤È¡¢À®ÀÓÉ½¤¬ÀÚ¤êÂØ¤ï¤ê¤Þ¤¹¡£°ã¤¦¤Î¤Ï¡¢ÀÚ¤êÂØ¤ï¤ë¥Ç¡¼¥¿¤ò¡¢PHP¤¬¥Õ¥¡¥¤¥ë¤«¤é¼è¤ê½Ð¤·¡¢JavaScript¤¬HTML²½¤·¤Æ¤¤¤ë¤È¤¤¤¦¤³¤È¤Ç¤¹¡£ 
+<br>
+<br>
+<div style="margin-left : 40px">
+
+<a href="javascript:void(0)" 
+	 onmouseover="mkTabletest('tdiv');">test</a> | 
+	 
+<a href="javascript:void(0)" 
+	 onmouseover="setData('./test1.php','&fn=sansu')">»»¿ô</a> | 
+<a href="javascript:void(0)" 
+	 onmouseover="setData('./test1.php','&fn=kokugo')">¹ñ¸ì</a> | 
+<a href="javascript:void(0)" 
+	 onmouseover="setData('./test1.php','&fn=rika')">Íý²Ê</a> | 
+<a href="javascript:void(0)" 
+	 onmouseover="setData('./test1.php','&fn=syakai')">¼Ò²ñ</a> | 
+<a href="javascript:void(0)" 
+	 onmouseover="setData('./test1.php','&fn=eigo')">±Ñ¸ì</a> |  |  
+
+<a href="javascript:void(0)" 
+	 onmouseover="reWriteTable(outputDivId,dataAry,sortD)">¢§¹ß½ç</a> | 
+<a href="javascript:void(0)" 
+	 onmouseover="reWriteTable(outputDivId,dataAry,sortA)">¢¥¾º½ç</a> | 
+</div>
+<input type="button" onclick="RemoveTextBox();" value="clear">
+
+
+
+<!-- ¥Æ¡¼¥Ö¥ëÍÑCSS -->
+<style>
+<!--
+#tdiv {
+	margin-left      : 40px     ;
+}
+/* ÂÐ¾Ý¥Æ¡¼¥Ö¥ë */
+#tdiv table  { 
+	margin           : 20px     ;
+	border : solid 1px #bbbbbb  ;
+	border-collapse  : collapse ;
+	border-spacing   : 0px      ;
+}
+/* 1¹ÔÌÜ */
+#tdiv .row0  { 
+	padding          : 8px      ;
+	font-size        : 0.9em    ;
+	font-weight      : 900      ;
+	background-color : #6666cc  ;
+	color            : #ffffff  ;
+}
+/* 1ÎóÌÜ (Ì¾Á°) */
+#tdiv .col0  {  
+	background-color : #ffcc00  ;
+}
+/* 2ÎóÌÜ (À®ÀÓ) */
+#tdiv .col1  {  
+	font-size        : 1em      ;
+	font-weight      : 900      ;
+	background-color : #dddddd  ;
+}
+/* Á´¥»¥ë */
+#tdiv td  { 
+	padding          : 4px      ;
+	font-size        : 0.9em    ;
+	border : solid 1px #bbb     ;
+	border-spacing   : 0px      ;
+}
+
+-->
+</style>
+
+<!-- ¤³¤ÎDIV¤Ø¥Æ¡¼¥Ö¥ë¤ò½ÐÎÏ¤·¤Þ¤¹ -->
+<div id="tdiv"></div>
+
+<br>
+<br></body>
+</html>
Index: /temp/trunk/html/test/kakinaka/ajax/test1.php
===================================================================
--- /temp/trunk/html/test/kakinaka/ajax/test1.php	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/ajax/test1.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+/*
+	//POST¤ò¼èÆÀ
+	$filename = $_POST['fn'] ;
+	
+	//¥Õ¥¡¥¤¥ë¥Ç¡¼¥¿¤òÆÉ¤ß¹þ¤à
+	$data = file_get_contents('./'.$filename.'.txt');
+	
+	//URI¥¨¥ó¥³¡¼¥É
+	$data  = rawurlencode($data);
+
+	
+	
+*/
+	$data = $_POST['fn'];
+	
+	//½ÐÎÏcharset¤òut-8¤Ë
+	mb_http_output ( 'EUC-JP' );
+	//¥Ø¥Ã¥À
+	header ("Content-Type: text/html; charset=EUC-JP"); 
+	//½ÐÎÏ
+	echo($data);
+?> 
Index: /temp/trunk/html/test/kakinaka/ajax/jslb_writetable.js
===================================================================
--- /temp/trunk/html/test/kakinaka/ajax/jslb_writetable.js	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/ajax/jslb_writetable.js	(revision 1328)
@@ -0,0 +1,143 @@
+//====================================================================
+// ¥Æ¡¼¥Ö¥ë½èÍýÍÑ¥é¥¤¥Ö¥é¥ê jslb_writetable.js
+//
+// ºÇ¿·¾ðÊó http://jsgt.org/mt/archives/01/000414.html 
+// ¾åµ­¥³¥á¥ó¥Èºï½üÉÔ²Ä¡£¾¦ÍÑÍøÍÑ¡¢²þÂ¤¡¢¼«Í³¡£Ï¢ÍíÉÔÍ×¤Ç¤¹¡£
+// 
+
+////
+// ¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤·¤Þ¤¹
+// @param  tableId       ÂÐ¾Ý¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤¹DIV¤ÎIDÌ¾
+// @param  dataAry       ¥Ç¡¼¥¿ Æó¼¡¸µÇÛÎó¤ÇÅÏ¤·¤Þ¤¹
+// @sample               writeTable('tdiv',[['Ì¾Á°','data'],['»³ÅÄ','12']])
+//
+function writeTable(tableId,dataAry)
+{
+	//°ú¿ô¤¬¤¢¤ì¤Ð²¼µ­¤ò¼Â¹Ô
+	if(!!writeTable.arguments[0]){
+		removeTable(tableId)       ; //¥Æ¡¼¥Ö¥ëºï½ü
+		mkTable(tableId,dataAry)   ; //¥Æ¡¼¥Ö¥ëÀ¸À®
+		mkGraph(tableId)           ; //¥°¥é¥ÕÀ¸À®
+	}
+}
+
+////
+// ¥Æ¡¼¥Ö¥ë¤ò¥½¡¼¥È¤·¤Æ½ñ¤­½Ð¤·¤Þ¤¹
+// @param  tableId       ÂÐ¾Ý¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤¹DIV¤ÎIDÌ¾
+// @param  dataAry       ¥Ç¡¼¥¿
+// @param  sortFunc      ¿ôÃÍ¥½¡¼¥È´Ø¿ôÌ¾ ¾º½çsortA|¹ß½çsortD
+// @sample               reWriteTable('tdiv',[['Ì¾Á°','data'],['a',8],['b',3]],sortD)
+//
+function reWriteTable(tableId,dataAry,sortFunc)
+{
+	sortwk(dataAry,sortFunc)
+	writeTable(tableId,dataAry)
+}
+
+
+////
+// ÂÐ¾Ý¥Æ¡¼¥Ö¥ëºï½ü
+// @param  tableId       ÂÐ¾Ý¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤¹DIV¤ÎIDÌ¾
+//
+function removeTable(tableId){
+	document.getElementById(tableId).innerHTML=''
+}
+
+////
+// ¥°¥é¥ÕÄÉ²Ã
+// @param  tableId       ÂÐ¾Ý¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤¹DIV¤ÎIDÌ¾
+//
+function mkGraph(tableId)
+{
+	var i,td,img                                  ; // ¥í¡¼¥«¥ëÊÑ¿ô
+	var mydoc	= document                        ; // document¥ª¥Ö¥¸¥§¥¯¥È
+	var table	= mydoc.getElementById(tableId)   ; // ÂÐ¾Ý¥Æ¡¼¥Ö¥ë
+	var trs		= table.getElementsByTagName('TR'); // ÂÐ¾Ý¥Æ¡¼¥Ö¥ë²¼¤ÎTRÇÛÎó
+
+	// TR¤ò1¹Ô¤º¤Ä½èÍý
+	for( i = 1 ; i < trs.length ; i++)
+	{
+		//¥°¥é¥ÕÍÑ¥Ç¡¼¥¿¤òÁ°¤Î¥»¥ë¤«¤é¼èÆÀ
+		forGraphData = trs.item(i).childNodes.item(1).firstChild.nodeValue
+		//TD¤È²èÁü¤òÀ¸À®
+		td	 = mydoc.createElement("TD")
+		img	= mydoc.createElement("IMG")
+		img.setAttribute('src','./bar1.gif')
+		img.setAttribute('height', 20 )
+		img.setAttribute('width', forGraphData )
+		//¥°¥é¥ÕÍÑTD¤È²èÁü¤òÁÞÆþ
+		trs.item(i).insertBefore(td, null).insertBefore(img, null)
+	}
+
+}
+
+////
+// ¥Æ¡¼¥Ö¥ëÀ¸À®
+// @param  tableId       ÂÐ¾Ý¥Æ¡¼¥Ö¥ë¤ò½ñ¤­½Ð¤¹DIV¤ÎIDÌ¾
+// @param  dataAry     ¥Ç¡¼¥¿
+//
+function mkTable(tableId,dataAry) 
+{
+	if(!dataAry)return 
+	var table, tbody, tr, td, text, i ,j          ; // ¥í¡¼¥«¥ëÊÑ¿ô
+	var row = dataAry.length                    ; // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¹Ô¿ô
+	var col = dataAry[0].length                 ; // ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿Îó¿ô
+	var mydoc = document                          ; // document¥ª¥Ö¥¸¥§¥¯¥È
+
+	//table¤ÈtbodyÍ×ÁÇ¤òÀ¸À®
+	table = mydoc.createElement("TABLE")
+	tbody = mydoc.createElement("TBODY")
+
+	//table¤ØtbodyÍ×ÁÇ¤òÁÞÆþ¤·¤µ¤é¤Ë½ÐÎÏÍÑDIV¤ØÁÞÆþ
+	table.insertBefore(tbody, null)
+	document.getElementById(tableId).insertBefore(table, null)
+
+	//¹Ô¤Î½èÍý
+	for (i=0; i<row; i++) {
+		tr	 = mydoc.createElement("TR")
+		tbody.insertBefore(tr, null)
+
+		//Îó¤Î½èÍý
+		for (j=0; j<col; j++) {
+			td	 = mydoc.createElement("TD")
+			text = mydoc.createTextNode(dataAry[i][j])
+			tr.insertBefore(td, null)
+			td.insertBefore(text, null)
+
+			//¸«½Ð¤·¥»¥ë(1ÎóÌÜ¤È1¹ÔÌÜ)¤Ë´Ø¤¹¤ëCSSÍÑclassÌ¾¤òÀßÄê
+			var className=(typeof ScriptEngine=='function')?'className':'class';
+			// 1ÎóÌÜ
+			if(j==0)td.setAttribute(className,'col0')
+			// 2ÎóÌÜ (À®ÀÓ)
+			if(j==1)td.setAttribute(className,'col1')
+			// 1¹ÔÌÜ
+			if(i==0)td.setAttribute(className,'row0')
+		}
+	}
+
+	return table
+}
+
+//====================================================================
+// ÊÂ¤ÙÂØ¤¨
+//
+
+////
+// ÊÂ¤ÙÂØ¤¨
+// @param  dataAry       ÊÂ¤ÙÂØ¤¨ÂÐ¾ÝÇÛÎó
+// @param  sortFunc      ¿ôÃÍ¥½¡¼¥È´Ø¿ôÌ¾ ¾º½çsortA|¹ß½çsortD
+//
+function sortwk(dataAry,sortFunc)
+{
+	if(!dataAry)return 
+	var head = dataAry[0] ;
+	dataAry.shift()
+	dataAry.sort(sortFunc)
+	dataAry.unshift(head)
+	return dataAry
+}
+
+//¿ôÃÍ¥½¡¼¥È¾º½ç
+function sortA(a,b){ return a[1] - b[1] }
+//¿ôÃÍ¥½¡¼¥È¹ß½ç
+function sortD(a,b){ return b[1] - a[1] }
Index: /temp/trunk/html/test/kakinaka/phpdoc.php
===================================================================
--- /temp/trunk/html/test/kakinaka/phpdoc.php	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/phpdoc.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+* ¥Õ¥¡¥¤¥ë¤ÎÀâÌÀ (°ì¹Ô)
+*
+* ¥Õ¥¡¥¤¥ë¤ÎÀâÌÀ (Ê£¿ô¹Ô)
+* HTML¤ËÈ¿±Ç¤µ¤ì¤¿¤È¤­²þ¹Ô¤Ï¤µ¤ì¤Ê¤¤
+* @package ¥Ñ¥Ã¥±¡¼¥¸
+* @author Ãøºî¼Ô
+* @version 1.00
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+?>
Index: /temp/trunk/html/test/kakinaka/phpinfo.php
===================================================================
--- /temp/trunk/html/test/kakinaka/phpinfo.php	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/phpinfo.php	(revision 1328)
@@ -0,0 +1,6 @@
+<?php
+
+phpinfo();
+
+
+?>
Index: /temp/trunk/html/test/kakinaka/file/file.php
===================================================================
--- /temp/trunk/html/test/kakinaka/file/file.php	(revision 1328)
+++ /temp/trunk/html/test/kakinaka/file/file.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+require_once("../../../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '../../../css/test.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'test/kakinaka/file/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+if ($_POST['css_main'] == ""){
+	$fp = fopen($objPage->tpl_css, "r");
+	$css = fread($fp, filesize($objPage->tpl_css));
+}else{
+	$fp = fopen($objPage->tpl_css, "w");
+	fwrite($fp, $_POST['css_main']);
+}
+
+$objPage->css = $css;
+
+fclose($fp);
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/test/nakatest/dragdrop/files/style.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/files/style.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/files/style.js	(revision 1328)
@@ -0,0 +1,23 @@
+
+var d = document;
+var n = navigator;
+var Mac = n.appVersion.indexOf('Mac');
+var MSIE = n.userAgent.indexOf('MSIE');
+var Safari = n.userAgent.indexOf('Safari');
+var Netscape = n.userAgent.indexOf('Netscape');
+var css = null;
+	
+if(Mac>-1){
+	if((Safari>1)||(MSIE>1)){
+		css = 'mac-webkit.css';
+	}else{
+		css = 'mac.css';
+	}
+}else{
+	if(MSIE>1){
+		css = 'win-ie.css';
+	}else{
+		css = 'win.css';
+	}
+}
+d.write('<link rel="stylesheet" href="/drecomcms/css/' + css + '" type="text/css">\n');
Index: /temp/trunk/html/test/nakatest/dragdrop/files/common.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/files/common.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/files/common.js	(revision 1328)
@@ -0,0 +1,466 @@
+/*
+ * ¶¦ÄÌ JavaScript
+ *
+ *
+ * Copyright (c) 2003 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * ¥Ö¥é¥¦¥¶²èÌÌÎÎ°è¤ÎÉý¤ò¼èÆÀ
+ */
+function getWidth(win)
+{
+	var tmp_width;
+    
+	if (win.document.documentElement) { 
+		tmp_width = win.document.documentElement.clientWidth;
+		if (tmp_width > 0) {
+			return tmp_width;
+		}
+	}
+    if (win.document.all) {
+    	tmp_width = win.document.body.clientWidth;
+		return tmp_width;
+	}
+	return win.innerWidth;
+}
+       
+/**
+ * ¥Ö¥é¥¦¥¶²èÌÌÎÎ°è¤Î¹â¤µ¤ò¼èÆÀ
+ */
+function getHeight(win)
+{
+	var tmp_height;
+    
+	if (win.document.documentElement) {
+		tmp_height = win.document.documentElement.clientHeight;
+		if (tmp_height > 0) {
+			return(tmp_height);
+		}
+	}
+    if (win.document.all) {
+		return(win.document.body.clientHeight);
+	}
+	return(win.innerHeight);
+}
+
+/**
+ * Window¤òÃæ¿´¤Ë°ÜÆ°
+ */
+function moveWindowToCenter(win) {
+	x = (screen.width  - getWidth(win)) / 2;
+	y = (screen.height - getHeight(win)) / 2;
+	win.moveTo(x,y);
+}
+
+/**
+ * ¾ï¤Ë¼êÁ°¤ËÉ½¼¨¤¹¤ë¥¦¥£¥ó¥É¥¦¤ò³«¤¯
+ */
+function openModalWindow(url, name, height, width, scrollbars, resizable, status)
+{
+	ModalWindow = openWindow(url, name, height, width, scrollbars, resizable, status);
+	onfocus = function onFocus(){
+		if (null !=ModalWindow && !ModalWindow.closed) {
+			try {
+				ModalWindow.focus();
+			} catch(e) {
+				document.onmousemove = null;
+			}
+		} else {
+			document.onmousemove = null;
+		}
+	}
+	
+	document.onmousemove = onfocus;
+	
+	return ModalWindow;
+}
+
+/**
+ * ¥¦¥£¥ó¥É¥¦¤ò³«¤¯
+ */
+function openWindow(url, name, height, width, scrollbars, resizable, status, left, top)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					((left) ? ",left=" + left : "") + ((top) ? ",top=" + top : "") +
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status;
+
+	subWindow = window.open(url, name, window_condition);
+	// ¥Ý¥Ã¥×¥¢¥Ã¥×¥Ö¥í¥Ã¥«¡¼¤Ê¤É¤Ç¥Ö¥í¥Ã¥¯¤µ¤ì¤¿¾ì¹ç¤ËJavaScript¥¨¥é¡¼¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë
+	if (subWindow) {
+		subWindow.focus();
+	}
+
+	return subWindow;
+}
+
+/**
+ * ¥¦¥£¥ó¥É¥¦¤ò¸å¤í¤Ë³«¤¯
+ */
+function openWindowBack(url, name, height, width, scrollbars, resizable, status)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status +
+					",left=" + window.screen.width;
+	subWindow = window.open(url, name, window_condition);
+	subWindow.blur();
+	window.focus();
+	subWindow.moveTo(0,0);
+	return subWindow;
+}
+
+/**
+ * Esc¥­¡¼¤Ç¥¦¥£¥ó¥É¥¦¤òÊÄ¤¸¤ë¥¤¥Ù¥ó¥È
+ * 
+ * ¢¨¥µ¥Ö¥¦¥£¥ó¥É¥¦¤Îonload¤Ç
+ *   document.body.onkeypress = subwinCloseOnEsc;
+ * ¤Î¤è¤¦¤Ë»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£
+ */
+function subwinCloseOnEsc(ev)
+{
+	ev || (ev = window.event);
+	if (ev.keyCode == 27) {
+		window.close();
+		return false;
+	}
+	return true;
+}
+
+
+
+// 2004-06-09 Takanori Ishikawa 
+// -----------------------------------------------------------
+// htmlAlert(), htmlConfirm() ¤Ï html ¤ò¤½¤Î¤Þ¤Þ
+// ½ÐÎÏ¤»¤º¡¢¥µ¥Ë¥¿¥¤¥º¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+// sanitize html message
+function sanitize_msg(msg)
+{
+	msg = msg.replace(/</g, '&lt;');
+	msg = msg.replace(/>/g, '&gt;');
+	msg = msg.replace(/&lt;br\s*&gt;/g, '<br>');
+
+	return msg;
+}
+// alert
+function htmlAlert(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	msg = sanitize_msg(msg);
+	
+	if (defined(window.showModalDialog)) {
+		showModalDialog("/drecomcms/html/message_box.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+  	} else {
+		dialogArguments = msg;
+		ModalWindow = open("/drecomcms/html/message_box.html", "sub_alert","height=" + height + ",width=" + width + 
+					",scrollbars=no,resizable=no,toolbar=no,status=no,alwaysRaised=yes");
+		onfocus = function onFocus(){
+			if (null !=ModalWindow && !ModalWindow.closed) {
+				ModalWindow.focus();
+			}
+		}
+		document.onmousemove = onfocus;
+		return ModalWindow;
+	}
+}
+// confirm
+function htmlConfirm(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	if (defined(window.showModalDialog)) {
+		var value = showModalDialog("/drecomcms/html/confirm.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+		if (typeof value == "undefined") {
+			value = false;
+		} 
+		return value;
+	} else {
+		return window.confirm(msg.replace(/<br[^>]*\/?>/, '\n'));
+	}
+}
+
+/**
+  * ÍËÆü¤ò¼èÆÀ¤¹¤ë´Ø¿ô
+  * year:  Ç¯
+  * month: ·î
+  * day:   Æü
+  */
+function getDayOfWeek(year, month, day) {
+
+	DateOfWeek	= new Date();
+	DateOfWeek.setYear(year);
+	DateOfWeek.setMonth(month - 1);
+	DateOfWeek.setDate(day);
+	day_of_week_number	= DateOfWeek.getDay();
+
+	days = new Array('Æü','·î','²Ð','¿å','ÌÚ','¶â','ÅÚ');
+	return days[day_of_week_number];
+}
+
+
+// -----------------------------------------------------------
+// ¥Ý¡¼¥¿¥ë¡¢¥Ø¥Ã¥À
+// -----------------------------------------------------------
+/**
+ * INPUT FORM ¤ÎÇØ·Ê¿§ÊÑ¹¹
+ */
+function focusForm(obj,flag){
+	if (obj == null || obj.style == null) {
+		return;	
+	}
+	obj.style.backgroundColor = flag ? '#FFFFCC' : '#FFFFFF' 
+}
+function Skinup(fnr){
+	win = window.open('/contents/skinpop_'+fnr,'skin','width=455,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
+	win.focus();
+}
+function imgSwap(name,gifPath) {
+	document.images[name].src = gifPath ;
+}
+
+
+// -----------------------------------------------------------
+// ²èÁü
+// -----------------------------------------------------------
+/**
+ * ²èÁü¤ÎÉ½¼¨¥µ¥¤¥ºÄ´À°
+ */
+function adjustImageSize(imgElementName, widthMax, heightMax) {
+	var imgs = document.getElementsByName(imgElementName);
+	if (imgs) {
+		if (!imgs.length) {
+			if (widthMax && imgs.width > widthMax) {
+				imgs.height = imgs.height * widthMax / imgs.width;
+				imgs.width = widthMax;
+			}
+			if (heightMax && imgs.height > heightMax) {
+				imgs.width = imgs.width * heightMax / imgs.height;
+				imgs.height = heightMax;
+			}
+		} else {
+			for (i=0; i<imgs.length; i++) {
+				if (widthMax && imgs[i].width > widthMax) {
+					imgs[i].height = imgs[i].height * widthMax / imgs[i].width;
+					imgs[i].width = widthMax;
+				}
+				if (heightMax && imgs[i].height > heightMax) {
+					imgs[i].width = imgs[i].width * heightMax / imgs[i].height;
+					imgs[i].height = heightMax;
+				}
+			}
+		}
+	}
+}
+
+/**
+ * ËÜÊ¸¤ÎHTML¥½¡¼¥¹¤è¤ê³°Éô²èÁüURL("http://¡Á")¤òPickUp
+ */
+function getExternalImageList(orgHtml) {
+
+	var extImageList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+	
+	exp = new RegExp("<img [^>]*src=[\"']?http://[^\"']*[\"']?[^>]*>", 'ig');
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("src=[\"']?");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp("[\"'\\s>]|/>");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+				
+				var isExist = false;
+				for (var j = 0; j < extImageList.length; j++) {
+					if (extImageList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extImageList[n++] = str; }
+			}
+		}
+	}
+	return extImageList;
+}
+
+/**
+ * ËÜÊ¸¤ÎHTML¥½¡¼¥¹¤è¤ê³°ÉôFlashURL("http://¡Á")¤òPickUp
+ */
+function getExternalFlashList(orgHtml) {
+
+	var extFlashList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+
+	var flashTag = "\\{\\\$CMSInclude [^\\\$\\}]*name=\"flash\"\\s*param=\"[^\"]*Movie=http://[^\"]*\"\\s*\\\$\\}";	
+	exp = new RegExp(flashTag, 'ig');	
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("Movie=");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp(";");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+
+				var isExist = false;				
+				for (var j = 0; j < extFlashList.length; j++) {
+					if (extFlashList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extFlashList[n++] = str; }
+			}
+		}
+	}
+	return extFlashList;
+}
+ 
+/**
+ * ¥ê¥ó¥¯¤ÎÁ«°ÜÀè¤òÌµ¸ú¤Ë¤¹¤ë¡£
+ * ¡Ê<a>¥¿¥°¤ÎhrefÂ°À­¤ò"javascript:void(0)"¤ËÃÖ´¹¡Ë
+ */
+function replaceLinkInvalid(html) {
+	html = html.replace(/<a [^>]*>/ig, '<a href="javascript:void(0);">');
+	html = html.replace(/openPermLink\([^)]*\)/ig, 'void(0)');
+	return html;
+}
+
+/**
+ * URLÍÑ¤Î¥¨¥¹¥±¡¼¥×¤ò¹Ô¤¤¤Þ¤¹¡£
+ * '&' -> '&amp;'
+ * '>' -> '&gt;'
+ * '<' -> '&lt;'
+ * '"' -> '&quot;'
+ * Î¾Ã¼¤Î¶õÇò¤Ï Trim
+ * ' ' -> '%20'
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ escapeUrl(/*: String :*/ src) {
+	var s = replaceAll(src, '&', '&amp;');
+	s = replaceAll(s, '>', '&gt;');
+	s = replaceAll(s, '<', '&lt;');
+	s = replaceAll(s, '"', '&quot;');
+	s = trim(s);
+	s = replaceAll(s, ' ', '%20');
+	return s;
+}
+function /*: String :*/ escapeScript(/*: String :*/ src) {
+	var s = replaceAll(src, "\\", "\\\\");
+	s = replaceAll(s, "'", "\\'");
+	s = replaceAll(s, "\"", "\\\"");
+	return s;
+}
+/**
+ * Ê¸»úÎó¤ÎÁ´ÃÖ´¹¤ò¹Ô¤¤¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ * @param oldc µìÊ¸»úÎó
+ * @param newc ¿·Ê¸»úÎó
+ */
+function /*: String :*/ replaceAll(/*: String :*/src, /*: String :*/oldc, /*: String :*/newc) {
+ var h = "";
+ var b = src;
+ var index = 0;
+ while (true) {
+  index = b.indexOf(oldc, 0);
+  if (index == -1) {
+   break;
+  }
+  src = b.replace(oldc, newc);
+  h += src.substring(0, index + newc.length);
+  b = src.substring(index + newc.length, src.length);
+ }
+ return h + b;
+}
+/**
+ * Î¾Ã¼¤ÎÈ¾³Ñ/Á´³Ñ¥¹¥Ú¡¼¥¹¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ trim(/*: String :*/src ) {
+	var s = trimR(src);
+	return trimL(s);
+}
+/**
+ * ±¦Ã¼¤ÎÈ¾³Ñ/Á´³Ñ¥¹¥Ú¡¼¥¹¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ trimR(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(strFinal.length - 1, strFinal.length) == " ") || (strFinal.substring(strFinal.length - 1, strFinal.length) == "¡¡")) {
+			strFinal = strTemp.substring(0, strTemp.length - (nLoop + 1));
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+/**
+ * º¸Ã¼¤ÎÈ¾³Ñ/Á´³Ñ¥¹¥Ú¡¼¥¹¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
+ * @param src ÂÐ¾ÝÊ¸»úÎó
+ */
+function /*: String :*/ trimL(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(0, 1) == " ") || (strFinal.substring(0, 1) == "¡¡")) {
+			strFinal = strTemp.substring(nLoop + 1, strTemp.length );
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+
+/**
+ * ·Ñ¾µ
+ */
+function extend(subClass, superClass) {
+    for (var prop in superClass.prototype) {
+        subClass.prototype[prop] = superClass.prototype[prop];
+    }
+}
+
+
+/**
+ * ¥Ý¥Ã¥×¥¢¥Ã¥×¥Ö¥í¥Ã¥«¡¼ÂÐºö
+ * window.onPopupBlocked,window.onPopupNonBlocked¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¤¯¤À¤µ¤¤¡£
+ */
+window.onPopupBlocked = function(){
+	alert('¥¦¥£¥ó¥É¥¦¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£¥Ý¥Ã¥×¥¢¥Ã¥×¥Ö¥í¥Ã¥«¡¼¤òÍ­¸ú¤Ë¤·¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Ìµ¸ú¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£');
+};
+
+window.onPopupNonBlocked = function(){}
+
+if (typeof window.org_open == 'undefined'){
+	window.org_open = window.open;
+	window.open = function() {
+		var win = (2 == window.open.arguments.length)
+					? window.org_open(window.open.arguments[0], window.open.arguments[1])
+					: window.org_open(window.open.arguments[0], window.open.arguments[1], window.open.arguments[2]);
+		if (null == win) {
+			window.onPopupBlocked(window.open.arguments);
+		} else {
+			window.onPopupNonBlocked(window.open.arguments);
+		}
+		return win;
+	}
+}
+
+
Index: /temp/trunk/html/test/nakatest/dragdrop/files/access_key.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/files/access_key.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/files/access_key.js	(revision 1328)
@@ -0,0 +1,51 @@
+/*
+ * Access Key Utilities
+ *
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * ÊÝÂ¸¥·¥ç¡¼¥È¥«¥Ã¥È¤òÍ­¸ú¤Ë¤¹¤ë¤«¤É¤¦¤«¡£
+ * ¥·¥ç¡¼¥È¥«¥Ã¥È¤è¤ê¤âÀè¤Ë¡¢¥Ö¥é¥¦¥¶¤ÎÊÝÂ¸¥À¥¤¥¢¥í¥°¤¬½Ð¤ë¾ì¹ç¤ÏÌµ¸ú¤Ë¤¹¤ë¡£
+ * 
+ * @return ÊÝÂ¸¥·¥ç¡¼¥È¥«¥Ã¥È¤òÍ­¸ú¤Ë¤¹¤ë¤«¤É¤¦¤«
+ */
+function shortCutSupported()
+{
+	return (document.all != null && null == XBSUtil.opera);
+}
+
+function access_key_onkeydown_hock(theEvent) 
+{
+	if (false == shortCutSupported()) {
+		return true;
+	}
+
+	if (theEvent == null) {
+		theEvent = window.event;
+	}
+	var willCancel = false;
+	var k = XBSEvent.getKeyCode(theEvent);
+	var m = XBSEvent.getModifierFlags(theEvent);
+	if (m & XBSEvent.CONTROL_KEY_MASK){
+		if (k == 83) {  // 's'
+			execSave != null ? execSave() : void(0);
+			willCancel = true;
+		}
+	} else if (m & XBSEvent.ALT_KEY_MASK){
+		if (k == 80) {  // 'p'
+			execPrint != null ? execPrint() : void(0);
+			willCancel = true;
+		}
+	}
+	if (willCancel) {
+		theEvent.returnValue = false;
+		return false;
+	}
+	
+	return true;
+}
Index: /temp/trunk/html/test/nakatest/dragdrop/files/sidefunc_order.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/files/sidefunc_order.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/files/sidefunc_order.js	(revision 1328)
@@ -0,0 +1,1019 @@
+/**
+ * 
+ * ¥µ¥¤¥É¥Ð¡¼ÊÔ½¸ JavaScript
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+
+//---------------------------------------------------------------------------------
+// ÀßÄê
+//---------------------------------------------------------------------------------
+
+// *** ½é´üÀßÄêÊÑ¿ô *** //
+
+var gSidefuncOrderForm = null;
+var SIDEFUNC_ORDER_FORM_NAME = "SidefuncOrderForm";
+
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+//
+// Mac ¤Î IE5 ¤ÏºÂÉ¸´ØÏ¢¤Îµ¡Ç½¡Ê¤À¤±¤¸¤ã¤Ê¤¤¤±¤É¡Ë¤ÎÂ¿¤¯¤¬¶¸¤Ã¤Æ¤¤¤ë
+// ¤Î¤ÇÅ¬Åö¤ËÂÐ±þ
+//
+// »²¹Í¡§
+// Mac ¤Î¿©¤¨¤Ê¤¤ÌîÏº¤É¤â
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+var MAC_IE5_PITCH_X;
+var MAC_IE5_PITCH_Y;
+
+MAC_IE5_PITCH_X = MAC_IE5_PITCH_Y = 0;	/* BITCH */
+if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+	MAC_IE5_PITCH_X = -10;
+	MAC_IE5_PITCH_Y = 0;
+}
+
+
+// *** CheckLine *** //
+var CHECKLINE_ID = 'checkline';
+
+
+// --- Panel ---
+// ¼±ÊÌ»Ò
+var PANEL_NAME_DISABLE	= 'DISABLE';	// ³°µ¡Ç½BOX¤ÎID
+var PANEL_NAME_LEFT		= 'LEFT';		// Æâ¡¦º¸µ¡Ç½BOX¤ÎID
+var PANEL_NAME_RIGHT	= 'RIGHT';		// Æâ¡¦±¦µ¡Ç½BOX¤ÎID
+
+//¤¹¤Ù¤Æ¤Î Panel ¤ò¥×¥í¥Ñ¥Æ¥£¤Ë¤â¤Ä¥ª¥Ö¥¸¥§¥¯¥È
+// key ¤Ï name
+var gAllPanels         = new Object();
+
+// º¸¤«¤é¤Î½çÈÖ
+var gPanelNames         = [PANEL_NAME_DISABLE, PANEL_NAME_LEFT, PANEL_NAME_RIGHT];
+
+
+// --- Box ---
+var BOX_ID_PREFIX 		= 'f';			// Box ¤Î ID ¥×¥ê¥Õ¥£¥Ã¥¯¥¹
+var BoxConfig = {
+	width: 		120,	// Box Éý
+	height: 	20,		// Box ¹â¤µ
+	padding: 	10,		// Box ´Ö¤Î¥¹¥Ú¡¼¥¹
+	marginTop: 	5,		// °ìÈÖ¾å¤ÎBox¤È¿Æ¥Ñ¥Í¥ë¤È¤Î¥¹¥Ú¡¼¥¹
+	marginLeft: 5		// Box ¤È¿Æ¥Ñ¥Í¥ë¤Îº¸Â¦¤Î¥¹¥Ú¡¼¥¹
+};
+
+// Box ÇÛÃÖÎÎ°è¤ÎºÇ¾®¹â¤µ
+var MIN_BOXIES_HEIGHT	= 200;
+
+// ¤¹¤Ù¤Æ¤Î Box ¤ò¥×¥í¥Ñ¥Æ¥£¤Ë¤â¤Ä¥ª¥Ö¥¸¥§¥¯¥È
+var gAllBoxes           = new Object();
+
+/**
+ * ¥Ñ¥Í¥ë¤Ë³ÊÇ¼¤Ç¤­¤ëºÇÂç Box ¿ô¤òµ­Ï¿¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * key: ¥Ñ¥Í¥ëÌ¾ value: ¥Ñ¥Í¥ë¤Ë³ÊÇ¼¤Ç¤­¤ëºÇÂç Box ¿ô
+ * 
+ */
+
+BoxConfig.maxNBoxes = new Object();
+BoxConfig.maxNBoxes[PANEL_NAME_DISABLE]	= OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES;	// ¡Ö»ÈÍÑ¤·¤Ê¤¤µ¡Ç½¡×
+BoxConfig.maxNBoxes[PANEL_NAME_LEFT]	= OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES;		// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×º¸
+BoxConfig.maxNBoxes[PANEL_NAME_RIGHT]	= OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES;		// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×±¦
+
+/**
+ * ¥Ú¡¼¥¸ÆÉ¤ß¹þ¤ß»þ¤ÎÇÛÃÖ¥Ç¡¼¥¿
+ */
+gInitialBoxPositionsData = null;
+
+//---------------------------------------------------------
+// ÇÛÃÖ¤Ê¤É
+//---------------------------------------------------------
+/**
+ * HTML ¤Î hidden input Í×ÁÇ¤«¤é¹àÌÜ¤ÎÇÛÃÖ¤Ê¤É¤Î¾ðÊó¤òÆÉ¤ß¼è¤ë¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+SFSettings = new Object();
+
+/**
+ * HTML ¤Î hidden input Í×ÁÇ¤«¤éÀßÄêÃÍ¤òÆÉ¤ß¼è¤ë
+ */
+SFSettings.loadBoxPositions = function()
+{
+	var positions = new Object();
+	var orders       = new Array();
+	var panelNames   = new Array();	
+	
+	// hidden¤«¤ébox_position¤ò¼èÆÀ
+	positions[PANEL_NAME_DISABLE]	= new Array();
+	positions[PANEL_NAME_LEFT]		= new Array();
+	positions[PANEL_NAME_RIGHT]		= new Array();
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			var idx = XBSUtil.parseIntNoError(elem.value);
+			panelNames[panelNames.length] = gPanelNames[idx];
+		} else if (Box.ID_PROPERTY_NAME == elem.name) {
+			;
+		}
+	}
+	for (var i = 0; i < orders.length; i++) {
+		var pnm = panelNames[i];
+		var bid = i;
+		var ord = orders[i];
+		
+		positions[pnm][bid] = ord;
+	}
+	
+	orders     = null;
+	panelNames = null;
+	return positions;
+}
+
+/**
+ * ¸½ºß¤Î¾õÂÖ¤òÃ±°ì¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¨¥ó¥³¡¼¥É¤·¤ÆÊÖ¤¹¡£
+ */
+SFSettings.getObjectForPersistent = function()
+{
+	var orders = new Array();
+	var pidxes = new Array();
+	var result = '';
+	
+	if (gSidefuncOrderForm == null) {
+		return result;
+	}
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			pidxes[pidxes.length] = XBSUtil.parseIntNoError(elem.value);
+		}
+	}
+	result += pidxes.join('');
+	result += orders.join('');
+	pidxes = null;
+	orders = null;
+	
+	return result;
+}
+
+//---------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------
+/**
+ * ¥µ¥¤¥É¥Ð¡¼¤ÎÊÑ¹¹¤ò´Æ»ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È
+ * ContentsChangedListener ¤Î¥µ¥Ö¥¯¥é¥¹
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+function SFChangedListener(/* Optional */ aName) /* extends ContentsChangedListener */
+{
+}
+SFChangedListener.prototype = new ContentsChangedListener();
+SFChangedListener.prototype.setChanged = function(b) 
+{
+	var persistent = SFSettings.getObjectForPersistent();
+	
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// ¤³¤³¤Ç prototype ¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤â¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¡£
+
+	this.changed = (gInitialBoxPositionsData != persistent);
+}
+
+//---------------------------------------------------------
+// Drag & Drop: SFDragManager (Sidebar Function DragManager)
+//---------------------------------------------------------
+/**
+ * ¥É¥é¥Ã¥°½èÍý¤ÎÍ­¸ú²½¡¢ÅÓÃæ¤Î¾õÂÖ¤òÊÝ»ý¤¹¤ë¤¿¤á¤Î¥ª¥Ö¥¸¥§¥¯¥È
+ * ¥É¥é¥Ã¥°½èÍý¤Ï°ìÅÙ¤Ë¤Ò¤È¤Ä¤·¤«µ¯¤³¤é¤Ê¤¤¤Î¤Ç¡¢¤¤¤Þ¤Î¤È¤³¤í
+ * Singleton ¤È¤·¤Æ¼ÂÁõ
+ * 
+ * For example:
+ * <pre>
+ * // prepare for dragging, enable event handler.
+ * SFDragManager.enableEventHandler();
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+SFDragManager = new Object();
+
+// *** Event Handler *** //
+SFDragManager.ondrop = null;  // ÇÛÃÖ¤¬ÊÑ¹¹¤µ¤ì¤¿
+
+
+// ¥É¥é¥Ã¥°½èÍý¤ËÍøÍÑ¤¹¤ë document ¤Î¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤òÀßÄê
+SFDragManager.enableEventHandler = function ()
+{
+	document.onmousemove = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.moveBox(e);
+	};
+	
+	document.onmouseup = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.downBox(e);
+	};
+	
+	for (var key in gAllBoxes) {
+		var box = gAllBoxes[key];
+		var src = box ? box.getHTMLElement() : null;
+		
+		if (src != null) {
+			src.onmousedown = SFDragManager.pickUpBox;
+		}
+	}
+}
+
+// ¥É¥é¥Ã¥°½èÍý¤ËÍøÍÑ¤¹¤ë document ¤Î¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤ò²ò½ü
+SFDragManager.disbleEventHandler= function()
+{
+	document.onmousemove	= '';
+	document.onmouseup		= '';
+}
+
+
+//¥É¥é¥Ã¥°Ãæ¤Î¥ª¥Ö¥¸¥§¥¯¥È
+
+SFDragManager.destination = null;	/* °ÜÆ°Àè Panel */
+SFDragManager.source      = null;	/* °ÜÆ°¸µ Panel */
+SFDragManager.box         = null;	/* ¥É¥é¥Ã¥°Ãæ¤Î Panel */
+
+/**
+ * ¥µ¥¤¥É¥Ð¡¼¹àÌÜ¤ÎÊÑ¹¹¤ò´Æ»ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡£
+ */
+SFDragManager.getChangedListener = function()
+{
+	if (SFDragManager.getChangedListener.$instance == null) {
+		
+		SFDragManager.getChangedListener.$instance = 
+			new SFChangedListener("[Sidebar Function Order]");
+	}
+	return SFDragManager.getChangedListener.$instance;
+}
+SFDragManager.setUpContentsChangedListener = function()
+{
+	// 2004-04-23  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// ¥µ¥¤¥É¥Ð¡¼¤ÎÇÛÃÖ¤¬ÊÑ¹¹¤µ¤ì¤¿¤«¤É¤¦¤«¤òµ­Ï¿
+	
+	var listener = SFDragManager.getChangedListener();
+	
+	listener.listenEvent(SFDragManager, 'ondrop');
+	OEMBlogGlobal.watchOtherLinks(document, listener);
+}
+
+/**
+  * setOnLoad()
+  *
+  * ¥Ú¡¼¥¸ÆÉ¤ß¹þ¤ß»þ¤Î½é´ü½èÍý
+  */
+SFDragManager.loaded = false;
+SFDragManager.onload = function() 
+{
+	// ¥Õ¥©¡¼¥à½é´ü²½
+	gSidefuncOrderForm = UtilKit.getPropertyNotNull(document, SIDEFUNC_ORDER_FORM_NAME);
+	
+	// ³Æ Panel, Box ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+	var boxPositions = SFSettings.loadBoxPositions();
+	gInitialBoxPositionsData = SFSettings.getObjectForPersistent();
+	for (var i = 0; i < gPanelNames.length; i++) {
+		var nm = gPanelNames[i];
+		var panel;
+		
+		panel = new Panel(nm, boxPositions[nm]);
+		
+		for(var key in panel.box_position) {
+			gAllBoxes[key] = new Box(key);
+		}
+		
+		// Box ¤Î½é´üÇÛÃÖ
+		panel.setBoxPosition();
+		Panel[nm] = panel;
+		
+		gAllPanels[nm] = panel;
+	}
+	
+	
+	// ¥É¥é¥Ã¥°½èÍý¤Î½àÈ÷
+	SFDragManager.setUpContentsChangedListener();
+	SFDragManager.enableEventHandler();
+	
+	// onload ¤â¥¤¥Ù¥ó¥È
+	resetPositionsInEventHandler();
+	window.onresize = resetPositionsInEventHandler;
+	
+	SFDragManager.loaded = true;
+	// 2004-04-20  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// Opera ¤Ç¤Ï onload »þÅÀ¤Ç¥ì¥¤¥ä¡¼¤ÎºÆÉÁ²è¤¬´Ö¤Ë¹ç¤ï¤Ê¤¤¡£
+	// ¤³¤Î´Ø¿ô¤ò»È¤Ã¤Æ¡¢ÌµÍý¤ä¤êºÆÉÁ²è¤¹¤ë¡£
+	if (window.opera) {
+		SFDragManager.loaded = false;
+		setTimeout("refreshDisplay()", 0.8*1000);
+	}
+	
+}
+
+
+//---------------------------------------------------------
+// ¥¤¥Ù¥ó¥È½èÍý
+//---------------------------------------------------------
+// CheckLine
+/**
+ *  ¥É¥é¥Ã¥°Ãæ¤Î Box ¤¬ÁÞÆþ¤µ¤ì¤ë²Õ½ê¤ò»Ø¤·¼¨¤¹¤¿¤á¤Î¥é¥¤¥ó 
+ *
+ * @return XBSLayer
+ * @see xbs.js 
+ */
+function getCheckLineLayer()
+{
+	if (null == getCheckLineLayer.layer) {
+		getCheckLineLayer.layer = XBSLayer.makeLayer(CHECKLINE_ID);
+	}
+	return getCheckLineLayer.layer;
+}
+function getPanelAtPosition(x, y)
+{
+	var panel = null;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+			
+		if (x > panel.panel_section['left']  &&
+			x < panel.panel_section['right'] &&
+			y > panel.panel_section['top']   &&
+			y < panel.panel_section['under']) 
+		{ break; }
+	}
+	return panel;
+}
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+// Mac IE ¤Ç¤Ï¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤ÎÃæ¤ÇºÂÉ¸´Ø·¸¤ÎÁàºî¤ò¹Ô¤¦¤È¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Î¤Ç
+// ¤¹¤³¤·ÃÙ¤é¤»¤Æ¼Â¹Ô
+function resetPositionsInEventHandler()
+{
+	if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+		setTimeout("resetPositions()", 1*1000);	
+	} else {
+		resetPositions();
+	}
+}
+
+// *** Reset *** //
+/**
+  * ¤¹¤Ù¤Æ¤Î Box ¤òºÆÇÛÃÖ
+  */
+function resetPositions() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setSections(); 
+			panel.setBoxPosition(); 
+		}
+	}
+}
+
+/**
+ * ¤¹¤Ù¤Æ¤Î Box ¤ò°ìÅÙ¾Ã¤·¡¢¤¹¤°¤Ë¤¹¤Ù¤ÆÉ½¼¨
+ */
+function refreshDisplay() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setBoxVisible(false);
+			panel.setBoxVisible(true);		
+		}
+	}
+	SFDragManager.loaded = true;
+}
+
+// -----------------------------------------------------------------
+// ¥Ü¥Ã¥¯¥¹¤Î¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×
+// -----------------------------------------------------------------
+
+/**
+  * pickUpBox()
+  * theEvent: ¥¤¥Ù¥ó¥È
+  *
+  * Box¤ò»ý¤Á¾å¤²¤¿(¥¯¥ê¥Ã¥¯¤µ¤ì¤¿)»þ¤Î½èÍý¤ò¤¹¤ë´Ø¿ô
+  */
+SFDragManager.pickUpBox = function(theEvent) {
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	if (SFDragManager.box != null || SFDragManager.loaded == false)
+		return;
+	
+	// ¥Þ¥¦¥¹°ÌÃÖ¼èÆÀ
+	var mouse_x	    = XBSEvent.getMouseX(theEvent);
+	var mouse_y	    = XBSEvent.getMouseY(theEvent);
+	var pickedPanel = getPanelAtPosition(mouse_x, mouse_y);
+
+	if (null == pickedPanel) 
+		return;
+
+	// ÁªÂò¤µ¤ì¤¿Box¤ÎÊÂ¤Ó½çÈÖ¹æ¤È id ¤ò¼èÆÀ
+	var beforeId = pickedPanel.orderIndexOfBoxAt(mouse_x, mouse_y);
+	var funcId	= UtilKit.getKeyForValue(pickedPanel.box_position, beforeId);
+	
+	if (null == funcId)
+		return;
+	
+	//Box¥¨¥ì¥á¥ó¥È¼èÆÀ¡¦½èÍý
+	var selected = new XBSLayer(BOX_ID_PREFIX + funcId);
+	if (null == selected) 
+		return;
+
+	selected.setZIndex(selected.getZIndex() +1);
+
+	//ÁªÂò¤µ¤ì¤¿Box¤ÎX,YºÂÉ¸¤òÊÝÂ¸
+	before_box_x	= selected.getX() + MAC_IE5_PITCH_X;
+	before_box_y	= selected.getY() + MAC_IE5_PITCH_Y;
+
+	//¥Þ¥¦¥¹¤ÈBox¸¶ÅÀ¤Îº¹
+	box_to_mouse_x	= mouse_x - before_box_x;
+	box_to_mouse_y	= mouse_y - before_box_y;
+	
+	// ¥É¥é¥Ã¥°³«»Ï
+	SFDragManager.box = selected;
+	SFDragManager.source = pickedPanel;
+	before_order_id = beforeId;
+	function_id = funcId;
+}
+
+/**
+ * 
+ * Box¤ò°ÜÆ°¤¹¤ë´Ø¿ô
+ * 
+ * @param theEvent mousemove ¥¤¥Ù¥ó¥È
+ */
+SFDragManager.moveBox = function(theEvent) {
+	var selected = SFDragManager.box;
+	
+	if (null == selected || SFDragManager.loaded == false)
+		return;
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	//
+	// ¥É¥é¥Ã¥°Ãæ¡¢¥¦¥£¥ó¥É¥¦¤«¤é½Ð¤ë»þ¥ê¥»¥Ã¥È¤·¤Æ½ª¤ï¤ë
+	//
+	if (false == Box.canMoveWithEvent(theEvent)) {
+		gAllBoxes[function_id].setPosition(before_box_x, before_box_y);
+		clearMove();
+		
+		return;
+	}
+
+	var mouse_x  = XBSEvent.getMouseX(theEvent);
+	var mouse_y  = XBSEvent.getMouseY(theEvent);
+	var curPanel = getPanelAtPosition(mouse_x, mouse_y);
+	if (null == curPanel) 
+		return;
+	
+	if (curPanel.canDropAtPosition(SFDragManager.source, selected, mouse_x, mouse_y)) {
+		// ¥Á¥§¥Ã¥¯¥é¥¤¥óÉ½¼¨
+		curPanel.showCheckLineAtPosition(mouse_x, mouse_y);
+	}
+
+	//Box°ÜÆ°
+	move_to_x = mouse_x - box_to_mouse_x;
+	move_to_y = mouse_y - box_to_mouse_y;
+	
+	selected.setLeftTopPosition(move_to_x, move_to_y);
+}
+
+
+
+/**
+ * Box ¤ò²¼¤í¤·¤¿»þ¤Î½èÍý
+ * 
+ * @param theEvent ¥¤¥Ù¥ó¥È
+ */
+SFDragManager.downBox = function(theEvent)
+{
+	if (SFDragManager.loaded == false) {
+		return;
+	}
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// ¥Á¥§¥Ã¥¯¥é¥¤¥ó¤ò¾Ã¤¹
+	getCheckLineLayer().setVisible(false);
+
+	// ¥Þ¥¦¥¹°ÌÃÖ¼èÆÀ
+	var mouse_x = XBSEvent.getMouseX(theEvent);
+	var mouse_y = XBSEvent.getMouseY(theEvent);
+	
+	// -------------------------------------
+	// °ÜÆ°ÎÎ°èÆâ¤«³°¤«¥Á¥§¥Ã¥¯
+	// -------------------------------------
+	// °ÜÆ°Àè¤Î¥Ñ¥Í¥ë¤ò¼èÆÀ¤·¡¢¥É¥é¥Ã¥°¾ðÊó¤ò¹¹¿·
+	// ¥É¥é¥Ã¥°Á°¸å¤Î¥Ñ¥Í¥ë
+	var beforePanel = SFDragManager.source;
+	var afterPanel  = getPanelAtPosition(mouse_x, mouse_y);
+	
+	SFDragManager.destination = afterPanel;
+	if (null == beforePanel) {
+		throw ASSERT_EXCEPTION + 'SFDragManager.source must be not null';
+	}
+	
+	var droppedBox = gAllBoxes[function_id];
+	var after_order_id = afterPanel.orderIndexOfMovingAt(mouse_x, mouse_y);
+	
+	// ¥É¥í¥Ã¥×¤Ç¤­¤Ê¤¤¾ì¹ç¡¢Box ¤òÌá¤·¤Æ¡¢¥É¥é¥Ã¥°½èÍý¤ò½ªÎ»¤¹¤ë
+	if (false == afterPanel.canDropAtPosition(beforePanel, droppedBox, mouse_x, mouse_y)) {
+		droppedBox.setPosition(before_box_x, before_box_y);
+		clearMove();
+		return;
+	}
+
+	// °ÜÆ°¤¹¤ëBox¤ò¥Ñ¥Í¥ë¤«¤éºï½ü¤·¡¢½çÈÖ¤òÀ°Íý¤¹¤ë
+	delete beforePanel.box_position[function_id];	
+	for (key in beforePanel.box_position) {
+		if (before_order_id < beforePanel.box_position[key]) {
+			--beforePanel.box_position[key];
+		}
+	}
+
+	//after_order_id¤Î½èÍý
+	if (!(beforePanel.equals(afterPanel) && before_order_id <= after_order_id)) {
+		++after_order_id;
+	}
+
+
+	// ºÇÂç¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò¹¹¿·
+	if (after_order_id > afterPanel.getMaxOrderIndex() + 1) {
+		after_order_id = afterPanel.getMaxOrderIndex() + 1;
+	}
+
+	//ÁÞÆþ¤¹¤ë´Ö¤ò¤Ä¤¯¤ê¡¢ÁÞÆþ¤¹¤ë
+	for (key in afterPanel.box_position) {
+		if (after_order_id <= afterPanel.box_position[key]) {
+			++afterPanel.box_position[key];
+		}
+	}
+	afterPanel.box_position[function_id] = after_order_id;
+
+	//BoxºÆÇÛÃÖ
+	if (false == beforePanel.equals(afterPanel)) {
+		beforePanel.setBoxPosition();
+	}
+	afterPanel.setBoxPosition();
+
+	// HTML¤ÎhiddenÃÍÊÑ¹¹
+	for (var nm in gAllPanels) {
+		var p = gAllPanels[nm];
+
+		for (key in p.box_position) {
+			gSidefuncOrderForm.elements['order'][key].value = p.box_position[key];
+			gSidefuncOrderForm.elements['position'][key].value = p.getPosition();
+		}
+	}
+
+	// °ÜÆ°¤Î²ò½ü
+	clearMove();
+	if (SFDragManager.ondrop != null && typeof SFDragManager.ondrop == 'function') {
+		SFDragManager.ondrop();
+	}	
+}
+
+
+/**
+  * clearMove()
+  *
+  * Box°ÜÆ°¤ò½ªÎ»¤¹¤ë´Ø¿ô
+  */
+function clearMove() {
+	var selected = SFDragManager.box;
+	
+	selected.setZIndex(selected.getZIndex() -1);
+	SFDragManager.box = null;
+}
+
+
+
+
+//---------------------------------------------------------------------------------
+// Panel
+//---------------------------------------------------------------------------------
+/**
+  * ¸Ä¡¹¤Î¥É¥é¥Ã¥°²ÄÇ½¤Ê¹àÌÜ¤òÊÝ»ý¤¹¤ëÎÎ°è
+  * 
+  * ¤¤¤Þ¤Î¤È¤³¤í¡¢º¸¤«¤é¡Ö»ÈÍÑ¤·¤Ê¤¤µ¡Ç½¡×¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡¦º¸¡×¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡¦±¦¡×
+  *
+  * @param aPanelName    ¥Ñ¥Í¥ë¤ÎÌ¾Á°
+  * @param aPositionArray Box¤ÎÇÛÃÖ¾ðÊóÇÛÎó
+  *
+  * @author Yusuke Saito
+  * @version 2003/10/10
+  * 
+  * @author Takanori Ishikawa
+  * @version 2004/04/20
+  */
+function Panel(aPanelName, aPositionArray)
+{
+	this.name			   = aPanelName;						// ¥Ñ¥Í¥ë¤ÎÌ¾Á°(div¤Îid)
+	this.box_position	   = aPositionArray;					// Box¤ÎÇÛÃÖ¾ðÊóÇÛÎó
+	this.box_limit_number  = BoxConfig.maxNBoxes[aPanelName];	// ¥Ñ¥Í¥ëÆâ¤ÎºÇÂçBox¿ô
+	
+	this.position = -1;
+	for (var i = 0; i < gPanelNames.length; i++) {
+		if (this.name == gPanelNames[i]) {
+			this.position = i;
+			break;
+		}
+	}
+	
+	// ¥Ñ¥Í¥ë¡¦¥Ü¥Ã¥¯¥¹¡¦°ÜÆ°¤Î³ÆÎÎ°è¤òÀßÄê
+	this.setSections();
+}
+
+/**
+ * Box ¤Î Y offset
+ * 
+ * @param anIndex order index
+ */
+Panel.getBoxSectionOffsetY = function(anIndex)
+{
+	if (Panel.box_section_y == null) {  // Box °ÌÃÖÀßÄê
+		var nboxs = BoxConfig.maxNBoxes[PANEL_NAME_DISABLE];
+		Panel.box_section_y = new Array(nboxs);
+		
+		for (var i = 0; i < nboxs; ++i) {
+			Panel.box_section_y[i] = (BoxConfig.height + BoxConfig.padding) * i + BoxConfig.marginTop;
+		}
+	}
+	return Panel.box_section_y[anIndex];
+}
+
+Panel.prototype.getPosition = function() {
+	return this.position;
+}
+
+/**
+ * description
+ */
+Panel.prototype.toString = function()
+{
+	return '[Panel] ' + this.name;
+}
+
+/**
+ * Èæ³Ó
+ * 
+ * @param aPanel ¥Ñ¥Í¥ë
+ */
+Panel.prototype.equals = function(aPanel)
+{
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// instanceof ¤Ï IE 6 ¤Ç¤âÌ¤¥µ¥Ý¡¼¥È	
+	if (aPanel == null || /*false == (aPanel instanceof Panel)*/ typeof aPanel.name == 'undefined') {
+		return false;
+	}	
+	return this.name == aPanel.name;
+}
+
+
+/**
+  * setSections()
+  * 
+  * ¥¦¥£¥ó¥É¥¦¤ò¸¶ÅÀ¤È¤·¤¿¥Ñ¥Í¥ë¤Î£´ÊÕ¤ÎX,YºÂÉ¸¤òÀßÄê¤¹¤ë´Ø¿ô
+  * left:º¸ÊÕX right:±¦ÊÕX top:¾åÊÕY under:²¼ÊÕY
+  */
+Panel.prototype.setSections = function() {
+
+	// ¿Æ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¼èÆÀ
+	this.setUpPanelSections();
+
+	//BoxÎÎ°è¤ÎÀßÄê
+	this.setBoxSection();
+
+	//Box°ÜÆ°ÀèÎÎ°è¤ÎÀßÄê
+	this.setMoveSection();
+}
+
+
+/**
+  * setUpPanelSections()
+  * 
+  * ¥¦¥£¥ó¥É¥¦¤ò¸¶ÅÀ¤È¤·¤¿¥Ñ¥Í¥ë¤Î£´ÊÕ¤ÎX,YºÂÉ¸¤òÀßÄê¤¹¤ë´Ø¿ô
+  * left:º¸ÊÕX right:±¦ÊÕX top:¾åÊÕY under:²¼ÊÕY
+  */
+Panel.prototype.setUpPanelSections = function() 
+{
+	var psec    = new Object;
+	var lyer = XBSLayer.makeLayer(this.name);
+	
+	psec['left'] = MAC_IE5_PITCH_X; 
+	psec['top']  = MAC_IE5_PITCH_Y;
+	
+	psec['right'] = lyer.getWidth();
+	psec['under'] = lyer.getHeight();
+	while (lyer != null && lyer.isValid() && lyer.hasID()) {
+		
+		psec['left'] += lyer.getX();	
+		psec['top']  += lyer.getY();
+		lyer = lyer.getParent();
+	}
+	psec['right'] += psec['left'];
+	psec['under'] += psec['top'];
+
+	this.panel_section = psec;
+}
+
+/**
+  * setBoxSection()
+  * 
+  * Box¤Î¼ý¤Þ¤ëÎÎ°è¤òÀßÄê¤¹¤ë´Ø¿ô
+  * box_section[ÊÂ¤Ó½çÈÖ¹æ] => (left => º¸ÊÕX, right => ±¦ÊÕX, top => ¾åÊÕY, under => ²¼ÊÕY)
+  */
+Panel.prototype.setBoxSection = function() {
+
+	//BoxÎÎ°è¤ÎÀßÄê
+	this.box_section_left_x		= this.panel_section['left'] + BoxConfig.marginLeft;
+	this.box_section_right_x	= this.box_section_left_x + BoxConfig.width
+
+	this.box_section			= new Array(this.box_limit_number);
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.box_section[i]				= new Array(4);
+		this.box_section[i]['left']		= this.box_section_left_x;
+		this.box_section[i]['right']	= this.box_section_right_x;
+		this.box_section[i]['top']		= Panel.getBoxSectionOffsetY(i) + this.panel_section['top'];
+		this.box_section[i]['under']	= this.box_section[i]['top'] + BoxConfig.height;
+	}
+}
+
+/**
+ * ¥Ñ¥Í¥ë¤ÎÃæ¤Ç°ìÈÖ²¼¤Î Box ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤òÊÖ¤¹
+ * 
+ * @return °ìÈÖ²¼¤Î Box ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¡£
+ */
+Panel.prototype.getMaxOrderIndex = function()
+{
+	var max = -1;
+	for(key in this.box_position) {
+		max = (max < this.box_position[key]) ? this.box_position[key] : max;
+	}
+	return Number(max);
+}
+
+/**
+ * »ØÄê¤µ¤ì¤¿°ÌÃÖ¤ËºÇ¤â¶á¤¤¡¢Box ¤òÁÞÆþ²ÄÇ½¤Ê²Õ½ê¤Ë¥Á¥§¥Ã¥¯¥é¥¤¥ó¤òÉ½¼¨¤¹¤ë¡£
+ * 
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ */
+Panel.prototype.showCheckLineAtPosition = function(x, y)
+{
+	if (typeof x != typeof 0 || typeof y != typeof 0) {
+		throw ASSERT_EXCEPTION + 'x or y arg';
+	}
+	
+	var moveOrderId   = this.orderIndexOfMovingAt(x, y);
+	var maxOrderIndex = this.getMaxOrderIndex();
+	
+	if (null == moveOrderId)
+		return;
+	
+	if (maxOrderIndex < moveOrderId) {
+		moveOrderId = maxOrderIndex;
+	}
+	if (moveOrderId < this.box_limit_number) {
+		// ¥Á¥§¥Ã¥¯¥é¥¤¥ó°ÜÆ°
+		var check_line_left = this.panel_section['left'];
+		var check_line_top = this.move_section[moveOrderId]['top'];
+
+		// °ìÃ¶¥Á¥§¥Ã¥¯¥é¥¤¥ó¤ò¾Ã¤¹
+		getCheckLineLayer().setVisible(false);
+		getCheckLineLayer().setLeftTopPosition(check_line_left, check_line_top);
+		getCheckLineLayer().setVisible(true);
+	}
+}
+
+
+/**
+  * setMoveSection()
+  * 
+  * Box¤ò°ÜÆ°¤Ç¤­¤ëÎÎ°è¤òÀßÄê¤¹¤ë´Ø¿ô
+  * move_section[ÊÂ¤Ó½çÈÖ¹æ] => (left => º¸ÊÕX, right => ±¦ÊÕX, top => ¾åÊÕY, under => ²¼ÊÕY)
+  */
+Panel.prototype.setMoveSection = function() {
+
+	//°ÜÆ°ÎÎ°è¤ÎÀßÄê
+	this.move_section_left_x	= this.panel_section['left'];
+	this.move_section_right_x	= this.move_section_left_x + BoxConfig.width + (BoxConfig.marginLeft * 2);
+	this.move_section			= new Array(this.box_limit_number + 1);
+
+	this.move_section[-1]			= new Array(4);
+	this.move_section[-1]['left']	= this.move_section_left_x;
+	this.move_section[-1]['right']	= this.move_section_right_x;
+	this.move_section[-1]['top']	= this.panel_section['top'] - 7;
+	this.move_section[-1]['under']	= this.panel_section['top'] + (BoxConfig.marginTop / 2) + BoxConfig.height;
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.move_section[i]			= new Array(4);
+		this.move_section[i]['left']	= this.move_section_left_x;
+		this.move_section[i]['right']	= this.move_section_right_x;
+		this.move_section[i]['top']		= this.move_section[i - 1]['under'];
+		this.move_section[i]['under']	= this.move_section[i]['top'] + BoxConfig.height + BoxConfig.padding;
+	}
+}
+
+
+
+Panel.prototype.canDropAtPosition = function(aSourcePanel, aBox, x, y)
+{
+	var orderIndex = this.orderIndexOfMovingAt(x, y);
+	var maxIndex = this.getMaxOrderIndex() + 1;
+
+	// ¥Ñ¥Í¥ë¤«¤é³°¤ì¤¿¡¢
+	// ¥Ñ¥Í¥ë¤ÎºÇÂç Box ¿ô¤òÄ¶¤¨¤ë = false
+	return (orderIndex != null && (this.equals(aSourcePanel) || this.box_limit_number > maxIndex));
+}
+
+/**
+ * °ÜÆ°Ãæ¡¢ÁÞÆþ¤µ¤ì¤ë²Õ½ê¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤òÊÖ¤¹¡£
+ * 
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ * @return ÁÞÆþ¤µ¤ì¤ë¥¤¥ó¥Ç¥Ã¥¯¥¹¡¢¤Ê¤±¤ì¤Ð null
+ */
+Panel.prototype.orderIndexOfMovingAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.move_section, x, y);
+}
+Panel.prototype.orderIndexOfBoxAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.box_section, x, y);
+}
+// private
+Panel.prototype.findOrderIndexOf_ = function(sectionDataArray, x, y)
+{
+	for (var i = -1; i < sectionDataArray.length; i++) {
+		var sec = sectionDataArray[i];
+		if (sec == null)
+			continue;
+		
+		if (x >= sec['left'] && x <= sec['right'] &&
+			y >= sec['top']  && y <= sec['under']) {
+	
+			return i
+		}
+	}
+	return null;
+}
+
+/**
+  * setBoxPosition()
+  *
+  * Box¤òºÆÇÛÃÖ¤¹¤ë´Ø¿ô
+  */
+Panel.prototype.setBoxPosition = function() {
+	for (key in this.box_position) {
+		gAllBoxes[key].setPosition(
+			this.panel_section['left'] + BoxConfig.marginLeft,
+			this.panel_section['top']  + Panel.getBoxSectionOffsetY(this.box_position[key]) );
+	}
+}
+
+Panel.prototype.setBoxVisible = function(flag)
+{
+	for (key in this.box_position) {
+		gAllBoxes[key].setVisible(flag);
+	}
+}
+
+
+
+//---------------------------------------------------------------------------------
+// Box
+//---------------------------------------------------------------------------------
+/**
+ * ¸Ä¡¹¤Î¥É¥é¥Ã¥°¤Ç°ÜÆ°²ÄÇ½¤Ê¹àÌÜ
+ * 
+ * @param anId HTML Í×ÁÇ¤Î id Â°À­
+ * 
+ * @author Yusuke Saito
+ * @version 2003/10/10
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/21
+ */
+function Box(anId)
+{	
+	this.uniqID     = anId;
+	this.srcElement = XBSLayer.getLayerImpById(BOX_ID_PREFIX + anId);
+
+	this.setUpSize();
+	this.x = this.y = 0;	
+}
+
+Box.prototype.getFormID = function() { return this.uniqID; }
+Box.prototype.getHTMLElement = function() { return this.srcElement; }
+
+/**
+ * HTML ¤Î hidden input Í×ÁÇ¤ÇÅÏ¤µ¤ì¤ë¥×¥í¥Ñ¥Æ¥£¤ÎÌ¾Á°
+ */
+Box.POSITION_PROPERTY_NAME = "position";
+Box.ORDER_PROPERTY_NAME    = "order";
+Box.NAME_PROPERTY_NAME     = "sidefuncName";
+Box.AUTHOR_PROPERTY_NAME   = "authorCd";
+Box.ID_PROPERTY_NAME       = "sidefuncId";
+
+
+/**
+ * ¥É¥é¥Ã¥°½èÍý¤ÎºÇÃæ¤Ë¸Æ¤Ð¤ì¤ë¡£
+ * 
+ * @param theEvent mousemove
+ * @return ¥É¥é¥Ã¥°½èÍý¤ò¥­¥ã¥ó¥»¥ë¤¹¤ë¾ì¹ç¤Ï¡¢false ¤òÊÖ¤¹¡£
+ */
+Box.MOVABLE_INSET = 5;	/* ¥É¥­¥å¥á¥ó¥È¤ÎÃ¼ - Box.MOVABLE_INSET = ¥É¥é¥Ã¥°²ÄÇ½¤ÊÎÎ°è */
+Box.canMoveWithEvent = function(theEvent) 
+{
+	// ÁêÂÐÅª¤Ê°ÌÃÖ¤¬¤Û¤·¤¤¤Î¤Ç¡¢XBSDocument.getPageOffsetX/Y() ¤ò°ú¤¯
+	var mouse_x = XBSEvent.getMouseX(theEvent) - XBSDocument.getPageOffsetX();
+	var mouse_y = XBSEvent.getMouseY(theEvent) - XBSDocument.getPageOffsetY();
+	
+	if (mouse_x < Box.MOVABLE_INSET || mouse_y < Box.MOVABLE_INSET) {
+		return false;
+	}
+	
+	var maxX = XBSDocument.getWidth() - Box.MOVABLE_INSET;
+	var maxY = XBSDocument.getHeight() - Box.MOVABLE_INSET;
+	
+	if (mouse_x > maxX || mouse_y > maxY) {
+		return false;
+	}
+	
+	return true;
+}
+
+/**
+  * setUpSize()
+  * 
+  * Box¤ÎÂç¤­¤µ¤òÀßÄê¤¹¤ë´Ø¿ô
+  */
+Box.prototype.setUpSize = function() 
+{
+	var imp = this.getHTMLElement();
+	
+	// style.height ¤Ç¤Ê¤¤¤È opera ¤Ç¤¦¤Þ¤¯¤¤¤«¤Ê¤¤
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = BoxConfig.height;	
+		imp.style.width = BoxConfig.width;	
+	} else {
+		XBSLayer.setHeightWithLayerImp(imp, BoxConfig.height);
+		XBSLayer.setWidthWithLayerImp(imp, BoxConfig.width);
+	}
+	XBSLayer.setCursorWithLayerImp(imp, 'move');
+}
+
+/**
+  * Box¤Î°ÌÃÖ¤òÀßÄê
+  * 
+  * @param left x
+  * @param top  y
+  */
+Box.prototype.setPosition = function(left, top) 
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top);
+	this.x = left; this.y = top;
+}
+/**
+ * Box ¤Î²Ä»ëÂ°À­¤òÀßÄê
+ */
+Box.prototype.setVisible = function(flag)
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.setVisibilityWithLayerImp(imp, flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
Index: /temp/trunk/html/test/nakatest/dragdrop/files/xbs.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/files/xbs.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/files/xbs.js	(revision 1328)
@@ -0,0 +1,1462 @@
+/**
+ * XBS (Cross Browser Scripting) Utilities
+ *
+ * Copyright (c) 2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+//---------------------------------------------------------------------------------
+// Debugging 
+//---------------------------------------------------------------------------------
+/**
+ * Assertion ¤Ë¼ºÇÔ¤·¤¿¤È¤­¤Ë¤³¤ì¤ò throw
+ */
+ASSERT_EXCEPTION = '*** Assertion Failur *** ';
+
+/**
+ * dprint, dinspect ¤Î½ÐÎÏ¤ò¥¹¥È¥Ã¥×¤¹¤ë¤È¤­¤Ï true ¤ËÀßÄê
+ */
+BLOCK_DEBUG_PRINT  = true;
+
+
+/**
+ * v ¤¬ undefined ¤Ç¤Ê¤±¤ì¤Ð true
+ */
+function defined(v) { return (typeof v != 'undefined'); }
+
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤Î¤¹¤Ù¤Æ¤Î¥×¥í¥Ñ¥Æ¥£¤ò dprint ´Ø¿ô¤ÇÉ½¼¨
+ * 
+ * @param ¥ª¥Ö¥¸¥§¥¯¥È
+ */
+function dinspect(anObj)
+{
+	if (null == anObj) return;
+	for (key in anObj) {
+		dprint(key + ": " + anObj[key]);
+	}
+
+}
+
+function dprint(obj)
+{
+	if (BLOCK_DEBUG_PRINT) {
+		return;
+	}
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("/drecomcms/js/Console.html", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+	}
+	
+	var t = dprint.window.document.getElementById('console');
+	
+	if (t != null) {
+		t.value = t.value + "\n> " + obj.toString();
+	}
+// Takanori Ishiakwa 04/04/06
+// -----------------------------------------
+// Safari ¤ä Opera ¤Ç¤¦¤Þ¤¯Æ°ºî¤·¤Ê¤¤¤¿¤á
+// TextArea ¥Ð¡¼¥¸¥ç¥ó¤ËÀÚ¤êÂØ¤¨¤¿
+/*
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+		dprint.window.document.open("text/plain");	
+	}
+	var d = dprint.window.document;
+	
+	if (d == null) return;
+
+	d.writeln("> " + obj.toString());
+	
+	// Opera: mime text/plain ¤ò»ØÄê¤·¤Æ¤â HTML ¤È¤·¤Æ²ò¼á
+	// ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤Î¤Ç¡¢²þ¹Ô¤µ¤»¤ë¤¿¤á¤Ë¥¿¥°¤ò½ÐÎÏ
+	if (window.opera) d.writeln("<br>");
+*/
+}
+
+// ---------------------------------------------------------
+// XBSUtil
+// ---------------------------------------------------------
+// for the purpose of namespace
+/**
+ * ¥Ö¥é¥¦¥¶¸ß´¹¤òÌÜ»Ø¤·¤Æ¡¢¥æ¡¼¥Æ¥£¥ê¥Æ¥£·²¤ò¤Þ¤È¤á¤¿¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSUtil = new Object();
+
+/**
+ * Í×ÁÇ¤ò´Þ¤à document ¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡£
+ * 
+ * @param document
+ */
+XBSUtil.getOwnerDocument = function(anElement) 
+{
+	if (anElement.document) {
+		return anElement.document;
+	} else if (anElement.ownerDocument) {
+		return anElement.ownerDocument;
+	}
+	return null;
+}
+
+
+/**
+ * Unicode code points collection
+ * 
+ * ¥×¥í¥°¥é¥àÃæ¤Ç»È¤¦Ê¸»ú¥³¡¼¥É¤ò½¸¤á¤¿¤â¤Î
+ * 
+ * @author Takanori Ishikawa
+ * @version 1.0
+ */
+XBSCType = new Object();
+
+// *** XBSCType ½é´ü²½ *** //
+// ½é´ü²½¥Æ¡¼¥Ö¥ë
+// key: property name
+// value: string (length must be 1)
+XBSCType.template_ = {
+	CR:    '\r',
+	LF:    '\n',
+	TAB:   '\t',
+	SPACE: ' ',
+	LT:    '<',
+	GT:    '>',
+	SLASH: '/',
+	COLON: ':',
+	AMP:   '&',
+	LBRACE:'{',
+	RBRACE:'}'
+};
+
+for (var key in XBSCType.template_) {
+	var c = XBSCType.template_[key];
+	
+	if (c.length != 1) {
+		throw ASSERT_EXCEPTION + 'XBSCType.template_[' + key + '] length must be 1.';
+	}
+	c = c.charCodeAt(0);
+	XBSCType[key] = c;
+}
+// ºï½ü
+delete XBSCType.template_;
+
+/**
+ * isspace
+ */
+XBSCType.isspace = function(c) 
+{
+	return (c == XBSCType.SPACE || c == XBSCType.TAB || c == XBSCType.CR || c == XBSCType.LF);
+}
+
+
+/**
+ * DOM ¥µ¥Ý¡¼¥È¶ñ¹ç¤Ë¤è¤ë¥Ö¥é¥¦¥¶È½ÊÌ
+ * 
+ * <ul>
+ * <li>IE4:   IE4 ÁêÅö</li>
+ * <li>IE5:   IE5 ÁêÅö</li>
+ * <li>NN4:   NN4 ÁêÅö</li>
+ * <li>NN6:   NN6 ÁêÅö</li>
+ * <li>OTHER: ¾åµ­°Ê³°</li>
+ * </ul>
+ */
+OTHER = 0;
+IE4   = 1;
+IE5   = 2;
+NN4   = 3;
+NN6   = 4;
+XBSUtil.DOM = document.all 
+				? (document.getElementById ? IE5 : IE4)
+				: (document.getElementById 
+					? NN6
+					: (document.layers ? NN4 : OTHER));
+
+/**
+ * ¥Æ¥­¥¹¥ÈÁàºî API ¤Î¥µ¥Ý¡¼¥È¶ñ¹ç¤Ë¤è¤ë¥Ö¥é¥¦¥¶È½ÊÌ
+ */
+XBSUtil.Range = null;
+if (document.selection != null && defined(document.selection.createRange)) {
+	XBSUtil.Range = IE5;
+}
+
+
+// ¥¨¥é¡¼»þ¤Ë¤Ï 0 ¤òÊÖ¤¹ parseInt(), 10 ¿Ê¿ô
+XBSUtil.parseIntNoError = function(anObj) {
+	var v = 0;	
+
+	try {
+		v = parseInt(anObj, 10);
+	} catch (e) {
+
+	}
+	if ((typeof v != typeof 0) || isNaN(v)) {
+		v = 0;
+	}
+
+	return v;
+}
+
+/**
+ * DOM:
+ * DocumentImplementation - feature list
+ */
+if (null == XBSUtil.DOM) {
+	throw ASSERT_EXCEPTION + 'XBSUtil.DOM must be not null.';
+}
+XBSUtil.DOM.HTMLEvent = false;
+
+if (document.implementation) {
+	XBSUtil.DOM.HTMLEvent = document.implementation.hasFeature('HTMLEvents', '2.0');
+}
+
+
+/**
+ * Mac: AppleWebKit
+ * 
+ * Apple ¤Î WebKit framework ¤Î¾å¤Ë¹½ÃÛ¤µ¤ì¤¿¥Ö¥é¥¦¥¶¤Ê¤é
+ * ¤³¤³¤Ç XBSUtil.appleWebKit ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¡£
+ * 
+ * @field major WebKit ¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ * @field minor WebKit ¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ */
+XBSUtil.appleWebKit = null;
+var _webKitMatch = navigator.userAgent.match(/AppleWebKit\/(\d+)\.?(\d+)?/i);
+if (_webKitMatch != null) {
+	var o = new Object();
+	
+	o.major = XBSUtil.parseIntNoError(_webKitMatch[1]);
+	o.minor = XBSUtil.parseIntNoError(_webKitMatch[2]);	
+	XBSUtil.appleWebKit = o;
+}
+
+/**
+ * Mac IE
+ * 
+ * Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
+ */
+/**
+ * Mac: IE
+ * 
+ * IE ¤Î Mac ÈÇ¤Ê¤é
+ * ¤³¤³¤Ç XBSUtil.macIE ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¡£
+ * 
+ * @field major IE ¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ * @field minor IE ¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ */
+//
+// »²¹Í¡§ 
+// Mac ¤Î¿©¤¨¤Ê¤¤ÌîÏº¤É¤â
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+XBSUtil.macIE = null;
+if (navigator.userAgent.match(/Mac/i)) {
+	var _macIEMatch;
+	
+	_macIEMatch = navigator.userAgent.match(/MSIE\s+(\d+)\.?(\d+)?/i);
+	if (_macIEMatch) {
+		var o = new Object();
+
+		o.major = XBSUtil.parseIntNoError(_macIEMatch[1]);
+		o.minor = XBSUtil.parseIntNoError(_macIEMatch[2]);	
+		XBSUtil.macIE = o;
+	}
+}
+/**
+ * Opera
+ *
+ * Opera ¤Ê¤é¤³¤³¤Ç XBSUtil.opera ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¡£
+ * 
+ * @field major opera ¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ * @field minor opera ¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ (Number)
+ */
+XBSUtil.opera = null;
+if (window.opera) {
+	var o = new Object();
+	
+	o.major = 6;
+	if (document.documentElement)
+		o.major = 7;
+	
+	o.minor = 0;
+	XBSUtil.opera = o;
+}
+
+
+// ---------------------------------------------------------
+// XBSLayer
+// ---------------------------------------------------------
+/**
+ * div Í×ÁÇ¤Ê¤É¤ò¥ì¥¤¥ä¡¼¤È¤·¤Æ°·¤¦¤¿¤á¤Î¥ª¥Ö¥¸¥§¥¯¥È
+ * 
+ * For example:
+ * <pre>
+ *    var layer = new XBSLayer(anIdOfDivElement);
+ *    // some operation...
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ * @see     document.layer
+ * @see     style
+ * 
+ * @param     uniqId  div Í×ÁÇ¤Î id Â°À­
+ * @param     doc     document ¥ª¥Ö¥¸¥§¥¯¥È¡Ê¥ª¥×¥·¥ç¥ó¡§¥Ç¥Õ¥©¥ë¥È¤Ïwindow.document¡Ë
+ */
+function XBSLayer(uniqId, doc)
+{
+	if (uniqId) {
+		this.setLayerImp(XBSLayer.getLayerImpById(uniqId, doc));
+	}
+}
+/**
+ * »ØÄê¤µ¤ì¤¿ div Í×ÁÇ¤¬¤Ê¤±¤ì¤ÐÎã³°¤òÅê¤²¤ë
+ * 
+ * ¤É¤¦¤»¡¢¤¿¤¤¤·¤¿¿ô¤Î¥ì¥¤¥ä¡¼¤Ï¤Ê¤¤¤Î¤Ç¥­¥ã¥Ã¥·¥å
+ */
+XBSLayer.makeLayer = function(uniqId, doc)
+{
+	var lyer = null;
+	
+	if (XBSLayer.makeLayer.$cache == null) {
+		XBSLayer.makeLayer.$cache = new Object();
+	}
+	
+	lyer = XBSLayer.makeLayer.$cache[uniqId];
+	if (null == lyer || (doc && doc != XBSUtil.getOwnerDocument(lyer.getLayerImp()))) {
+		lyer = new XBSLayer(uniqId, doc);
+		
+		if (null == lyer || null == lyer.getLayerImp()) {
+			//b throw ASSERT_EXCEPTION + 'div element (id:' + uniqId + ') is required.';
+		}
+		XBSLayer.makeLayer.$cache[uniqId] = lyer;
+	}
+	
+	return lyer;
+}
+
+/* ---- class properties ---- */
+
+// Visibility constants
+/**
+ * ¥ì¥¤¥ä¡¼¤Î²Ä»ëÂ°À­¤òÉ½¤¹Äê¿ô
+ */
+XBSLayer.VISIBLE   = 1;
+XBSLayer.HIDDEN    = 2;
+XBSLayer.INHERIT   = 3;
+XBSLayer.UNDEFINED = 4;
+
+/**
+ * ¥ì¥¤¥ä¡¼¤ÎÁàºî¤Ë»È¤¦¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È¤òÆÀ¤ë
+ *
+ * @param     anId  div Í×ÁÇ¤Î id Â°À­
+ * @param     doc   document ¥ª¥Ö¥¸¥§¥¯¥È¡Ê¥ª¥×¥·¥ç¥ó¡§¥Ç¥Õ¥©¥ë¥È¤Ïwindow.document¡Ë
+ * @return    DOM: element.style, NN: layer
+ */
+XBSLayer.getLayerImpById = function(anId, doc) 
+{
+	var imp = null;
+	
+	if (null == doc) {
+		doc = document;
+	}
+	if (doc.getElementById || doc.all) {
+		imp = doc.getElementById 
+				? doc.getElementById(anId)
+				: doc.all(anId);
+	} else if (doc.layers) {
+		imp = doc.layers[anId];
+	}
+	return imp;
+}
+XBSLayer.getStyleObjectWithLayerImp = function(imp)
+{
+	if (document.getElementById || document.all) {
+		return imp.style;
+	} else {
+		return imp;
+	}
+}
+
+/**
+ * ¿ÆÍ×ÁÇ¤òÆÀ¤ë
+ *
+ * @param     imp  ¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È
+ * @return    ¿ÆÍ×ÁÇ
+ */
+XBSLayer.getParentOfLayerImp = function(imp)
+{
+	var parent = null;
+	
+	if (null == imp) {
+		;
+	} else if (defined(imp.parentElement)) {
+		parent = imp.parentElement;
+	} else if (defined(imp.offsetParent)) {
+		parent = imp.offsetParent;
+	}
+
+	return parent;
+}
+
+
+/**
+ * ¥ì¥¤¥ä¡¼¤ÎÁàºî¤Ë»È¤¦¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È¤Î²Ä»ëÂ°À­¤òÊÖ¤¹¡£
+ *
+ * @param     imp  ¼ÂÁõ¥ª¥Ö¥¸¥§¥¯¥È
+ * @return    ²Ä»ëÂ°À­¤òÉ½¤¹Äê¿ô
+ * <ul>
+ * <li>XBSLayer.VISIBLE</li>
+ * <li>XBSLayer.HIDDEN</li>
+ * <li>XBSLayer.INHERIT</li>
+ * <li>XBSLayer.UNDEFINED</li>
+ * </ul>
+ */
+XBSLayer.getVisibilityWithLayerImp = function(imp)
+{
+	var v;
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	v = imp.visibility;
+	if (document.all) {
+		if (v == '') return XBSLayer.INHERIT;
+	} else if (!document.getElementById && document.layers) {
+		if (v == 'show') return XBSLayer.VISIBLE;
+		if (v == 'hide') return XBSLayer.HIDDEN;
+	}
+	
+	if (v == 'visible') return XBSLayer.VISIBLE;
+	if (v == 'hidden') return XBSLayer.HIDDEN;
+	if (v == 'inherit') return XBSLayer.INHERIT;
+		
+	return XBSLayer.UNDEFINED;
+}
+XBSLayer.setVisibilityWithLayerImp = function(imp, anEnum)
+{
+	var v = '';
+	
+	if (!document.getElementById && document.layers) {
+		if (anEnum == XBSLayer.VISIBLE) v = 'show';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hide';
+	} else {
+		if (anEnum == XBSLayer.VISIBLE) v = 'visible';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hidden';
+		if (anEnum == XBSLayer.INHERIT) v = 'inherit';
+	}
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	return imp.visibility = v;
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î display Â°À­
+ * 
+ * @return ¥ì¥¤¥ä¡¼¤¬ÎÎ°è¤ò»ý¤Ä¾ì¹ç¤Ï true
+ */
+XBSLayer.isBlockWithLayerImp = function(imp)
+{
+	var b = true;
+	
+	if (imp.style.display != null) {
+		b = (imp.style.display != 'none');
+	}
+	return b;
+}
+XBSLayer.setBlockWithLayerImp = function(imp, b)
+{
+	if (imp.style != null) {
+		imp.style.display = b ? 'block' : 'none';
+	}
+}
+
+// Position & Size
+
+
+// zIndex
+XBSLayer.getZIndexWithLayerImp = function(imp)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	return imp.zIndex;
+}
+XBSLayer.setZIndexWithLayerImp = function(imp, z)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	imp.zIndex = z;
+}
+
+
+// Position
+/**
+ * °ÌÃÖ»ØÄê¤Ë»È¤¦Äê¿ô
+ */
+XBSLayer.LEFT_TOP     = 1;
+XBSLayer.LEFT_BOTTOM  = 2;
+XBSLayer.RIGHT_TOP    = 3;
+XBSLayer.RIGHT_BOTTOM = 4;
+
+/**
+ * ¥æ¡¼¥Æ¥£¥ê¥Æ¥£¡§ »ØÄê¤µ¤ì¤¿¥¤¥Ù¥ó¥È¤Î°ÌÃÖ¤Ë¥ì¥¤¥ä¡¼¤ò°ÜÆ°¡¢É½¼¨
+ * 
+ * @param imp div Í×ÁÇ
+ * @param theEvent ¥¤¥Ù¥ó¥È¥ª¥Ö¥¸¥§¥¯¥È
+ * @param axisType ºÂÉ¸¤ò»ØÄê¤¹¤ë°ÌÃÖ
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ *
+ * @param offsetX ¤³¤Îµ÷Î¥¤À¤±¥¤¥Ù¥ó¥È¤Î°ÌÃÖ¤«¤éÎ¥¤¹ (x ºÂÉ¸)
+ * @param offsetY ¤³¤Îµ÷Î¥¤À¤±¥¤¥Ù¥ó¥È¤Î°ÌÃÖ¤«¤éÎ¥¤¹ (y ºÂÉ¸)
+ * 
+ */
+XBSLayer.popUpWithLayerImpAtEventLocation = function(imp, theEvent, axisType, offsetX, offsetY)
+{
+	var left   = XBSEvent.getMouseX(theEvent) + offsetX;
+	var top    = XBSEvent.getMouseY(theEvent) + offsetY;
+		
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setPositionWIthLayerImp(imp, left, top, axisType);
+	XBSLayer.setVisibilityWithLayerImp(imp, XBSLayer.VISIBLE);
+}
+
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ»ØÄê
+ * 
+ * @param imp div Í×ÁÇ
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ * @param axisType ºÂÉ¸¤ò»ØÄê¤¹¤ë°ÌÃÖ (default: LEFT_TOP)
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.setPositionWIthLayerImp = function(imp, x, y, axisType)
+{
+	var left = x;
+	var top  = y;
+	var w = XBSLayer.getWidthWithLayerImp(imp);
+	var h = XBSLayer.getHeightWithLayerImp(imp);
+	
+	if (XBSLayer.LEFT_BOTTOM == axisType) {
+		top -= h;
+	} else if (XBSLayer.RIGHT_TOP == axisType) {
+		left -= w;
+	} else if (XBSLayer.RIGHT_BOTTOM == axisType) {
+		top -= h;
+		left -= w;
+	}
+	if (left < 0) left = 0;
+	if (top < 0) top = 0;
+	
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top)
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¡Êº¸¾å¡Ë¤ò»ØÄê¡£
+ * 
+ * @param imp div Í×ÁÇ
+ * @param top º¸¾å x ºÂÉ¸
+ * @param left º¸¾å y ºÂÉ¸
+ */
+XBSLayer.setLeftTopPositionWithLayerImp = function(imp, left, top)
+{	
+	if (XBSUtil.DOM == NN4) {
+		imp.moveTo(left, top);
+	}else if (imp.style != null) {	
+		imp.style.left = left; imp.style.top = top;
+	}
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¾ðÊó¤ò½é´ü²½¡£¥Ö¥é¥¦¥¶¤Ë¤è¤Ã¤Æ¤Ï¤³¤Î´Ø¿ô¤ò
+ * Â¾¤Î°ÌÃÖ´Ø·¸´Ø¿ô¤è¤ê¤âÁ°¤Ë¸Æ¤Ð¤Ê¤¤¤È·ë²Ì¤¬ÉÔÄê¤Ë¤Ê¤ë¡£
+ * 
+ * @param imp div
+ */
+XBSLayer.initPositionStyle = function(imp)
+{
+	if (document.layers) {
+		return;
+	} else if (typeof imp.style.left == "string") {
+		imp.style.left = imp.offsetLeft + 'px';
+		imp.style.top  = imp.offsetTop  + 'px';
+	} else if (typeof imp.style.pixelLeft != "undefined") {
+		imp.style.pixelLeft = imp.offsetLeft;
+		imp.style.pixelTop  = imp.offsetTop;
+	}
+}
+
+XBSLayer.getLeftWithLayerImp = function(imp)
+{
+	var x = 0;
+
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		x = imp.offsetLeft;
+	} else if (XBSUtil.DOM == IE4) {
+		x = imp.style.pixelLeft;
+	} else if (XBSUtil.DOM == NN4) {
+		x = imp.clip.left;
+	}
+	return x;
+}
+
+XBSLayer.getTopWithLayerImp = function(imp)
+{
+	var y = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		y = imp.offsetTop;
+	} else if (XBSUtil.DOM == IE4) {
+		y = imp.style.pixelTop;
+	} else if (XBSUtil.DOM == NN4) {
+		y = imp.clip.top;
+	}
+	return y;
+}
+
+// Size
+XBSLayer.getWidthWithLayerImp = function(imp) 
+{
+	var w = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		w = imp.offsetWidth;
+	} else if (XBSUtil.DOM == IE4) {
+		w = imp.style.pixelWidth;
+	} else if (XBSUtil.DOM == NN4) {
+		w = imp.clip.width;
+	}
+	return w;
+}
+XBSLayer.getHeightWithLayerImp = function(imp)
+{
+	var h = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		h = imp.offsetHeight;
+	} else if (XBSUtil.DOM == IE4) {
+		h = imp.style.pixelHeight;
+	} else if (XBSUtil.DOM == NN4) {
+		h = imp.clip.height;
+	}
+	return h;
+}
+XBSLayer.setWidthWithLayerImp = function(imp, w) 
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.width = w;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelWidth = w;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(w, imp.clip.height);
+
+	}
+}
+XBSLayer.setHeightWithLayerImp = function(imp, h)
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = h;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelHeight = h;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(imp.clip.width, h);
+	}
+}
+
+// HTML
+XBSLayer.getInnerHTMLWithLayerImp = function(imp)
+{
+	if (defined(imp.innerHTML)) {
+		return imp.innerHTML;
+	}
+	return '';
+}
+XBSLayer.setInnerHTMLWithLayerImp = function(imp, htmlText)
+{
+	if (defined(imp.innerHTML)) {
+		imp.innerHTML = htmlText;
+	} else if (document.layers != null) {
+		imp.document.open();
+		imp.document.write(htmlText);
+		imp.document.close();
+	}
+}
+
+// Cursor
+XBSLayer.setCursorWithLayerImp = function(imp, aName) 
+{
+	if (imp.style != null && defined(imp.style.cursor)) {
+		imp.style.cursor = aName;
+	}
+}
+
+
+
+/* ---- Instance properties ---- */
+/**
+ * ¿ÆÍ×ÁÇ¤Î XBSLayer ¤òÊÖ¤¹
+ */
+XBSLayer.prototype.getParent = function()
+{
+	var imp = XBSLayer.getParentOfLayerImp(this.getLayerImp());
+	if (null == imp) {
+		return null;
+	}
+	var lyer = new XBSLayer();
+	
+	lyer.setLayerImp(imp);
+	return lyer;
+}
+XBSLayer.prototype.getID = function() { 
+	return this.getLayerImp().id;
+}
+XBSLayer.prototype.hasID = function() {
+	var id = this.getID();
+	
+	return id != null && id != '';
+}
+XBSLayer.prototype.isValid = function() {
+	return (this.getLayerImp() != null);
+}
+// Visibility
+XBSLayer.prototype.getVisibility = function()
+{
+	return XBSLayer.getVisibilityWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setVisibility = function(aEnum)
+{
+	XBSLayer.setVisibilityWithLayerImp(this.getLayerImp(), aEnum);
+}
+
+/**
+ * ¥ì¥¤¥ä¡¼¤¬²Ä»ë¤«¤É¤¦¤«¤òÊÖ¤¹¡£
+ *
+ * @return    boolean
+ */
+XBSLayer.prototype.isVisible  = function()
+{
+	return this.getVisibility() == XBSLayer.HIDDEN ? false : true;
+}
+XBSLayer.prototype.setVisible = function(/* boolean */ flag)
+{
+	this.setVisibility(flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
+XBSLayer.prototype.toggleVisibility = function()
+{
+	this.setVisible(false == this.isVisible())
+}
+/**
+ * ¥ì¥¤¥ä¡¼¤Î display Â°À­
+ * 
+ * @return ¥ì¥¤¥ä¡¼¤¬ÎÎ°è¤ò»ý¤Ä¾ì¹ç¤Ï true
+ */
+XBSLayer.prototype.isBlock  = function()  
+{ return XBSLayer.isBlockWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setBlock = function(b) 
+{ XBSLayer.setBlockWithLayerImp(this.getLayerImp(), b); }
+
+
+/**
+ * ¥ì¥¤¥ä¡¼¤Î z ºÂÉ¸
+ */
+XBSLayer.prototype.getZIndex = function()
+{
+	return XBSLayer.getZIndexWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setZIndex = function(z)
+{
+	XBSLayer.setZIndexWithLayerImp(this.getLayerImp(), z);
+}
+
+
+XBSLayer.prototype.getStyleObject = function() 
+{
+	return XBSLayer.getStyleObjectWithLayerImp(this.imp);
+}
+XBSLayer.prototype.getLayerImp = function() { return this.imp; }
+XBSLayer.prototype.setLayerImp = function(imp) { this.imp = imp; }
+
+// Position & Size
+XBSLayer.prototype.popUpAtEventLocation = function(theEvent, axisType, offsetX, offsetY)
+{ XBSLayer.popUpWithLayerImpAtEventLocation(this.getLayerImp(), theEvent, axisType, offsetX, offsetY); }
+
+/**
+ * ¥ì¥¤¥ä¡¼¤Î°ÌÃÖ»ØÄê
+ * 
+ * @param x x ºÂÉ¸
+ * @param y y ºÂÉ¸
+ * @param axisType ºÂÉ¸¤ò»ØÄê¤¹¤ë°ÌÃÖ
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.prototype.setPosition = function(x, y, axisType)
+{ XBSLayer.setPositionWIthLayerImp(this.getLayerImp(), x, y, axisType); }
+XBSLayer.prototype.setLeftTopPosition = function(left, top) 
+{ 
+	XBSLayer.setLeftTopPositionWithLayerImp(this.getLayerImp(), left, top); 
+}
+
+XBSLayer.prototype.getX = function() { return XBSLayer.getLeftWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getY = function() { return XBSLayer.getTopWithLayerImp(this.getLayerImp()); }
+/**
+ * ºÂÉ¸¤òÀäÂÐÃÍ¤Ç¼èÆÀ
+ */
+XBSLayer.prototype.getAbsolute_ = function(fnName)
+{
+	var ret = 0;
+	var lyer = this;
+	
+	while (lyer != null && lyer.isValid()) {
+		ret += lyer[fnName]();	
+		lyer = lyer.getParent();
+	}
+	return ret;
+	
+}
+XBSLayer.prototype.getAbsoluteX = function()
+{
+	return this.getAbsolute_("getX");
+}
+XBSLayer.prototype.getAbsoluteY = function()
+{
+	return this.getAbsolute_("getY");
+}
+
+XBSLayer.prototype.getWidth  = function() { return XBSLayer.getWidthWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getHeight = function() { return XBSLayer.getHeightWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setWidth  = function(w) { return XBSLayer.setWidthWithLayerImp(this.getLayerImp(), w); }
+XBSLayer.prototype.setHeight = function(h) { return XBSLayer.setHeightWithLayerImp(this.getLayerImp(), h); }
+
+// HTML
+XBSLayer.prototype.getInnerHTML = function()
+{
+	return XBSLayer.getInnerHTMLWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setInnerHTML= function(htmlText)
+{
+	XBSLayer.setInnerHTMLWithLayerImp(this.getLayerImp(), htmlText);
+}
+
+// Cursor
+XBSLayer.prototype.setCursor = function(aName) { XBSLayer.setCursorWithLayerImp(this.getLayerImp(), aName); }
+
+//---------------------------------------------------------
+// XBSDocument
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * ¥É¥­¥å¥á¥ó¥È¾ðÊó¤Î¼èÆÀ
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSDocument = new Object();
+
+
+/**
+ * ¥É¥­¥å¥á¥ó¥ÈÁ´ÂÎ¤ÎÂç¤­¤µ
+ * 
+ * @return Éý¡¢¹â¤µ
+ */
+XBSDocument.getWidth = function()
+{
+	var w = 0;
+	
+	if (window.innerWidth != null) {
+		w = window.innerWidth;
+	
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ¤¬ÊÖ¤Ã¤Æ¤¯¤ë
+	/*
+	} else if (document.documentElement && document.documentElement.clientWidth != null) {
+		w = document.documentElement.clientWidth;
+	*/
+	} else if (document.body && document.body.clientWidth != null) {
+		w = document.body.clientWidth;
+	} 
+	return w;
+}
+
+XBSDocument.getHeight = function()
+{
+	var h = 0;
+	
+	if (window.innerHeight != null) {
+		h = window.innerHeight;
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ¤¬ÊÖ¤Ã¤Æ¤¯¤ë
+	/*
+	} else if (document.documentElement && document.documentElement.clientHeight != null) {
+		h = document.documentElement.clientHeight;
+	*/
+	} else if (document.body && document.body.clientHeight != null) {
+		h = document.body.clientHeight;
+	} 
+	return h;
+}
+
+/**
+ * ¥É¥­¥å¥á¥ó¥È¤Î²Ä»ëÎÎ°è¤Îº¸¾åºÂÉ¸
+ * 
+ * @return x, y
+ */
+XBSDocument.getPageOffsetX = function()
+{
+	var x = 0;
+	
+	if (document.body && document.body.scrollLeft != null) {
+		x = document.body.scrollLeft;
+	} else if (document.documentElement && document.documentElement.scrollLeft != null) {
+		x = document.documentElement.scrollLeft;
+	} else if (window.scrollX != null) {
+		x = window.scrollX;
+	} else if (window.pageXOffset != null) {
+		x = window.pageXOffset;
+	}
+	
+	return x;
+}
+XBSDocument.getPageOffsetY = function()
+{
+	var y = 0;
+	
+	if (document.body && document.body.scrollTop != null) {
+		y = document.body.scrollTop;
+	} else if (document.documentElement && document.documentElement.scrollTop != null) {
+		y = document.documentElement.scrollTop;
+	} else if (window.scrollY != null) {
+		y = window.scrollY;
+	} else if (window.pageYOffset != null) {
+		y = window.pageYOffset;
+	}
+	
+	return y;
+}
+
+//---------------------------------------------------------
+//XBSEvent
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * ¥¤¥Ù¥ó¥È¥ª¥Ö¥¸¥§¥¯¥È¤ÎÁàºî
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSEvent = new Object();
+
+// *** Key code *** //
+/**
+ * Key code (unicode)
+ * 
+ * @see http://www.unicode.org
+ */
+// 0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;;
+XBSEvent.BACKSPACE_KEY = 0x08;
+// 0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;;
+XBSEvent.TAB_KEY = 0x09;
+// 000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;;
+XBSEvent.LINE_FEED_KEY = 0x0A;
+// 000D;<control>;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;;
+XBSEvent.NEW_LINE_KEY = 0x0D;
+
+
+// Modifier keys
+XBSEvent.ALT_KEY_MASK     = 1;
+XBSEvent.SHIFT_KEY_MASK   = 1 << 1;
+XBSEvent.CONTROL_KEY_MASK = 1 << 2;
+XBSEvent.META_KEY_MASK    = 1 << 3;
+
+/**
+  * getMouseX(e), getMouseY(e)
+  *
+  * ¥Þ¥¦¥¹¤¬¥¤¥Ù¥ó¥È¤òµ¯¤³¤·¤¿»þ¤Ë
+  * XºÂÉ¸¡¢YºÂÉ¸¤òÊÖ¤¹´Ø¿ô
+  * 
+  * @param theEvent ¥Þ¥¦¥¹¥¤¥Ù¥ó¥È
+  * @return ºÂÉ¸
+  */
+XBSEvent.getMouseX = function(theEvent)
+{
+	var x = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// Safari ¤Ï clientX ¤âÀäÂÐºÂÉ¸¤ÇÊÖ¤·¤Æ¤¯¤ë
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageX
+	}
+	
+	if (theEvent.clientX != null) {
+		x = XBSDocument.getPageOffsetX() + theEvent.clientX;
+	} else if (theEvent.pageX != null) {
+		x = theEvent.pageX;
+	} else if (window.opera != null) {  // Ç°¤Î¤¿¤á¡£Æ°ºî³ÎÇ§¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¤³¤Ê¤¤
+		x = (document.documentElement ? window.pageXOffset : 0) + theEvent.clientX;
+	}
+	
+	return x;
+}
+XBSEvent.getMouseY = function(theEvent) {
+	var y = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	
+	// Safari ¤Ï clientY ¤âÀäÂÐºÂÉ¸¤ÇÊÖ¤·¤Æ¤¯¤ë
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageY;
+	}
+	
+	if (theEvent.clientY != null) {
+		y = XBSDocument.getPageOffsetY() + theEvent.clientY;
+	} else if (theEvent.pageY != null) {
+		y = theEvent.pageY;
+	} else if (window.opera != null) {  // Ç°¤Î¤¿¤á¡£Æ°ºî³ÎÇ§¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¤³¤Ê¤¤
+		y = (document.documentElement ? window.pageYOffset : 0) + theEvent.clientY;
+	}
+	
+	return y;
+}
+
+
+/**
+ * Key Event ¤Î Unicode ¥³¡¼¥É¥Ý¥¤¥ó¥È¤òÆÀ¤ë
+ * 
+ * @return code, ¤Ê¤±¤ì¤Ð null
+ */
+XBSEvent.getKeyCode = function(theEvent) 
+{
+	if (theEvent.which != null) {
+		return theEvent.which;
+	} else if (theEvent.keyCode != null) {
+		return theEvent.keyCode;
+	}
+	return null;
+}
+XBSEvent.getTarget = function(theEvent) 
+{
+	if (theEvent.target != null) {
+		return theEvent.target;
+	} else if (theEvent.srcElement != null) {
+		return theEvent.srcElement;
+	}
+	return null;
+}
+
+
+XBSEvent.getModifierFlags = function(theEvent)
+{
+	var flags = 0;
+	
+
+	if (defined(theEvent.ctrlKey)) {
+		if (theEvent.altKey) flags |= XBSEvent.ALT_KEY_MASK;
+		if (theEvent.shiftKey) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (theEvent.ctrlKey) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (theEvent.metaKey) flags |= XBSEvent.META_KEY_MASK;
+	} else if (defined(theEvent.modifiers)) {
+		var m = theEvent.modifiers;
+		
+		if (Event.ALT_MASK & m) flags |= XBSEvent.ALT_KEY_MASK;
+		if (Event.SHIFT_KEY_MASK & m) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (Event.CONTROL_MASK & m) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (Event.META_MASK & m) flags |= XBSEvent.META_KEY_MASK;
+	}
+	return flags;
+}
+
+
+//---------------------------------------------------------------------------------
+// Utilities
+//---------------------------------------------------------------------------------
+UtilKit = new Object();
+
+/**
+ * »ØÄê¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥í¥Ñ¥Æ¥£¤Ë´Ø¿ô¤ò *** ÄÉ²Ã *** ¤¹¤ë¡£
+ * °ÊÁ°¤ËÊÌ¤Î´Ø¿ô¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ì¤Ð¤½¤ì¤ò¸Æ¤Ó½Ð¤·¤Æ¤«¤é¡¢ÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¡£
+ * 
+ * NOTE: ÅÏ¤»¤ë°ú¿ô¤Ï¤È¤ê¤¢¤¨¤º 5 ¤Ä¤Þ¤Ç¤È¤·¤¿¡£¤³¤ì¤À¤±¤¢¤ì¤Ð½½Ê¬¤Ê¤Î¤Ç¡£
+ * 
+ * @param anObject ¥ª¥Ö¥¸¥§¥¯¥È
+ * @param funcName ¥×¥í¥Ñ¥Æ¥£Ì¾
+ * @param func     ´Ø¿ôËÜÂÎ
+ */
+UtilKit.addhook = function(anObject, funcName, func)
+{
+	var prev = anObject[funcName];
+	var fns  = new Array();
+	if (typeof prev == typeof UtilKit.addhook) {
+		fns[fns.length] = prev;
+	}
+	fns[fns.length] = func;
+	
+	// dprint("UtilKit.addhook(" + anObject + ", " + funcName + ") nfunc = " + fns.length);
+	anObject[funcName] = function() {
+		// dprint("funcName: " + funcName + ": " + this);
+		for (var i = 0; i < fns.length; i++) {
+			// dprint(fns[i]);
+			
+			// 2004-04-20  Takanori Ishikawa  
+			// -------------------------------------------------------------------
+			// ´Ø¿ôÆâ¤Ç°ú¿ô¤Î¸Ä¿ô¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¤¤ë²ÄÇ½À­¤â¤¢¤ë¤Î¤Ç¡¢ËÜÅö¤Ï°ú¿ô¸Ä¿ô¤ÇÊ¬´ô¤¹¤Ù¤­¤«¤â
+			// ¤¿¤À¡¢¤½¤Î¾ì¹ç¡¢°ú¿ô¤¬Â­¤ê¤Ê¤¤¾ì¹ç¤Ê¤É¤â¹ÍÎ¸¤¹¤ë¤ÈÌÌÅÝ¤¯¤µ¤¤¤Î¤Ç¼êÈ´¤­
+			 fns[i](
+				arguments[0],
+				arguments[1],
+				arguments[2],
+				arguments[3],
+				arguments[4]);
+			/*
+			var f = fns[i]; var args = arguments;
+			
+			switch (fns.length) {
+			case 0: f(); break;
+			case 1: f(args[0]); break;
+			case 2: f(args[0], args[1]); break;
+			case 3: f(args[0], args[1], args[2]); break;
+			default: ;
+			}
+			*/
+		}
+	};
+}
+
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥í¥Ñ¥Æ¥£¤òÊÖ¤¹¡£
+ * null ¤Î¾ì¹ç¤ÏÎã³°¤òÅê¤²¤ë
+ * 
+ * @param obj  object
+ * @param name property name
+ */
+UtilKit.getPropertyNotNull = function(obj, name)
+{
+	var v = obj[name];
+	
+	if (null == v) {
+		throw ASSERT_EXCEPTION + "object: " + obj + " name: " + name + ' must be nut null.';
+	}
+	
+	return v;	
+}
+
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤òÏÀÍýÃÍ¤ËÊÑ´¹
+ */
+UtilKit.parseBoolean = function(v)
+{
+	if (typeof v == typeof true) {
+		return v;
+	} else if (typeof v == typeof "") {
+		if ('true' == v) 
+			return true;
+		else if ('false' == v) 
+			return false;
+		else
+			return true;
+	} else if (null == v) {
+		return false;
+	} else {
+		return true;
+	}
+}
+/**
+ * ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥í¥Ñ¥Æ¥£¤«¤é¡¢¤½¤ì¤ÎÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥­¡¼¤ò¸¡º÷
+ * 
+ * @param anObject ¥ª¥Ö¥¸¥§¥¯¥È
+ * @param aValue   ¥×¥í¥Ñ¥Æ¥£ÃÍ
+ */
+UtilKit.getKeyForValue = function(anObject, aValue)
+{
+	for (var key in anObject) {
+		if (aValue == anObject[key]) {
+			return key;
+		}
+	}
+	return null;
+}
+
+UtilKit.getBgColorById = function(anId, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	return UtilKit.normalizeRGBColorRep(style.backgroundColor);
+}
+UtilKit.setBgColorById = function(anId, aColor, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+		
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	style.backgroundColor = aColor;
+}
+
+/**
+ * NN, Opera ¤ÏÇØ·Ê¿§¤ò rgb(r, g, b) ¤È¤¤¤¦·Á¼°¤Ç
+ * ÅÏ¤·¤Æ¤¯¤ë¤Î¤Ç¡¢¤½¤ì¤ò #RGB ¤ËÊÑ´¹
+ */
+UtilKit.normalizeRGBColorRep = function(aColor)
+{
+	var m = aColor.match(/rgb\((\d+),\s*(\d+),\s+(\d+)\)/);
+	
+	if (null == m) {
+		return aColor;
+	}
+	var s = "#";
+	
+	for (var i = 1; i <= 3; i++) {
+		var n = m[i];
+		
+		n = XBSUtil.parseIntNoError(n);
+		n = n.toString(16);
+		if (n.length == 1){
+			n = '0' + n;
+		}
+		s += n;
+	}
+	return s;
+}
+
+/**
+ * InitialFirstResponder:
+ *   ¥æ¡¼¥¶¤¬ºÇ½é¤ËÆþÎÏ¤¹¤Ù¤­¥Õ¥©¡¼¥àÍ×ÁÇ
+ * 
+ * InitialFirstResponder ¤òÀßÄê¤¹¤ë´Ø¿ô¤òÊÖ¤¹¡£
+ * ¤³¤Î´Ø¿ô¤Ï¼Â¹Ô¤µ¤ì¤ë¤È¡¢window.initialFirstResponder ¤Ë¤½¤Î¥Õ¥©¡¼¥àÍ×ÁÇ¤ò³ÊÇ¼¤·¡¢
+ * ¤½¤Î¥Õ¥©¡¼¥àÍ×ÁÇ¤ò focus() ¤¹¤ë¡£
+ * window.onload ¤Ç»È¤ï¤ì¤ë¤³¤È¤òÁÛÄê
+ * 
+ */
+UtilKit.makeInitialFirstResponder = function(formName, elementName)
+{
+	return function() {
+		var frm = document.forms[formName];
+	
+		if (frm == null) return;
+		frm = frm[elementName];
+		if (frm == null) return;
+		
+		window.initialFirstResponder = frm;
+		setTimeout("window.initialFirstResponder.focus()", 500);
+	};
+}
+
+
+//---------------------------------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------------------------------
+/**
+ * 
+ * ¥Ú¡¼¥¸¤ÎÆâÍÆ¤¬ÊÑ¹¹¤µ¤ì¤¿¤«¤É¤¦¤«¤òµ­Ï¿
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/20
+ */
+function ContentsChangedListener(/* Optional */ aName)
+{
+	this.name = aName;
+	if (this.name == null) {
+		this.name = '[undefined listener]';
+	}
+	this.changed = false;
+}
+ContentsChangedListener.prototype.toString = function()
+{ return '[ContentsChangedListener] ' + this.name; }
+
+ContentsChangedListener.prototype.isChanged = function() { return this.changed; }
+ContentsChangedListener.prototype.setChanged = function(b) {
+	if (this.changed != b) {
+		//alert(this + " changed: " + b);
+	}
+	this.changed = b; 
+}
+
+/**
+ * ¥¤¥Ù¥ó¥È¤òÅÐÏ¿¤·¡¢ÅÐÏ¿¤·¤¿¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤¿¤È¤­¤Ë
+ * ÊÑ¹¹¥Õ¥é¥°¤ò true ¤Ë¤¹¤ë¡£
+ * 
+ * ¼ç¤Ë html Í×ÁÇ¤Î onchange ¥¤¥Ù¥ó¥È¤Ê¤É¤òÊáÂª¤·¡¢
+ * ÊÑ¹¹¥Õ¥é¥°¤òÎ©¤Æ¤ë¤Î¤Ë»È¤¦¡£
+ */
+ContentsChangedListener.prototype.listenEvent = function(anObject, eventName)
+{
+//	2004-04-20  Takanori Ishikawa  
+//	------------------------------------------------------------------------
+//	this ¤Ï´Ø¿ôÆâÉô¤Ç¼Â¹Ô»þ¤Ë²ò¼á¤µ¤ì¤ë¤¿¤á¡¢°ìÅÙÊÑ¿ô¤ËÆþ¤ì¤Æ
+//	ÀÅÅª¥¹¥³¡¼¥×¤ËÂ«Çû¤¹¤ëÉ¬Í×¤¬¤¢¤ë¡Ê²òÊü¤µ¤ì¤Ê¤¤¡©¡Ë
+	var me = this
+	var callback = function(){ me.setChanged(true); };
+	
+	UtilKit.addhook(anObject, eventName, callback);
+}
+
+
+//---------------------------------------------------------------------------------
+// Common
+//---------------------------------------------------------------------------------
+/**
+ * ¥¢¥×¥ê¥±¡¼¥·¥ç¥óÁ´ÂÎ¤ÎÀßÄê
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+OEMBlogGlobal = new Object();
+
+/**
+ * µ­»öÊÔ½¸¤Ç Blog ¥Ý¡¼¥¿¥ë¡¦¥«¥Æ¥´¥ê¤ÎÁªÂò¤ò¥¯¥Ã¥­¡¼¤ËÊÝÂ¸¤¹¤ë¤«
+ */
+OEMBlogGlobal.saveTbCategoryToCookie = false;
+
+/**
+ * µ­»öÊÔ½¸¤Ç¥¿¥°ÊÔ½¸µ¡Ç½¡Ê¥¿¥°¤´¤Èºï½ü¡¢°ÜÆ°¤Ê¤É¡Ë¤ò HTML ¥¿¥°¤Ç¤âÍ­¸ú¤Ë¤¹¤ë¤«
+ */
+OEMBlogGlobal.enableTagEditingOnHTML = false;
+
+
+/**
+ * ¹àÌÜÀßÄê¤Î¥Ç¥£¥¹¥¯¥í¡¼¥¸¥ã¥È¥é¥¤¥¢¥ó¥°¥ë¤Ê¤É¤Ç¥¢¥Ë¥á¡¼¥·¥ç¥ó¤òÍ­¸ú¤Ë¤¹¤ë¤«
+ */
+OEMBlogGlobal.enableAnimationFeedback = true;
+
+/**
+ * ²èÁü¤ò¥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Ñ¥¹
+ * jsp Â¦¤ÇÅ¬µ¹¹¹¿·¤µ¤ì¤ë¡£
+ */
+OEMBlogGlobal.uploadImageDirectory = null;
+
+/**
+ * ¥¢¥Ã¥×¥í¡¼¥É¤Ç¤­¤ë²èÁü¥Õ¥¡¥¤¥ëÌ¾¤Î·Á¼°
+ */
+OEMBlogGlobal.IMAGE_FILE_PATTERN = /{(º¸:|±¦:)?([a-zA-Z0-9-_.!~'()]+\.[a-zA-Z]+)}/;
+
+/**
+ * ¥µ¥¤¥É¥Ð¡¼¡§ÇÛÃÖ¤Ç¤­¤ë¹àÌÜ¤ÎºÇÂç¿ô
+ * 
+ * @see sidefunc_order.js BoxConfig.maxNBoxes
+ */
+OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES	= 50;	// ¡Ö»ÈÍÑ¤·¤Ê¤¤µ¡Ç½¡×
+OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES		= 50;	// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×º¸
+OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES	= 50;	// ¡Ö»ÈÍÑ¤¹¤ëµ¡Ç½¡×±¦
+
+
+/**
+ * 
+ * µ­»öÊÔ½¸¡¢¿·µ¬ºîÀ®¤Ç¤Ï°Ê²¼¤ÎÊ¸»úÎó¤ò´Þ¤à¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤¿¾ì¹ç¡¢
+ * ¤Þ¤ÀÊÑ¹¹¤¬ÊÝÂ¸¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð³ÎÇ§¥À¥¤¥¢¥í¥°¤ò½Ð¤¹¡£
+ * 
+ * @see entry_write_edit.js, entry_save_confirm.jsp
+ * @see OEMBlogGlobal.watchOtherLinks
+ */
+OEMBlogGlobal.DOCUMENT_EDITED_WARNING = "ÊÑ¹¹¤ÏÊÝÂ¸¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>¼¡¤Î¥Ú¡¼¥¸¤Ø°Ü¤Ã¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©"
+OEMBlogGlobal.WATCH_OTHER_LINK_LIST = [
+					/* ¾å */
+					'MyPage',			/* ¥Þ¥¤¥Ú¡¼¥¸ */
+					'EntryWrite',		/* µ­»ö¿·µ¬ºîÀ® */
+					'EntryList',		/* µ­»ö°ìÍ÷ */
+					'TopicList',		/* ¥ê¥ó¥¯¥ê¥¹¥È */
+					'SidefuncOrder',	/* ¥µ¥¤¥É¥Ð¡¼ */
+					'DesignChange',		/* ¥Ç¥¶¥¤¥ó */
+					'BlogSetup',		/* ÀßÄê */
+					
+					/* º¸ */
+					'SidefuncOrder',	/* µ¡Ç½ÁªÂò¡¦ÊÂ¤ÓÂØ¤¨ */
+					'SidefuncSetup',	/* É½¼¨Ì¾ÊÑ¹¹ */
+					'SidefuncEditList',		/* µ¡Ç½ÄÉ²Ã */
+					'LinksList',		/* ¥ê¥ó¥¯½¸  ÊÔ½¸ */
+					'CategoryList'		/* ¥«¥Æ¥´¥ê  ÊÔ½¸ */
+					];
+
+
+/**
+ * ¥Æ¥­¥¹¥È¤ÎÃÖ´¹¤Ê¤É¤Ç»ÈÍÑ¤¹¤ë²þ¹Ô¥³¡¼¥É
+ */
+/** TODO: »ÅÍÍ¤Ë¤·¤¿¤¬¤Ã¤Æ¡¢È½ÊÌ¥³¡¼¥É¤ò½ñ¤¯¤³¤È¡£¤È¤ê¤¢¤¨¤º¡¢CRLF ¤Ë¤·¤Æ¤ª¤¯ */
+OEMBlogGlobal.lineSeparator = "\r\n";
+
+
+OEMBlogGlobal.makeWatchOtherLinkFunction = function(aListener, prevFunc)
+{
+	return function(e) {
+		var ret = true;
+			
+		if (prevFunc != null) {
+			ret = prevFunc(e);
+		}
+		if (aListener.isChanged() == false)
+			return ret;
+			
+		return (htmlConfirm(OEMBlogGlobal.DOCUMENT_EDITED_WARNING))
+	};
+}
+OEMBlogGlobal.watchOtherLinks = function(aDocument, aListener)
+{
+	var linkArray = aDocument.links;
+	var nms = OEMBlogGlobal.WATCH_OTHER_LINK_LIST;
+	var link;
+	var count = 0;
+	
+	for (var i = 0; i < linkArray.length; i++) {
+		
+		link = linkArray[i];
+		if (null == link) continue;
+		
+		for (var j = 0; j < nms.length; j++) {
+			if (link.href.indexOf(nms[j]) != -1) {
+				var prevFunc = link.onclick;
+				
+				if (typeof prevFunc != 'function') {
+					prevFunc = null;
+				}
+				link.onclick = OEMBlogGlobal.makeWatchOtherLinkFunction(aListener, prevFunc);
+				
+				count++;
+				break;
+			}
+		}
+		if (count == nms.length) {
+			break;
+		}
+	}
+}
Index: /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/effects.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/effects.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/effects.js	(revision 1328)
@@ -0,0 +1,612 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// Parts (c) 2005 Justin Palmer (http://encytemedia.com/)
+// Parts (c) 2005 Mark Pilgrim (http://diveintomark.org/)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+Effect = {}
+Effect2 = Effect; // deprecated
+
+/* ------------- transitions ------------- */
+
+Effect.Transitions = {}
+
+Effect.Transitions.linear = function(pos) {
+  return pos;
+}
+Effect.Transitions.sinoidal = function(pos) {
+  return (-Math.cos(pos*Math.PI)/2) + 0.5;
+}
+Effect.Transitions.reverse  = function(pos) {
+  return 1-pos;
+}
+Effect.Transitions.flicker = function(pos) {
+  return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random(0.25);
+}
+Effect.Transitions.wobble = function(pos) {
+  return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+}
+Effect.Transitions.pulse = function(pos) {
+  return (Math.floor(pos*10) % 2 == 0 ? 
+    (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
+}
+Effect.Transitions.none = function(pos) {
+  return 0;
+}
+Effect.Transitions.full = function(pos) {
+  return 1;
+}
+
+/* ------------- element ext -------------- */
+
+Element.makePositioned = function(element) {
+  element = $(element);
+  if(element.style.position == "")
+    element.style.position = "relative";
+}
+
+Element.makeClipping = function(element) {
+  element = $(element);
+  element._overflow = element.style.overflow || 'visible';
+  if(element._overflow!='hidden') element.style.overflow = 'hidden';
+}
+
+Element.undoClipping = function(element) {
+  element = $(element);
+  if(element._overflow!='hidden') element.style.overflow = element._overflow;
+}
+
+/* ------------- core effects ------------- */
+
+Effect.Base = function() {};
+Effect.Base.prototype = {
+  setOptions: function(options) {
+    this.options = Object.extend({
+      transition: Effect.Transitions.sinoidal,
+      duration:   1.0,   // seconds
+      fps:        25.0,  // max. 100fps
+      sync:       false, // true for combining
+      from:       0.0,
+      to:         1.0
+    }, options || {});
+  },
+  start: function(options) {
+    this.setOptions(options || {});
+    this.currentFrame = 0;
+    this.startOn      = new Date().getTime();
+    this.finishOn     = this.startOn + (this.options.duration*1000);
+    if(this.options.beforeStart) this.options.beforeStart(this);
+    if(!this.options.sync) this.loop();  
+  },
+  loop: function() {
+    var timePos = new Date().getTime();
+    if(timePos >= this.finishOn) {
+      this.render(this.options.to);
+      if(this.finish) this.finish(); 
+      if(this.options.afterFinish) this.options.afterFinish(this);
+      return;  
+    }
+    var pos   = (timePos - this.startOn) / (this.finishOn - this.startOn);
+    var frame = Math.round(pos * this.options.fps * this.options.duration);
+    if(frame > this.currentFrame) {
+      this.render(pos);
+      this.currentFrame = frame;
+    }
+    this.timeout = setTimeout(this.loop.bind(this), 10);
+  },
+  render: function(pos) {
+    if(this.options.transition) pos = this.options.transition(pos);
+    pos *= (this.options.to-this.options.from);
+    pos += this.options.from; 
+    if(this.options.beforeUpdate) this.options.beforeUpdate(this);
+    if(this.update) this.update(pos);
+    if(this.options.afterUpdate) this.options.afterUpdate(this);  
+  },
+  cancel: function() {
+    if(this.timeout) clearTimeout(this.timeout);
+  }
+}
+
+Effect.Parallel = Class.create();
+Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
+  initialize: function(effects) {
+    this.effects = effects || [];
+    this.start(arguments[1]);
+  },
+  update: function(position) {
+    for (var i = 0; i < this.effects.length; i++)
+      this.effects[i].render(position);  
+  },
+  finish: function(position) {
+    for (var i = 0; i < this.effects.length; i++)
+      if(this.effects[i].finish) this.effects[i].finish(position);
+  }
+});
+
+// Internet Explorer caveat: works only on elements the have
+// a 'layout', meaning having a given width or height. 
+// There is no way to safely set this automatically.
+Effect.Opacity = Class.create();
+Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
+  initialize: function(element) {
+    this.element = $(element);
+    options = Object.extend({
+      from: 0.0,
+      to:   1.0
+    }, arguments[1] || {});
+    this.start(options);
+  },
+  update: function(position) {
+    this.setOpacity(position);
+  }, 
+  setOpacity: function(opacity) {
+    opacity = (opacity == 1) ? 0.99999 : opacity;
+    this.element.style.opacity = opacity;
+    this.element.style.filter = "alpha(opacity:"+opacity*100+")";
+  }
+});
+
+Effect.MoveBy = Class.create();
+Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
+  initialize: function(element, toTop, toLeft) {
+    this.element      = $(element);
+    this.originalTop  = parseFloat(this.element.style.top || '0');
+    this.originalLeft = parseFloat(this.element.style.left || '0');
+    this.toTop        = toTop;
+    this.toLeft       = toLeft;
+    Element.makePositioned(this.element);
+    this.start(arguments[3]);
+  },
+  update: function(position) {
+    topd  = this.toTop  * position + this.originalTop;
+    leftd = this.toLeft * position + this.originalLeft;
+    this.setPosition(topd, leftd);
+  },
+  setPosition: function(topd, leftd) {
+    this.element.style.top  = topd  + "px";
+    this.element.style.left = leftd + "px";
+  }
+});
+
+Effect.Scale = Class.create();
+Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
+  initialize: function(element, percent) {
+    this.element = $(element)
+    options = Object.extend({
+      scaleX: true,
+      scaleY: true,
+      scaleContent: true,
+      scaleFromCenter: false,
+      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
+      scaleFrom: 100.0
+    }, arguments[2] || {});
+    this.originalTop    = this.element.offsetTop;
+    this.originalLeft   = this.element.offsetLeft;
+    if(this.element.style.fontSize=="") this.sizeEm = 1.0;
+    if(this.element.style.fontSize && this.element.style.fontSize.indexOf("em")>0)
+      this.sizeEm      = parseFloat(this.element.style.fontSize);
+    this.factor = (percent/100.0) - (options.scaleFrom/100.0);
+    if(options.scaleMode=='box') {
+      this.originalHeight = this.element.clientHeight;
+      this.originalWidth  = this.element.clientWidth; 
+    } else 
+    if(options.scaleMode=='contents') {
+      this.originalHeight = this.element.scrollHeight;
+      this.originalWidth  = this.element.scrollWidth;
+    } else {
+      this.originalHeight = options.scaleMode.originalHeight;
+      this.originalWidth  = options.scaleMode.originalWidth;
+    }
+    this.start(options);
+  },
+
+  update: function(position) {
+    currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+    if(this.options.scaleContent && this.sizeEm) 
+      this.element.style.fontSize = this.sizeEm*currentScale + "em";
+    this.setDimensions(
+      this.originalWidth * currentScale, 
+      this.originalHeight * currentScale);
+  },
+
+  setDimensions: function(width, height) {
+    if(this.options.scaleX) this.element.style.width = width + 'px';
+    if(this.options.scaleY) this.element.style.height = height + 'px';
+    if(this.options.scaleFromCenter) {
+      topd  = (height - this.originalHeight)/2;
+      leftd = (width  - this.originalWidth)/2;
+      if(this.element.style.position=='absolute') {
+        if(this.options.scaleY) this.element.style.top = this.originalTop-topd + "px";
+        if(this.options.scaleX) this.element.style.left = this.originalLeft-leftd + "px";
+      } else {
+        if(this.options.scaleY) this.element.style.top = -topd + "px";
+        if(this.options.scaleX) this.element.style.left = -leftd + "px";
+      }
+    }
+  }
+});
+
+Effect.Highlight = Class.create();
+Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
+  initialize: function(element) {
+    this.element = $(element);
+    
+    // try to parse current background color as default for endcolor
+    // browser stores this as: "rgb(255, 255, 255)", convert to "#ffffff" format
+    var endcolor = "#ffffff";
+    var current = this.element.style.backgroundColor;
+    if(current && current.slice(0,4) == "rgb(") {
+      endcolor = "#";
+      var cols = current.slice(4,current.length-1).split(',');
+      var i=0; do { endcolor += parseInt(cols[i]).toColorPart() } while (++i<3); }
+      
+    var options = Object.extend({
+      startcolor:   "#ffff99",
+      endcolor:     endcolor,
+      restorecolor: current 
+    }, arguments[1] || {});
+    
+    // init color calculations
+    this.colors_base = [
+      parseInt(options.startcolor.slice(1,3),16),
+      parseInt(options.startcolor.slice(3,5),16),
+      parseInt(options.startcolor.slice(5),16) ];
+    this.colors_delta = [
+      parseInt(options.endcolor.slice(1,3),16)-this.colors_base[0],
+      parseInt(options.endcolor.slice(3,5),16)-this.colors_base[1],
+      parseInt(options.endcolor.slice(5),16)-this.colors_base[2] ];
+
+    this.start(options);
+  },
+  update: function(position) {
+    var colors = [
+      Math.round(this.colors_base[0]+(this.colors_delta[0]*position)),
+      Math.round(this.colors_base[1]+(this.colors_delta[1]*position)),
+      Math.round(this.colors_base[2]+(this.colors_delta[2]*position)) ];
+    this.element.style.backgroundColor = "#" +
+      colors[0].toColorPart() + colors[1].toColorPart() + colors[2].toColorPart();
+  },
+  finish: function() {
+    this.element.style.backgroundColor = this.options.restorecolor;
+  }
+});
+
+Effect.ScrollTo = Class.create();
+Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
+  initialize: function(element) {
+    this.element = $(element);
+    Position.prepare();
+    var offsets = Position.cumulativeOffset(this.element);
+    var max = window.innerHeight ? 
+      window.height - window.innerHeight :
+      document.body.scrollHeight - 
+        (document.documentElement.clientHeight ? 
+          document.documentElement.clientHeight : document.body.clientHeight);
+    this.scrollStart = Position.deltaY;
+    this.delta  = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
+    this.start(arguments[1] || {});
+  },
+  update: function(position) {
+    Position.prepare();
+    window.scrollTo(Position.deltaX, 
+      this.scrollStart + (position*this.delta));
+  }
+});
+
+/* ------------- prepackaged effects ------------- */
+
+Effect.Fade = function(element) {
+  options = Object.extend({
+  from: 1.0,
+  to:   0.0,
+  afterFinish: function(effect) 
+    { Element.hide(effect.element);
+      effect.setOpacity(1); } 
+  }, arguments[1] || {});
+  new Effect.Opacity(element,options);
+}
+
+Effect.Appear = function(element) {
+  options = Object.extend({
+  from: 0.0,
+  to:   1.0,
+  beforeStart: function(effect)  
+    { effect.setOpacity(0);
+      Element.show(effect.element); },
+  afterUpdate: function(effect)  
+    { Element.show(effect.element); }
+  }, arguments[1] || {});
+  new Effect.Opacity(element,options);
+}
+
+Effect.Puff = function(element) {
+  new Effect.Parallel(
+   [ new Effect.Scale(element, 200, { sync: true, scaleFromCenter: true }), 
+     new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], 
+     { duration: 1.0, 
+      afterUpdate: function(effect) 
+       { effect.effects[0].element.style.position = 'absolute'; },
+      afterFinish: function(effect)
+       { Element.hide(effect.effects[0].element); }
+     }
+   );
+}
+
+Effect.BlindUp = function(element) {
+  Element.makeClipping(element);
+  new Effect.Scale(element, 0, 
+    Object.extend({ scaleContent: false, 
+      scaleX: false, 
+      afterFinish: function(effect) 
+        { 
+          Element.hide(effect.element);
+          Element.undoClipping(effect.element);
+        } 
+    }, arguments[1] || {})
+  );
+}
+
+Effect.BlindDown = function(element) {
+  $(element).style.height   = '0px';
+  Element.makeClipping(element);
+  Element.show(element);
+  new Effect.Scale(element, 100, 
+    Object.extend({ scaleContent: false, 
+      scaleX: false, 
+      scaleMode: 'contents',
+      scaleFrom: 0,
+      afterFinish: function(effect) {
+        Element.undoClipping(effect.element);
+      }
+    }, arguments[1] || {})
+  );
+}
+
+Effect.SwitchOff = function(element) {
+  new Effect.Appear(element,
+    { duration: 0.4,
+     transition: Effect.Transitions.flicker,
+     afterFinish: function(effect)
+      { effect.element.style.overflow = 'hidden';
+        new Effect.Scale(effect.element, 1, 
+         { duration: 0.3, scaleFromCenter: true,
+          scaleX: false, scaleContent: false,
+          afterUpdate: function(effect) { 
+           if(effect.element.style.position=="")
+             effect.element.style.position = 'relative'; },
+          afterFinish: function(effect) { Element.hide(effect.element); }
+         } )
+      }
+    } );
+}
+
+Effect.DropOut = function(element) {
+  new Effect.Parallel(
+    [ new Effect.MoveBy(element, 100, 0, { sync: true }), 
+      new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], 
+    { duration: 0.5, 
+     afterFinish: function(effect)
+       { Element.hide(effect.effects[0].element); } 
+    });
+}
+
+Effect.Shake = function(element) {
+  new Effect.MoveBy(element, 0, 20, 
+    { duration: 0.05, afterFinish: function(effect) {
+  new Effect.MoveBy(effect.element, 0, -40, 
+    { duration: 0.1, afterFinish: function(effect) { 
+  new Effect.MoveBy(effect.element, 0, 40, 
+    { duration: 0.1, afterFinish: function(effect) {  
+  new Effect.MoveBy(effect.element, 0, -40, 
+    { duration: 0.1, afterFinish: function(effect) {  
+  new Effect.MoveBy(effect.element, 0, 40, 
+    { duration: 0.1, afterFinish: function(effect) {  
+  new Effect.MoveBy(effect.element, 0, -20, 
+    { duration: 0.05, afterFinish: function(effect) {  
+  }}) }}) }}) }}) }}) }});
+}
+
+Effect.SlideDown = function(element) {
+  element = $(element);
+  element.style.height   = '0px';
+  Element.makeClipping(element);
+  Element.cleanWhitespace(element);
+  Element.makePositioned(element.firstChild);
+  Element.show(element);
+  new Effect.Scale(element, 100, 
+   Object.extend({ scaleContent: false, 
+    scaleX: false, 
+    scaleMode: 'contents',
+    scaleFrom: 0,
+    afterUpdate: function(effect) 
+      { effect.element.firstChild.style.bottom = 
+          (effect.originalHeight - effect.element.clientHeight) + 'px'; },
+    afterFinish: function(effect) 
+      {  Element.undoClipping(effect.element); }
+    }, arguments[1] || {})
+  );
+}
+  
+Effect.SlideUp = function(element) {
+  element = $(element);
+  Element.makeClipping(element);
+  Element.cleanWhitespace(element);
+  Element.makePositioned(element.firstChild);
+  Element.show(element);
+  new Effect.Scale(element, 0, 
+   Object.extend({ scaleContent: false, 
+    scaleX: false, 
+    afterUpdate: function(effect) 
+      { effect.element.firstChild.style.bottom = 
+          (effect.originalHeight - effect.element.clientHeight) + 'px'; },
+    afterFinish: function(effect)
+      { 
+        Element.hide(effect.element);
+        Element.undoClipping(effect.element);
+      }
+   }, arguments[1] || {})
+  );
+}
+
+Effect.Squish = function(element) {
+ new Effect.Scale(element, 0, 
+   { afterFinish: function(effect) { Element.hide(effect.element); } });
+}
+
+Effect.Grow = function(element) {
+  element = $(element);
+  var options = arguments[1] || {};
+  
+  var originalWidth = element.clientWidth;
+  var originalHeight = element.clientHeight;
+  element.style.overflow = 'hidden';
+  Element.show(element);
+  
+  var direction = options.direction || 'center';
+  var moveTransition = options.moveTransition || Effect.Transitions.sinoidal;
+  var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal;
+  var opacityTransition = options.opacityTransition || Effect.Transitions.full;
+  
+  var initialMoveX, initialMoveY;
+  var moveX, moveY;
+  
+  switch (direction) {
+    case 'top-left':
+      initialMoveX = initialMoveY = moveX = moveY = 0; 
+      break;
+    case 'top-right':
+      initialMoveX = originalWidth;
+      initialMoveY = moveY = 0;
+      moveX = -originalWidth;
+      break;
+    case 'bottom-left':
+      initialMoveX = moveX = 0;
+      initialMoveY = originalHeight;
+      moveY = -originalHeight;
+      break;
+    case 'bottom-right':
+      initialMoveX = originalWidth;
+      initialMoveY = originalHeight;
+      moveX = -originalWidth;
+      moveY = -originalHeight;
+      break;
+    case 'center':
+      initialMoveX = originalWidth / 2;
+      initialMoveY = originalHeight / 2;
+      moveX = -originalWidth / 2;
+      moveY = -originalHeight / 2;
+      break;
+  }
+  
+  new Effect.MoveBy(element, initialMoveY, initialMoveX, { 
+    duration: 0.01, 
+    beforeUpdate: function(effect) { $(element).style.height = '0px'; },
+    afterFinish: function(effect) {
+      new Effect.Parallel(
+        [ new Effect.Opacity(element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }),
+          new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition }),
+          new Effect.Scale(element, 100, { 
+            scaleMode: { originalHeight: originalHeight, originalWidth: originalWidth }, 
+            sync: true, scaleFrom: 0, scaleTo: 100, transition: scaleTransition })],
+        options); }
+    });
+}
+
+Effect.Shrink = function(element) {
+  element = $(element);
+  var options = arguments[1] || {};
+  
+  var originalWidth = element.clientWidth;
+  var originalHeight = element.clientHeight;
+  element.style.overflow = 'hidden';
+  Element.show(element);
+
+  var direction = options.direction || 'center';
+  var moveTransition = options.moveTransition || Effect.Transitions.sinoidal;
+  var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal;
+  var opacityTransition = options.opacityTransition || Effect.Transitions.none;
+  
+  var moveX, moveY;
+  
+  switch (direction) {
+    case 'top-left':
+      moveX = moveY = 0;
+      break;
+    case 'top-right':
+      moveX = originalWidth;
+      moveY = 0;
+      break;
+    case 'bottom-left':
+      moveX = 0;
+      moveY = originalHeight;
+      break;
+    case 'bottom-right':
+      moveX = originalWidth;
+      moveY = originalHeight;
+      break;
+    case 'center':  
+      moveX = originalWidth / 2;
+      moveY = originalHeight / 2;
+      break;
+  }
+  
+  new Effect.Parallel(
+    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }),
+      new Effect.Scale(element, 0, { sync: true, transition: moveTransition }),
+      new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: scaleTransition }) ],
+    options);
+}
+
+Effect.Pulsate = function(element) {
+  var options    = arguments[1] || {};
+  var transition = options.transition || Effect.Transitions.sinoidal;
+  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
+  reverser.bind(transition);
+  new Effect.Opacity(element, 
+    Object.extend(Object.extend({  duration: 3.0,
+       afterFinish: function(effect) { Element.show(effect.element); }
+    }, options), {transition: reverser}));
+}
+
+Effect.Fold = function(element) {
+ $(element).style.overflow = 'hidden';
+ new Effect.Scale(element, 5, Object.extend({   
+   scaleContent: false,
+   scaleTo: 100,
+   scaleX: false,
+   afterFinish: function(effect) {
+   new Effect.Scale(element, 1, { 
+     scaleContent: false, 
+     scaleTo: 0,
+     scaleY: false,
+     afterFinish: function(effect) { Element.hide(effect.element) } });
+ }}, arguments[1] || {}));
+}
+
+// old: new Effect.ContentZoom(element, percent)
+// new: Element.setContentZoom(element, percent) 
+
+Element.setContentZoom = function(element, percent) {
+  var element = $(element);
+  element.style.fontSize = (percent/100) + "em";  
+  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
+}
Index: /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/dragdrop.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/dragdrop.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/dragdrop.js	(revision 1328)
@@ -0,0 +1,537 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// 
+// Element.Class part Copyright (c) 2005 by Rick Olson
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Element.Class = {
+    // Element.toggleClass(element, className) toggles the class being on/off
+    // Element.toggleClass(element, className1, className2) toggles between both classes,
+    //   defaulting to className1 if neither exist
+    toggle: function(element, className) {
+      if(Element.Class.has(element, className)) {
+        Element.Class.remove(element, className);
+        if(arguments.length == 3) Element.Class.add(element, arguments[2]);
+      } else {
+        Element.Class.add(element, className);
+        if(arguments.length == 3) Element.Class.remove(element, arguments[2]);
+      }
+    },
+
+    // gets space-delimited classnames of an element as an array
+    get: function(element) {
+      element = $(element);
+      return element.className.split(' ');
+    },
+
+    // functions adapted from original functions by Gavin Kistner
+    remove: function(element) {
+      element = $(element);
+      var regEx;
+      for(var i = 1; i < arguments.length; i++) {
+        regEx = new RegExp("^" + arguments[i] + "\\b\\s*|\\s*\\b" + arguments[i] + "\\b", 'g');
+        element.className = element.className.replace(regEx, '')
+      }
+    },
+
+    add: function(element) {
+      element = $(element);
+      for(var i = 1; i < arguments.length; i++) {
+        Element.Class.remove(element, arguments[i]);
+        element.className += (element.className.length > 0 ? ' ' : '') + arguments[i];
+      }
+    },
+
+    // returns true if all given classes exist in said element
+    has: function(element) {
+      element = $(element);
+      if(!element || !element.className) return false;
+      var regEx;
+      for(var i = 1; i < arguments.length; i++) {
+        regEx = new RegExp("\\b" + arguments[i] + "\\b");
+        if(!regEx.test(element.className)) return false;
+      }
+      return true;
+    },
+    
+    // expects arrays of strings and/or strings as optional paramters
+    // Element.Class.has_any(element, ['classA','classB','classC'], 'classD')
+    has_any: function(element) {
+      element = $(element);
+      if(!element || !element.className) return false;
+      var regEx;
+      for(var i = 1; i < arguments.length; i++) {
+        if((typeof arguments[i] == 'object') && 
+          (arguments[i].constructor == Array)) {
+          for(var j = 0; j < arguments[i].length; j++) {
+            regEx = new RegExp("\\b" + arguments[i][j] + "\\b");
+            if(regEx.test(element.className)) return true;
+          }
+        } else {
+          regEx = new RegExp("\\b" + arguments[i] + "\\b");
+          if(regEx.test(element.className)) return true;
+        }
+      }
+      return false;
+    },
+    
+    childrenWith: function(element, className) {
+      var children = $(element).getElementsByTagName('*');
+      var elements = new Array();
+      
+      for (var i = 0; i < children.length; i++) {
+        if (Element.Class.has(children[i], className)) {
+          elements.push(children[i]);
+          break;
+        }
+      }
+      
+      return elements;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Droppables = {
+  drops: false,
+  
+  remove: function(element) {
+    for(var i = 0; i < this.drops.length; i++)
+      if(this.drops[i].element == element)
+        this.drops.splice(i,1);
+  },
+  
+  add: function(element) {
+    var element = $(element);
+    var options = Object.extend({
+      greedy:     true,
+      hoverclass: null  
+    }, arguments[1] || {});
+    
+    // cache containers
+    if(options.containment) {
+      options._containers = new Array();
+      var containment = options.containment;
+      if((typeof containment == 'object') && 
+        (containment.constructor == Array)) {
+        for(var i=0; i<containment.length; i++)
+          options._containers.push($(containment[i]));
+      } else {
+        options._containers.push($(containment));
+      }
+      options._containers_length = 
+        options._containers.length-1;
+    }
+    
+    Element.makePositioned(element); // fix IE
+    
+    options.element = element;
+    
+    // activate the droppable    
+    if(!this.drops) this.drops = [];
+    this.drops.push(options);
+  },
+  
+  is_contained: function(element, drop) {
+    var containers = drop._containers;
+    var parentNode = element.parentNode;
+    var i = drop._containers_length;
+    do { if(parentNode==containers[i]) return true; } while (i--);
+    return false;
+  },
+  
+  is_affected: function(pX, pY, element, drop) {
+    return (
+      (drop.element!=element) &&
+      ((!drop._containers) ||
+        this.is_contained(element, drop)) &&
+      ((!drop.accept) ||
+        (Element.Class.has_any(element, drop.accept))) &&
+      Position.within(drop.element, pX, pY) );
+  },
+  
+  deactivate: function(drop) {
+    Element.Class.remove(drop.element, drop.hoverclass);
+    this.last_active = null;
+  },
+  
+  activate: function(drop) {
+    if(this.last_active) this.deactivate(this.last_active);
+    if(drop.hoverclass) {
+      Element.Class.add(drop.element, drop.hoverclass);
+      this.last_active = drop;
+    }
+  },
+  
+  show: function(event, element) {
+    if(!this.drops) return;
+    var pX = Event.pointerX(event);
+    var pY = Event.pointerY(event);
+    Position.prepare();
+    
+    var i = this.drops.length-1; do {
+      var drop = this.drops[i];
+      if(this.is_affected(pX, pY, element, drop)) {
+        if(drop.onHover)
+           drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
+        if(drop.greedy) { 
+          this.activate(drop);
+          return;
+        }
+      }
+    } while (i--);
+  },
+  
+  fire: function(event, element) {
+    if(!this.last_active) return;
+    Position.prepare();
+    
+    if (this.is_affected(Event.pointerX(event), Event.pointerY(event), element, this.last_active))
+      if (this.last_active.onDrop) 
+        this.last_active.onDrop(element, this.last_active);
+    
+  },
+  
+  reset: function() {
+    if(this.last_active)
+      this.deactivate(this.last_active);
+  }
+}
+
+Draggables = {
+  observers: new Array(),
+  addObserver: function(observer) {
+    this.observers.push(observer);    
+  },
+  removeObserver: function(element) {  // element instead of obsever fixes mem leaks
+    for(var i = 0; i < this.observers.length; i++)
+      if(this.observers[i].element && (this.observers[i].element == element))
+        this.observers.splice(i,1);
+  },
+  notify: function(eventName, draggable) {  // 'onStart', 'onEnd'
+    for(var i = 0; i < this.observers.length; i++)
+      this.observers[i][eventName](draggable);
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Draggable = Class.create();
+Draggable.prototype = {
+  initialize: function(element) {
+    var options = Object.extend({
+      handle: false,
+      starteffect: function(element) { 
+        new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); 
+      },
+      reverteffect: function(element, top_offset, left_offset) {
+        new Effect.MoveBy(element, -top_offset, -left_offset, {duration:0.4});
+      },
+      endeffect: function(element) { 
+         new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0}); 
+      },
+      zindex: 1000,
+      revert: false
+    }, arguments[1] || {});
+    
+    this.element      = $(element);
+    this.handle       = options.handle ? $(options.handle) : this.element;
+    
+    Element.makePositioned(this.element); // fix IE
+    
+    this.offsetX      = 0;
+    this.offsetY      = 0;
+    this.originalLeft = this.currentLeft();
+    this.originalTop  = this.currentTop();
+    this.originalX    = this.element.offsetLeft;
+    this.originalY    = this.element.offsetTop;
+    this.originalZ    = parseInt(this.element.style.zIndex || "0");
+    
+    this.options      = options;
+    
+    this.active       = false;
+    this.dragging     = false;   
+    
+    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
+    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
+    this.eventMouseMove = this.update.bindAsEventListener(this);
+    this.eventKeypress  = this.keyPress.bindAsEventListener(this);
+    
+    Event.observe(this.handle, "mousedown", this.eventMouseDown);
+    Event.observe(document, "mouseup", this.eventMouseUp);
+    Event.observe(document, "mousemove", this.eventMouseMove);
+    Event.observe(document, "keypress", this.eventKeypress);
+  },
+  destroy: function() {
+    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
+    Event.stopObserving(document, "mouseup", this.eventMouseUp);
+    Event.stopObserving(document, "mousemove", this.eventMouseMove);
+    Event.stopObserving(document, "keypress", this.eventKeypress);
+  },
+  currentLeft: function() {
+    return parseInt(this.element.style.left || '0');
+  },
+  currentTop: function() {
+    return parseInt(this.element.style.top || '0')
+  },
+  startDrag: function(event) {
+    if(Event.isLeftClick(event)) {
+      this.active = true;
+      
+      var style = this.element.style;
+      this.originalY = this.element.offsetTop  - this.currentTop()  - this.originalTop;
+      this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft;
+      this.offsetY =  event.clientY - this.originalY - this.originalTop;
+      this.offsetX =  event.clientX - this.originalX - this.originalLeft;
+      
+      Event.stop(event);
+    }
+  },
+  finishDrag: function(event, success) {
+    this.active = false;
+    this.dragging = false;
+    
+    if(success) Droppables.fire(event, this.element);
+    Draggables.notify('onEnd', this);
+    
+    var revert = this.options.revert;
+    if(revert && typeof revert == 'function') revert = revert(this.element);
+      
+    if(revert && this.options.reverteffect) {
+      this.options.reverteffect(this.element, 
+      this.currentTop()-this.originalTop,
+      this.currentLeft()-this.originalLeft);
+    } else {
+      this.originalLeft = this.currentLeft();
+      this.originalTop  = this.currentTop();
+    }
+    
+    this.element.style.zIndex = this.originalZ;
+      
+    if(this.options.endeffect) 
+      this.options.endeffect(this.element);
+      
+    Droppables.reset();
+  },
+  keyPress: function(event) {
+    if(this.active) {
+      if(event.keyCode==Event.KEY_ESC) {
+        this.finishDrag(event, false);
+        Event.stop(event);
+      }
+    }
+  },
+  endDrag: function(event) {
+    if(this.active && this.dragging) {
+      this.finishDrag(event, true);
+      Event.stop(event);
+    }
+    this.active = false;
+    this.dragging = false;
+  },
+  draw: function(event) {
+    var style = this.element.style;
+    this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft;
+    this.originalY = this.element.offsetTop  - this.currentTop()  - this.originalTop;
+    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
+      style.left = ((event.clientX - this.originalX) - this.offsetX) + "px";
+    if((!this.options.constraint) || (this.options.constraint=='vertical'))
+      style.top  = ((event.clientY - this.originalY) - this.offsetY) + "px";
+    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
+  },
+  update: function(event) {
+   if(this.active) {
+      if(!this.dragging) {
+        var style = this.element.style;
+        this.dragging = true;
+        if(style.position=="") style.position = "relative";
+        style.zIndex = this.options.zindex;
+        Draggables.notify('onStart', this);
+        if(this.options.starteffect) this.options.starteffect(this.element);
+      }
+      
+      Droppables.show(event, this.element);
+      this.draw(event);
+      if(this.options.change) this.options.change(this);
+      
+      // fix AppleWebKit rendering
+      if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); 
+      
+      Event.stop(event);
+   }
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SortableObserver = Class.create();
+SortableObserver.prototype = {
+  initialize: function(element, observer) {
+    this.element   = $(element);
+    this.observer  = observer;
+    this.lastValue = Sortable.serialize(this.element);
+  },
+  onStart: function() {
+    this.lastValue = Sortable.serialize(this.element);
+  },
+  onEnd: function() {    
+    if(this.lastValue != Sortable.serialize(this.element))
+      this.observer(this.element)
+  }
+}
+
+Sortable = {
+  sortables: new Array(),
+  options: function(element){
+    var element = $(element);
+    for(var i=0;i<this.sortables.length;i++)
+      if(this.sortables[i].element == element)
+        return this.sortables[i];
+    return null;        
+  },
+  destroy: function(element){
+    var element = $(element);
+    for(var i=0;i<this.sortables.length;i++) {
+      if(this.sortables[i].element == element) {
+        var s = this.sortables[i];
+        Draggables.removeObserver(s.element);
+        for(var j=0;j<s.droppables.length;j++)
+          Droppables.remove(s.droppables[j]);
+        for(var j=0;j<s.draggables.length;j++)
+          s.draggables[j].destroy();
+        this.sortables.splice(i,1);
+      }
+    }
+  },
+  create: function(element) {
+    var element = $(element);
+    var options = Object.extend({ 
+      element:     element,
+      tag:         'li',       // assumes li children, override with tag: 'tagname'
+      overlap:     'vertical', // one of 'vertical', 'horizontal'
+      constraint:  'vertical', // one of 'vertical', 'horizontal', false
+      containment: element,    // also takes array of elements (or id's); or false
+      handle:      false,      // or a CSS class
+      only:        false,
+      hoverclass:  null,
+      onChange:    function() {},
+      onUpdate:    function() {}
+    }, arguments[1] || {});
+    
+    // clear any old sortable with same element
+    this.destroy(element);
+    
+    // build options for the draggables
+    var options_for_draggable = {
+      revert:      true,
+      constraint:  options.constraint,
+      handle:      handle };
+    if(options.starteffect)
+      options_for_draggable.starteffect = options.starteffect;
+    if(options.reverteffect)
+      options_for_draggable.reverteffect = options.reverteffect;
+    if(options.endeffect)
+      options_for_draggable.endeffect = options.endeffect;
+    if(options.zindex)
+      options_for_draggable.zindex = options.zindex;
+    
+    // build options for the droppables  
+    var options_for_droppable = {
+      overlap:     options.overlap,
+      containment: options.containment,
+      hoverclass:  options.hoverclass,
+      onHover: function(element, dropon, overlap) { 
+        if(overlap>0.5) {
+          if(dropon.previousSibling != element) {
+            var oldParentNode = element.parentNode;
+            element.style.visibility = "hidden"; // fix gecko rendering
+            dropon.parentNode.insertBefore(element, dropon);
+            if(dropon.parentNode!=oldParentNode && oldParentNode.sortable) 
+              oldParentNode.sortable.onChange(element);
+            if(dropon.parentNode.sortable)
+              dropon.parentNode.sortable.onChange(element);
+          }
+        } else {                
+          var nextElement = dropon.nextSibling || null;
+          if(nextElement != element) {
+            var oldParentNode = element.parentNode;
+            element.style.visibility = "hidden"; // fix gecko rendering
+            dropon.parentNode.insertBefore(element, nextElement);
+            if(dropon.parentNode!=oldParentNode && oldParentNode.sortable) 
+              oldParentNode.sortable.onChange(element);
+            if(dropon.parentNode.sortable)
+              dropon.parentNode.sortable.onChange(element);
+          }
+        }
+      }
+    }
+
+    // fix for gecko engine
+    Element.cleanWhitespace(element); 
+    
+    options.draggables = [];
+    options.droppables = [];
+    
+    // make it so 
+    var elements = element.childNodes;
+    for (var i = 0; i < elements.length; i++) 
+      if(elements[i].tagName && elements[i].tagName==options.tag.toUpperCase() &&
+        (!options.only || (Element.Class.has(elements[i], options.only)))) {
+        
+        // handles are per-draggable
+        var handle = options.handle ? 
+          Element.Class.childrenWith(elements[i], options.handle)[0] : elements[i];
+        
+        options.draggables.push(new Draggable(elements[i], Object.extend(options_for_draggable, { handle: handle })));
+        
+        Droppables.add(elements[i], options_for_droppable);
+        options.droppables.push(elements[i]);
+        
+      }
+      
+    // keep reference
+    this.sortables.push(options);
+    
+    // for onupdate
+    Draggables.addObserver(new SortableObserver(element, options.onUpdate));
+
+  },
+  serialize: function(element) {
+    var element = $(element);
+    var sortableOptions = this.options(element);
+    var options = Object.extend({
+      tag:  sortableOptions.tag,
+      only: sortableOptions.only,
+      name: element.id
+    }, arguments[1] || {});
+    
+    var items = $(element).childNodes;
+    var queryComponents = new Array();
+ 
+    for(var i=0; i<items.length; i++)
+      if(items[i].tagName && items[i].tagName==options.tag.toUpperCase() &&
+        (!options.only || (Element.Class.has(items[i], options.only))))
+        queryComponents.push(
+          encodeURIComponent(options.name) + "[]=" + 
+          encodeURIComponent(items[i].id.split("_")[1]));
+
+    return queryComponents.join("&");
+  }
+} 
Index: /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/controls.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/controls.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/controls.js	(revision 1328)
@@ -0,0 +1,434 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//           (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
+  var children = $(element).childNodes;
+  var text     = "";
+  var classtest = new RegExp("^([^ ]+ )*" + ignoreclass+ "( [^ ]+)*$","i");
+  
+  for (var i = 0; i < children.length; i++) {
+    if(children[i].nodeType==3) {
+      text+=children[i].nodeValue;
+    } else {
+      if((!children[i].className.match(classtest)) && children[i].hasChildNodes())
+        text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass);
+    }
+  }
+  
+  return text;
+}
+
+// Autocompleter.Base handles all the autocompletion functionality 
+// that's independent of the data source for autocompletion. This
+// includes drawing the autocompletion menu, observing keyboard
+// and mouse events, and similar.
+//
+// Specific autocompleters need to provide, at the very least, 
+// a getUpdatedChoices function that will be invoked every time
+// the text inside the monitored textbox changes. This method 
+// should get the text for which to provide autocompletion by
+// invoking this.getEntry(), NOT by directly accessing
+// this.element.value. This is to allow incremental tokenized
+// autocompletion. Specific auto-completion logic (AJAX, etc)
+// belongs in getUpdatedChoices.
+//
+// Tokenized incremental autocompletion is enabled automatically
+// when an autocompleter is instantiated with the 'tokens' option
+// in the options parameter, e.g.:
+// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+// will incrementally autocomplete with a comma as the token.
+// Additionally, ',' in the above example can be replaced with
+// a token array, e.g. { tokens: new Array (',', '\n') } which
+// enables autocompletion on multiple tokens. This is most 
+// useful when one of the tokens is \n (a newline), as it 
+// allows smart autocompletion after linebreaks.
+
+var Autocompleter = {}
+Autocompleter.Base = function() {};
+Autocompleter.Base.prototype = {
+  base_initialize: function(element, update, options) {
+    this.element     = $(element); 
+    this.update      = $(update);  
+    this.has_focus   = false; 
+    this.changed     = false; 
+    this.active      = false; 
+    this.index       = 0;     
+    this.entry_count = 0;
+
+    if (this.setOptions)
+      this.setOptions(options);
+    else
+      this.options = {}
+     
+    this.options.tokens       = this.options.tokens || new Array();
+    this.options.frequency    = this.options.frequency || 0.4;
+    this.options.min_chars    = this.options.min_chars || 1;
+    this.options.onShow       = this.options.onShow || 
+    function(element, update){ 
+      if(!update.style.position || update.style.position=='absolute') {
+        update.style.position = 'absolute';
+          var offsets = Position.cumulativeOffset(element);
+          update.style.left = offsets[0] + 'px';
+          update.style.top  = (offsets[1] + element.offsetHeight) + 'px';
+          update.style.width = element.offsetWidth + 'px';
+      }
+      new Effect.Appear(update,{duration:0.15});
+    };
+    this.options.onHide = this.options.onHide || 
+    function(element, update){ new Effect.Fade(update,{duration:0.15}) };
+    
+    if(this.options.indicator)
+      this.indicator = $(this.options.indicator);
+
+    if (typeof(this.options.tokens) == 'string') 
+      this.options.tokens = new Array(this.options.tokens);
+       
+    this.observer = null;
+    
+    Element.hide(this.update);
+    
+    Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
+    Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
+  },
+
+  show: function() {
+    if(this.update.style.display=='none') this.options.onShow(this.element, this.update);
+    if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && this.update.style.position=='absolute') {
+      new Insertion.After(this.update, 
+       '<iframe id="' + this.update.id + '_iefix" '+
+       'style="display:none;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
+       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
+      this.iefix = $(this.update.id+'_iefix');
+    }
+    if(this.iefix) {
+      Position.clone(this.update, this.iefix);
+      this.iefix.style.zIndex = 1;
+      this.update.style.zIndex = 2;
+      Element.show(this.iefix);
+    }
+  },
+  
+  hide: function() {
+    if(this.update.style.display=='') this.options.onHide(this.element, this.update);
+    if(this.iefix) Element.hide(this.iefix);
+  },
+  
+  startIndicator: function() {
+    if(this.indicator) Element.show(this.indicator);
+  },
+  
+  stopIndicator: function() {
+    if(this.indicator) Element.hide(this.indicator);
+  },
+
+  onKeyPress: function(event) {
+    if(this.active)
+      switch(event.keyCode) {
+       case Event.KEY_TAB:
+       case Event.KEY_RETURN:
+         this.select_entry();
+         Event.stop(event);
+       case Event.KEY_ESC:
+         this.hide();
+         this.active = false;
+         return;
+       case Event.KEY_LEFT:
+       case Event.KEY_RIGHT:
+         return;
+       case Event.KEY_UP:
+         this.mark_previous();
+         this.render();
+         if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
+         return;
+       case Event.KEY_DOWN:
+         this.mark_next();
+         this.render();
+         if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
+         return;
+      }
+     else 
+      if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN) 
+        return;
+    
+    this.changed = true;
+    this.has_focus = true;
+    
+    if(this.observer) clearTimeout(this.observer);
+      this.observer = 
+        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
+  },
+  
+  onHover: function(event) {
+    var element = Event.findElement(event, 'LI');
+    if(this.index != element.autocompleteIndex) 
+    {
+        this.index = element.autocompleteIndex;
+        this.render();
+    }
+    Event.stop(event);
+  },
+  
+  onClick: function(event) {
+    var element = Event.findElement(event, 'LI');
+    this.index = element.autocompleteIndex;
+    this.select_entry();
+    Event.stop(event);
+  },
+  
+  onBlur: function(event) {
+    // needed to make click events working
+    setTimeout(this.hide.bind(this), 250);
+    this.has_focus = false;
+    this.active = false;     
+  }, 
+  
+  render: function() {
+    if(this.entry_count > 0) {
+      for (var i = 0; i < this.entry_count; i++)
+        this.index==i ? 
+          Element.addClassName(this.get_entry(i),"selected") : 
+          Element.removeClassName(this.get_entry(i),"selected");
+        
+      if(this.has_focus) { 
+        if(this.get_current_entry().scrollIntoView) 
+          this.get_current_entry().scrollIntoView(false);
+        
+        this.show();
+        this.active = true;
+      }
+    } else this.hide();
+  },
+  
+  mark_previous: function() {
+    if(this.index > 0) this.index--
+      else this.index = this.entry_count-1;
+  },
+  
+  mark_next: function() {
+    if(this.index < this.entry_count-1) this.index++
+      else this.index = 0;
+  },
+  
+  get_entry: function(index) {
+    return this.update.firstChild.childNodes[index];
+  },
+  
+  get_current_entry: function() {
+    return this.get_entry(this.index);
+  },
+  
+  select_entry: function() {
+    this.active = false;
+    value = Element.collectTextNodesIgnoreClass(this.get_current_entry(), 'informal').unescapeHTML();
+    this.updateElement(value);
+    this.element.focus();
+  },
+
+  updateElement: function(value) {
+    var last_token_pos = this.findLastToken();
+    if (last_token_pos != -1) {
+      var new_value = this.element.value.substr(0, last_token_pos + 1);
+      var whitespace = this.element.value.substr(last_token_pos + 1).match(/^\s+/);
+      if (whitespace)
+        new_value += whitespace[0];
+      this.element.value = new_value + value;
+    } else {
+      this.element.value = value;
+    } 
+  },
+  
+  updateChoices: function(choices) {
+    if(!this.changed && this.has_focus) {
+      this.update.innerHTML = choices;
+      Element.cleanWhitespace(this.update);
+      Element.cleanWhitespace(this.update.firstChild);
+
+      if(this.update.firstChild && this.update.firstChild.childNodes) {
+        this.entry_count = 
+          this.update.firstChild.childNodes.length;
+        for (var i = 0; i < this.entry_count; i++) {
+          entry = this.get_entry(i);
+          entry.autocompleteIndex = i;
+          this.addObservers(entry);
+        }
+      } else { 
+        this.entry_count = 0;
+      }
+      
+      this.stopIndicator();
+      
+      this.index = 0;
+      this.render();
+    }
+  },
+
+  addObservers: function(element) {
+    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+  },
+
+  onObserverEvent: function() {
+    this.changed = false;   
+    if(this.getEntry().length>=this.options.min_chars) {
+      this.startIndicator();
+      this.getUpdatedChoices();
+    } else {
+      this.active = false;
+      this.hide();
+    }
+  },
+
+  getEntry: function() {
+    var token_pos = this.findLastToken();
+    if (token_pos != -1)
+      var ret = this.element.value.substr(token_pos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
+    else
+      var ret = this.element.value;
+    
+    return /\n/.test(ret) ? '' : ret;
+  },
+
+  findLastToken: function() {
+    var last_token_pos = -1;
+
+    for (var i=0; i<this.options.tokens.length; i++) {
+      var this_token_pos = this.element.value.lastIndexOf(this.options.tokens[i]);
+      if (this_token_pos > last_token_pos)
+        last_token_pos = this_token_pos;
+    }
+    return last_token_pos;
+  }
+}
+
+Ajax.Autocompleter = Class.create();
+Ajax.Autocompleter.prototype = Object.extend(new Autocompleter.Base(), 
+Object.extend(new Ajax.Base(), {
+  initialize: function(element, update, url, options) {
+	  this.base_initialize(element, update, options);
+    this.options.asynchronous = true;
+    this.options.onComplete   = this.onComplete.bind(this)
+    this.options.method       = 'post';
+    this.url                  = url;
+  },
+  
+  getUpdatedChoices: function() {
+    entry = encodeURIComponent(this.element.name) + '=' + 
+      encodeURIComponent(this.getEntry());
+    
+    this.options.parameters = this.options.callback ?
+      this.options.callback(this.element, entry) : entry;
+    new Ajax.Request(this.url, this.options);
+  },
+  
+  onComplete: function(request) {
+    this.updateChoices(request.responseText);
+  }
+
+}));
+
+// The local array autocompleter. Used when you'd prefer to
+// inject an array of autocompletion options into the page, rather
+// than sending out Ajax queries, which can be quite slow sometimes.
+//
+// The constructor takes four parameters. The first two are, as usual,
+// the id of the monitored textbox, and id of the autocompletion menu.
+// The third is the array you want to autocomplete from, and the fourth
+// is the options block.
+//
+// Extra local autocompletion options:
+// - choices - How many autocompletion choices to offer
+//
+// - partial_search - If false, the autocompleter will match entered
+//                    text only at the beginning of strings in the 
+//                    autocomplete array. Defaults to true, which will
+//                    match text at the beginning of any *word* in the
+//                    strings in the autocomplete array. If you want to
+//                    search anywhere in the string, additionally set
+//                    the option full_search to true (default: off).
+//
+// - full_search - Search anywhere in autocomplete array strings.
+//
+// - partial_chars - How many characters to enter before triggering
+//                   a partial match (unlike min_chars, which defines
+//                   how many characters are required to do any match
+//                   at all). Defaults to 2.
+//
+// - ignore_case - Whether to ignore case when autocompleting.
+//                 Defaults to true.
+//
+// It's possible to pass in a custom function as the 'selector' 
+// option, if you prefer to write your own autocompletion logic.
+// In that case, the other options above will not apply unless
+// you support them.
+
+Autocompleter.Local = Class.create();
+Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
+  initialize: function(element, update, array, options) {
+    this.base_initialize(element, update, options);
+    this.options.array = array;
+  },
+
+  getUpdatedChoices: function() {
+    this.updateChoices(this.options.selector(this));
+  },
+
+  setOptions: function(options) {
+    this.options = Object.extend({
+      choices: 10,
+      partial_search: true,
+      partial_chars: 2,
+      ignore_case: true,
+      full_search: false,
+      selector: function(instance) {
+        var ret       = new Array(); // Beginning matches
+        var partial   = new Array(); // Inside matches
+        var entry     = instance.getEntry();
+        var count     = 0;
+        
+        for (var i = 0; i < instance.options.array.length &&  
+            ret.length < instance.options.choices ; i++) { 
+          var elem = instance.options.array[i];
+          var found_pos = instance.options.ignore_case ? 
+            elem.toLowerCase().indexOf(entry.toLowerCase()) : 
+            elem.indexOf(entry);
+
+          if (found_pos == 0 && elem.length == entry.length) 
+            continue;
+          else if (found_pos == 0) 
+            ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 
+              elem.substr(entry.length) + "</li>");
+          else if (entry.length >= instance.options.partial_chars && 
+            instance.options.partial_search && found_pos != -1) {
+            if (!instance.options.full_search && !/\s/.test(elem.substr(found_pos-1,1)))
+              continue;
+            partial.push("<li>" + elem.substr(0, found_pos) + "<strong>" +
+              elem.substr(found_pos, entry.length) + "</strong>" + elem.substr(
+              found_pos + entry.length) + "</li>")
+          }
+        }
+        if (partial.length)
+          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+        return "<ul>" + ret.join('') + "</ul>";
+      }
+    }, options || {});
+  }
+});
Index: /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/prototype.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/prototype.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/dragdrop.files/prototype.js	(revision 1328)
@@ -0,0 +1,1044 @@
+/*  Prototype JavaScript framework, version 1.3.0
+ *  (c) 2005 Sam Stephenson <sam@conio.net>
+ *
+ *  THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
+ *  against the source tree, available from the Prototype darcs repository. 
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *
+ *  For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
+
+var Prototype = {
+  Version: '1.3.0',
+  emptyFunction: function() {}
+}
+
+var Class = {
+  create: function() {
+    return function() { 
+      this.initialize.apply(this, arguments);
+    }
+  }
+}
+
+var Abstract = new Object();
+
+Object.extend = function(destination, source) {
+  for (property in source) {
+    destination[property] = source[property];
+  }
+  return destination;
+}
+/*
+Object.prototype.extend = function(object) {
+  return Object.extend.apply(this, [this, object]);
+}
+*/
+Function.prototype.bind = function(object) {
+  var __method = this;
+  return function() {
+    __method.apply(object, arguments);
+  }
+}
+
+Function.prototype.bindAsEventListener = function(object) {
+  var __method = this;
+  return function(event) {
+    __method.call(object, event || window.event);
+  }
+}
+
+Number.prototype.toColorPart = function() {
+  var digits = this.toString(16);
+  if (this < 16) return '0' + digits;
+  return digits;
+}
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0; i < arguments.length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) {}
+    }
+
+    return returnValue;
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try { 
+        this.currentlyExecuting = true;
+        this.callback(); 
+      } finally { 
+        this.currentlyExecuting = false;
+      }
+    }
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+function $() {
+  var elements = new Array();
+
+  for (var i = 0; i < arguments.length; i++) {
+    var element = arguments[i];
+    if (typeof element == 'string')
+      element = document.getElementById(element);
+
+    if (arguments.length == 1) 
+      return element;
+
+    elements.push(element);
+  }
+
+  return elements;
+}
+
+if (!Array.prototype.push) {
+  Array.prototype.push = function() {
+		var startLength = this.length;
+		for (var i = 0; i < arguments.length; i++)
+      this[startLength + i] = arguments[i];
+	  return this.length;
+  }
+}
+
+if (!Function.prototype.apply) {
+  // Based on code from http://www.youngpup.net/
+  Function.prototype.apply = function(object, parameters) {
+    var parameterStrings = new Array();
+    if (!object)     object = window;
+    if (!parameters) parameters = new Array();
+    
+    for (var i = 0; i < parameters.length; i++)
+      parameterStrings[i] = 'parameters[' + i + ']';
+    
+    object.__apply__ = this;
+    var result = eval('object.__apply__(' + 
+      parameterStrings[i].join(', ') + ')');
+    object.__apply__ = null;
+    
+    return result;
+  }
+}
+
+Object.extend(String.prototype, {
+  stripTags: function() {
+    return this.replace(/<\/?[^>]+>/gi, '');
+  },
+
+  escapeHTML: function() {
+    var div = document.createElement('div');
+    var text = document.createTextNode(this);
+    div.appendChild(text);
+    return div.innerHTML;
+  },
+
+  unescapeHTML: function() {
+    var div = document.createElement('div');
+    div.innerHTML = this.stripTags();
+    return div.childNodes[0].nodeValue;
+  }
+});
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
+      function() {return new XMLHttpRequest()}
+    ) || false;
+  }
+}
+
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+  setOptions: function(options) {
+    this.options = Object.extend({
+      method:       'post',
+      asynchronous: true,
+      parameters:   ''
+    }, options || {});
+  },
+
+  responseIsSuccess: function() {
+    return this.transport.status == undefined
+        || this.transport.status == 0 
+        || (this.transport.status >= 200 && this.transport.status < 300);
+  },
+
+  responseIsFailure: function() {
+    return !this.responseIsSuccess();
+  }
+}
+
+Ajax.Request = Class.create();
+Ajax.Request.Events = 
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(url, options) {
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+    this.request(url);
+  },
+
+  request: function(url) {
+    var parameters = this.options.parameters || '';
+    if (parameters.length > 0) parameters += '&_=';
+
+    try {
+      if (this.options.method == 'get')
+        url += '?' + parameters;
+
+      this.transport.open(this.options.method, url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) {
+        this.transport.onreadystatechange = this.onStateChange.bind(this);
+        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
+      }
+
+      this.setRequestHeaders();
+
+      var body = this.options.postBody ? this.options.postBody : parameters;
+      this.transport.send(this.options.method == 'post' ? body : null);
+
+    } catch (e) {
+    }
+  },
+
+  setRequestHeaders: function() {
+    var requestHeaders = 
+      ['X-Requested-With', 'XMLHttpRequest',
+       'X-Prototype-Version', Prototype.Version];
+
+    if (this.options.method == 'post') {
+      requestHeaders.push('Content-type', 
+        'application/x-www-form-urlencoded');
+
+      /* Force "Connection: close" for Mozilla browsers to work around
+       * a bug where XMLHttpReqeuest sends an incorrect Content-length
+       * header. See Mozilla Bugzilla #246651. 
+       */
+      if (this.transport.overrideMimeType)
+        requestHeaders.push('Connection', 'close');
+    }
+
+    if (this.options.requestHeaders)
+      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
+
+    for (var i = 0; i < requestHeaders.length; i += 2)
+      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState != 1)
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  respondToReadyState: function(readyState) {
+    var event = Ajax.Request.Events[readyState];
+
+    if (event == 'Complete')
+      (this.options['on' + this.transport.status]
+       || this.options['on' + this.responseIsSuccess ? 'Success' : 'Failure']
+       || Prototype.emptyFunction)(this.transport);       
+
+    (this.options['on' + event] || Prototype.emptyFunction)(this.transport);    
+  }
+});
+
+Ajax.Updater = Class.create();
+Ajax.Updater.ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:<\/script>)';
+
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
+  initialize: function(container, url, options) {
+    this.containers = {
+      success: container.success ? $(container.success) : $(container),
+      failure: container.failure ? $(container.failure) :
+        (container.success ? null : $(container))
+    }
+
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+
+    var onComplete = this.options.onComplete || Prototype.emptyFunction;
+    this.options.onComplete = (function() {
+      this.updateContent();
+      onComplete(this.transport);      
+    }).bind(this);
+
+    this.request(url);
+  },
+
+  updateContent: function() {
+    var receiver = this.responseIsSuccess() ?
+      this.containers.success : this.containers.failure;
+
+    var match    = new RegExp(Ajax.Updater.ScriptFragment, 'img');
+    var response = this.transport.responseText.replace(match, '');
+    var scripts  = this.transport.responseText.match(match);
+
+    if (receiver) {
+      if (this.options.insertion) {
+        new this.options.insertion(receiver, response);
+      } else {
+        receiver.innerHTML = response;
+      }
+    }
+
+    if (this.responseIsSuccess()) {
+      if (this.onComplete)
+        setTimeout((function() {this.onComplete(
+          this.transport)}).bind(this), 10);
+    }
+
+    if (this.options.evalScripts && scripts) {
+      match = new RegExp(Ajax.Updater.ScriptFragment, 'im');
+      setTimeout((function() {
+        for (var i = 0; i < scripts.length; i++)
+          eval(scripts[i].match(match)[1]);
+      }).bind(this), 10);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create();
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(container, url, options) {
+    this.setOptions(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = 1;
+
+    this.updater = {};
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Ajax.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(request) {
+    if (this.options.decay) {
+      this.decay = (request.responseText == this.lastText ? 
+        this.decay * this.options.decay : 1);
+
+      this.lastText = request.responseText;
+    }
+    this.timer = setTimeout(this.onTimerEvent.bind(this), 
+      this.decay * this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+
+document.getElementsByClassName = function(className) {
+  var children = document.getElementsByTagName('*') || document.all;
+  var elements = new Array();
+  
+  for (var i = 0; i < children.length; i++) {
+    var child = children[i];
+    var classNames = child.className.split(' ');
+    for (var j = 0; j < classNames.length; j++) {
+      if (classNames[j] == className) {
+        elements.push(child);
+        break;
+      }
+    }
+  }
+  
+  return elements;
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Element) {
+  var Element = new Object();
+}
+
+Object.extend(Element, {
+  toggle: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = 
+        (element.style.display == 'none' ? '' : 'none');
+    }
+  },
+
+  hide: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = 'none';
+    }
+  },
+
+  show: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = '';
+    }
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+  },
+   
+  getHeight: function(element) {
+    element = $(element);
+    return element.offsetHeight; 
+  },
+
+  hasClassName: function(element, className) {
+    element = $(element);
+    if (!element)
+      return;
+    var a = element.className.split(' ');
+    for (var i = 0; i < a.length; i++) {
+      if (a[i] == className)
+        return true;
+    }
+    return false;
+  },
+
+  addClassName: function(element, className) {
+    element = $(element);
+    Element.removeClassName(element, className);
+    element.className += ' ' + className;
+  },
+
+  removeClassName: function(element, className) {
+    element = $(element);
+    if (!element)
+      return;
+    var newClassName = '';
+    var a = element.className.split(' ');
+    for (var i = 0; i < a.length; i++) {
+      if (a[i] != className) {
+        if (i > 0)
+          newClassName += ' ';
+        newClassName += a[i];
+      }
+    }
+    element.className = newClassName;
+  },
+  
+  // removes whitespace-only text node children
+  cleanWhitespace: function(element) {
+    var element = $(element);
+    for (var i = 0; i < element.childNodes.length; i++) {
+      var node = element.childNodes[i];
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
+        Element.remove(node);
+    }
+  }
+});
+
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.Insertion = function(adjacency) {
+  this.adjacency = adjacency;
+}
+
+Abstract.Insertion.prototype = {
+  initialize: function(element, content) {
+    this.element = $(element);
+    this.content = content;
+    
+    if (this.adjacency && this.element.insertAdjacentHTML) {
+      this.element.insertAdjacentHTML(this.adjacency, this.content);
+    } else {
+      this.range = this.element.ownerDocument.createRange();
+      if (this.initializeRange) this.initializeRange();
+      this.fragment = this.range.createContextualFragment(this.content);
+      this.insertContent();
+    }
+  }
+}
+
+var Insertion = new Object();
+
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+  initializeRange: function() {
+    this.range.setStartBefore(this.element);
+  },
+  
+  insertContent: function() {
+    this.element.parentNode.insertBefore(this.fragment, this.element);
+  }
+});
+
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(true);
+  },
+  
+  insertContent: function() {  
+    this.element.insertBefore(this.fragment, this.element.firstChild);
+  }
+});
+
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(this.element);
+  },
+  
+  insertContent: function() {
+    this.element.appendChild(this.fragment);
+  }
+});
+
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+  initializeRange: function() {
+    this.range.setStartAfter(this.element);
+  },
+  
+  insertContent: function() {
+    this.element.parentNode.insertBefore(this.fragment, 
+      this.element.nextSibling);
+  }
+});
+
+var Field = {
+  clear: function() {
+    for (var i = 0; i < arguments.length; i++)
+      $(arguments[i]).value = '';
+  },
+
+  focus: function(element) {
+    $(element).focus();
+  },
+  
+  present: function() {
+    for (var i = 0; i < arguments.length; i++)
+      if ($(arguments[i]).value == '') return false;
+    return true;
+  },
+  
+  select: function(element) {
+    $(element).select();
+  },
+   
+  activate: function(element) {
+    $(element).focus();
+    $(element).select();
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Form = {
+  serialize: function(form) {
+    var elements = Form.getElements($(form));
+    var queryComponents = new Array();
+    
+    for (var i = 0; i < elements.length; i++) {
+      var queryComponent = Form.Element.serialize(elements[i]);
+      if (queryComponent)
+        queryComponents.push(queryComponent);
+    }
+    
+    return queryComponents.join('&');
+  },
+  
+  getElements: function(form) {
+    var form = $(form);
+    var elements = new Array();
+
+    for (tagName in Form.Element.Serializers) {
+      var tagElements = form.getElementsByTagName(tagName);
+      for (var j = 0; j < tagElements.length; j++)
+        elements.push(tagElements[j]);
+    }
+    return elements;
+  },
+  
+  getInputs: function(form, typeName, name) {
+    var form = $(form);
+    var inputs = form.getElementsByTagName('input');
+    
+    if (!typeName && !name)
+      return inputs;
+      
+    var matchingInputs = new Array();
+    for (var i = 0; i < inputs.length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) ||
+          (name && input.name != name)) 
+        continue;
+      matchingInputs.push(input);
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      element.blur();
+      element.disabled = 'true';
+    }
+  },
+
+  enable: function(form) {
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      element.disabled = '';
+    }
+  },
+
+  focusFirstElement: function(form) {
+    var form = $(form);
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      if (element.type != 'hidden' && !element.disabled) {
+        Field.activate(element);
+        break;
+      }
+    }
+  },
+
+  reset: function(form) {
+    $(form).reset();
+  }
+}
+
+Form.Element = {
+  serialize: function(element) {
+    var element = $(element);
+    var method = element.tagName.toLowerCase();
+    var parameter = Form.Element.Serializers[method](element);
+    
+    if (parameter)
+      return encodeURIComponent(parameter[0]) + '=' + 
+        encodeURIComponent(parameter[1]);                   
+  },
+  
+  getValue: function(element) {
+    var element = $(element);
+    var method = element.tagName.toLowerCase();
+    var parameter = Form.Element.Serializers[method](element);
+    
+    if (parameter) 
+      return parameter[1];
+  }
+}
+
+Form.Element.Serializers = {
+  input: function(element) {
+    switch (element.type.toLowerCase()) {
+      case 'submit':
+      case 'hidden':
+      case 'password':
+      case 'text':
+        return Form.Element.Serializers.textarea(element);
+      case 'checkbox':  
+      case 'radio':
+        return Form.Element.Serializers.inputSelector(element);
+    }
+    return false;
+  },
+
+  inputSelector: function(element) {
+    if (element.checked)
+      return [element.name, element.value];
+  },
+
+  textarea: function(element) {
+    return [element.name, element.value];
+  },
+
+  select: function(element) {
+    var value = '';
+    if (element.type == 'select-one') {
+      var index = element.selectedIndex;
+      if (index >= 0)
+        value = element.options[index].value || element.options[index].text;
+    } else {
+      value = new Array();
+      for (var i = 0; i < element.length; i++) {
+        var opt = element.options[i];
+        if (opt.selected)
+          value.push(opt.value || opt.text);
+      }
+    }
+    return [element.name, value];
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var $F = Form.Element.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+  initialize: function(element, frequency, callback) {
+    this.frequency = frequency;
+    this.element   = $(element);
+    this.callback  = callback;
+    
+    this.lastValue = this.getValue();
+    this.registerCallback();
+  },
+  
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+  
+  onTimerEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+}
+
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+    
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+  
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+  
+  registerFormCallbacks: function() {
+    var elements = Form.getElements(this.element);
+    for (var i = 0; i < elements.length; i++)
+      this.registerCallback(elements[i]);
+  },
+  
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':  
+        case 'radio':
+          element.target = this;
+          element.prev_onclick = element.onclick || Prototype.emptyFunction;
+          element.onclick = function() {
+            this.prev_onclick(); 
+            this.target.onElementEvent();
+          }
+          break;
+        case 'password':
+        case 'text':
+        case 'textarea':
+        case 'select-one':
+        case 'select-multiple':
+          element.target = this;
+          element.prev_onchange = element.onchange || Prototype.emptyFunction;
+          element.onchange = function() {
+            this.prev_onchange(); 
+            this.target.onElementEvent();
+          }
+          break;
+      }
+    }    
+  }
+}
+
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+
+if (!window.Event) {
+  var Event = new Object();
+}
+
+Object.extend(Event, {
+  KEY_BACKSPACE: 8,
+  KEY_TAB:       9,
+  KEY_RETURN:   13,
+  KEY_ESC:      27,
+  KEY_LEFT:     37,
+  KEY_UP:       38,
+  KEY_RIGHT:    39,
+  KEY_DOWN:     40,
+  KEY_DELETE:   46,
+
+  element: function(event) {
+    return event.target || event.srcElement;
+  },
+
+  isLeftClick: function(event) {
+    return (((event.which) && (event.which == 1)) ||
+            ((event.button) && (event.button == 1)));
+  },
+
+  pointerX: function(event) {
+    return event.pageX || (event.clientX + 
+      (document.documentElement.scrollLeft || document.body.scrollLeft));
+  },
+
+  pointerY: function(event) {
+    return event.pageY || (event.clientY + 
+      (document.documentElement.scrollTop || document.body.scrollTop));
+  },
+
+  stop: function(event) {
+    if (event.preventDefault) { 
+      event.preventDefault(); 
+      event.stopPropagation(); 
+    } else {
+      event.returnValue = false;
+    }
+  },
+
+  // find the first node with the given tagName, starting from the
+  // node the event was triggered on; traverses the DOM upwards
+  findElement: function(event, tagName) {
+    var element = Event.element(event);
+    while (element.parentNode && (!element.tagName ||
+        (element.tagName.toUpperCase() != tagName.toUpperCase())))
+      element = element.parentNode;
+    return element;
+  },
+  
+  observers: false,
+  
+  _observeAndCache: function(element, name, observer, useCapture) {
+    if(!this.observers) this.observers = [];
+    if(element.addEventListener) {
+      this.observers.push([element,name,observer,useCapture]);
+      element.addEventListener(name, observer, useCapture);
+    } else if (element.attachEvent) {
+      this.observers.push([element,name,observer,useCapture]);
+      element.attachEvent('on'+name, observer);
+    }
+  },
+  
+  unloadCache: function() {
+    if(!Event.observers) return;
+    for(var i=0; i<Event.observers.length; i++) {
+      Event.stopObserving(Event.observers[i][0],Event.observers[i][1],Event.observers[i][2],Event.observers[i][3]);
+      Event.observers[i][0] = null;
+    }
+    Event.observers = false;
+  },
+
+  observe: function(element, name, observer, useCapture) {
+    var element = $(element);
+    useCapture = useCapture || false;
+    
+    if (name == 'keypress') {
+      if (navigator.appVersion.indexOf('AppleWebKit') > 0) {
+        this._observeAndCache(element, 'keydown', observer, useCapture);
+        return;
+      }
+      this._observeAndCache(element, 'keypress', observer, useCapture);
+    } else {
+      this._observeAndCache(element, name, observer, useCapture);
+    }
+  },
+
+  stopObserving: function(element, name, observer, useCapture) {
+    var element = $(element);
+    useCapture = useCapture || false;
+    
+    if (name == 'keypress') {
+      if (navigator.appVersion.indexOf('AppleWebKit') > 0) {
+        element.removeEventListener('keydown', observer, useCapture);
+        return;
+      }
+      if (element.removeEventListener) {
+        element.removeEventListener('keypress', observer, useCapture);
+      } else if (element.detachEvent) {
+        element.detachEvent('onkeydown', observer);
+      }
+    } else {
+      if (element.removeEventListener) {
+        element.removeEventListener(name, observer, useCapture);
+      } else if (element.detachEvent) {
+        element.detachEvent('on' + name, observer);
+      }
+    }
+  }
+});
+
+// prevent memory leaks
+Event.observe(window,'unload', Event.unloadCache, false);
+
+var Position = {
+
+  // set to true if needed, warning: firefox performance problems
+  // NOT neeeded for page scrolling, only if draggable contained in
+  // scrollable elements
+  includeScrollOffsets: false, 
+
+  // must be called before calling withinIncludingScrolloffset, every time the
+  // page is scrolled
+  prepare: function() {
+    this.deltaX =  window.pageXOffset 
+                || document.documentElement.scrollLeft 
+                || document.body.scrollLeft 
+                || 0;
+    this.deltaY =  window.pageYOffset 
+                || document.documentElement.scrollTop 
+                || document.body.scrollTop 
+                || 0;
+  },
+
+  realOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0; 
+      element = element.parentNode;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  cumulativeOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  // caches x/y coordinate pair to use with overlap
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = this.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] && 
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = this.realOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = this.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] && 
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  // within must be called directly before
+  overlap: function(mode, element) {  
+    if (!mode) return 0;  
+    if (mode == 'vertical') 
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) / 
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) / 
+        element.offsetWidth;
+  },
+
+  clone: function(source, target) {
+    source = $(source);
+    target = $(target);
+    target.style.position = 'absolute';
+    var offsets = this.cumulativeOffset(source);
+    target.style.top    = offsets[1] + 'px';
+    target.style.left   = offsets[0] + 'px';
+    target.style.width  = source.offsetWidth + 'px';
+    target.style.height = source.offsetHeight + 'px';
+  }
+}
Index: /temp/trunk/html/test/nakatest/dragdrop/recv_post.php
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/recv_post.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/recv_post.php	(revision 1328)
@@ -0,0 +1,9 @@
+<?php
+	foreach($_POST as $key => $val){
+		if(ereg("^item", $key)) {
+			if($val == 'in') {
+				print($key . "¤¬¡¢¥Õ¥ì¡¼¥àÆâ¤ËÂ¸ºß¤·¤Þ¤¹¡£</br>\n");
+			}
+		}
+	}
+?>
Index: /temp/trunk/html/test/nakatest/dragdrop/cart.html
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/cart.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/cart.html	(revision 1328)
@@ -0,0 +1,228 @@
+ï»?!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
+<!-- saved from url=(0032)http://demo.script.aculo.us/shop -->
+<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>script.aculo.us - web 2.0 javascript demos</TITLE>
+<META http-equiv=content-type content="text/html; charset=utf-8"><LINK 
+media=screen href="dragdrop.files/script.aculo.us.css" type=text/css 
+rel=Stylesheet>
+<SCRIPT src="dragdrop.files/prototype.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="dragdrop.files/effects.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="dragdrop.files/dragdrop.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="dragdrop.files/controls.js" type=text/javascript></SCRIPT>
+
+<STYLE type=text/css>DIV.auto_complete {
+	BORDER-RIGHT: #888 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #888 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: #888 1px solid; WIDTH: 250px; PADDING-TOP: 0px; BORDER-BOTTOM: #888 1px solid; POSITION: absolute; BACKGROUND-COLOR: white
+}
+UL.contacts {
+	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
+}
+UL.contacts LI.selected {
+	BACKGROUND-COLOR: #ffb
+}
+LI.contact {
+	PADDING-RIGHT: 2px; DISPLAY: block; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN: 0px; PADDING-TOP: 2px; LIST-STYLE-TYPE: none; HEIGHT: 32px
+}
+LI.contact DIV.image {
+	FLOAT: left; WIDTH: 32px; MARGIN-RIGHT: 8px; HEIGHT: 32px
+}
+LI.contact DIV.name {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; LINE-HEIGHT: 1.2em
+}
+LI.contact DIV.email {
+	FONT-SIZE: 10px; COLOR: #888
+}
+#list {
+	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 10px 0px 0px; WIDTH: 250px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
+}
+#list LI {
+	BORDER-RIGHT: #888 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #888 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; MARGIN: 0px 0px 4px; BORDER-LEFT: #888 1px solid; CURSOR: move; PADDING-TOP: 5px; BORDER-BOTTOM: #888 1px solid
+}
+</STYLE>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<DIV id=header><IMG id=logo alt="script.aculo.us - web 2.0 javascript demos" 
+src="dragdrop.files/logo.gif"> </DIV>
+<UL id=menu>
+  <LI><A href="http://script.aculo.us/">Back to site</A> </LI>
+  <LI><A class=active href="http://demo.script.aculo.us/">Demos</A> </LI></UL>
+<DIV id=tagline>This site demonstrates the <B>Ruby on Rails 0.13</B> AJAX 
+helpers, <BR>which use script.aculo.us effects, drag-and-drop and 
+autocompletion. </DIV>
+<DIV id=sidebar-container>
+<DIV id=sidebar>
+<H1>rails 0.13 Demos</H1>
+<P>script.aculo.us helpers</P>
+<UL>
+  <LI><A href="http://demo.script.aculo.us/ajax/autocompleter">Autocompleting 
+  text fields (basic)</A> 
+  <LI><A 
+  href="http://demo.script.aculo.us/ajax/autocompleter_customized">Autocompleting 
+  text fields (customized)</A> 
+  <LI><A href="http://demo.script.aculo.us/shop">Shopping cart</A> 
+  <LI><A href="http://demo.script.aculo.us/ajax/sortable_elements">Sortable 
+  elements</A> </LI></UL>
+<P>New AJAX features</P>
+<UL>
+  <LI><A href="http://demo.script.aculo.us/ajax/error_handling">Error 
+  handling</A> 
+  <LI><A href="http://demo.script.aculo.us/ajax/update_element">Update element 
+  helper</A> </LI></UL></DIV>
+<DIV class=links><A href="http://www.rubyonrails.org/"><IMG alt="Ruby on Rails" 
+src="dragdrop.files/rails.jpg"></A> <EM>Rails is a full-stack, open-source web 
+framework in Ruby for writing real-world applications with joy and less code 
+than most frameworks spend doing XML sit-ups.</EM> That quite sums it up. So, if 
+you're still working late hours writing definitions of what's in your database 
+because the framework you use works against and not for you -- do yourself a 
+favour, and check out <A href="http://www.rubyonrails.org/">Ruby on Rails</A>. 
+</DIV></DIV>
+<DIV id=content>
+<H1>Silly easy shopping</H1>
+<P>Drag products to the cart to fill it:</P>
+<DIV style="MARGIN-BOTTOM: 20px; HEIGHT: 120px"><IMG class=products id=product_1 
+alt=Mug src="dragdrop.files/product1.png">
+<SCRIPT type=text/javascript>new Draggable('product_1', {revert:true})</SCRIPT>
+ <IMG class=products id=product_2 alt=T-Shirt src="dragdrop.files/product2.png">
+<SCRIPT type=text/javascript>new Draggable('product_2', {revert:true})</SCRIPT>
+ </DIV>
+<H2>Your cart:</H2>
+<DIV class=cart id=cart style="CLEAR: left; MARGIN-TOP: 10px; HEIGHT: 132px">
+<DIV id=items>Here's your shopping cart. We would very much appreciate it if you 
+fill it with stuff. </DIV>
+<DIV style="CLEAR: both"></DIV></DIV>
+<DIV id=wastebin>Drop items here to remove them from the cart. </DIV>
+<DIV style="PADDING-TOP: 10px; HEIGHT: 40px">
+<P id=indicator style="MARGIN-TOP: 0px; DISPLAY: none"><IMG alt=Indicator 
+src="dragdrop.files/indicator.gif"> Updating cart... </P></DIV>
+<SCRIPT type=text/javascript>Droppables.add('cart', {accept:'products', onDrop:function(element){new Ajax.Updater('items', '/shop/add', {onLoading:function(request){Element.show('indicator')}, onComplete:function(request){Element.hide('indicator')}, parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}, hoverclass:'cart-active'})</SCRIPT>
+
+<SCRIPT type=text/javascript>Droppables.add('wastebin', {accept:'cart-items', onDrop:function(element){Element.hide(element); new Ajax.Updater('items', '/shop/remove', {onLoading:function(request){Element.show('indicator')}, onComplete:function(request){Element.hide('indicator')}, parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}, hoverclass:'wastebin-active'})</SCRIPT>
+
+<P><A onclick="new Effect.SlideDown('source'); return false;" href="http://demo.script.aculo.us/shop#">View source</A></P><PRE id=source style="DISPLAY: none"><CODE>
+# view
+&lt;div style="margin-bottom:20px;height:120px;"&gt;
+&lt;% for product in @products %&gt;
+  &lt;%= image_tag "/images/products/product#{product.id}",
+        :id =&gt; "product_#{product.id}",
+        :alt =&gt; product.title, 
+        :class =&gt; "products"  %&gt;
+  &lt;%= draggable_element "product_#{product.id}", :revert =&gt; true %&gt;
+&lt;% end %&gt;
+&lt;/div&gt;
+
+&lt;h2&gt;Your cart:&lt;/h2&gt;
+
+&lt;div id="cart" class="cart" style="clear:left; height:132px;margin-top:10px;"&gt;
+  &lt;div id="wastebin"&gt;
+    Drop items here to remove them from the cart.
+  &lt;/div&gt;
+  &lt;div id="items"&gt;
+    &lt;%= render :partial =&gt; "cart" %&gt;
+  &lt;/div&gt;
+  &lt;div style="clear:both;"&gt;&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style="height:40px;padding-top:10px;"&gt;
+&lt;p id="indicator" style="display:none;margin-top:0px;"&gt;
+  &lt;%= image_tag "indicator.gif" %&gt; Updating cart...
+&lt;/p&gt;
+&lt;/div&gt;
+
+&lt;%= drop_receiving_element "cart", 
+      :update =&gt; "items", :url =&gt; { :action =&gt; "add" },
+      :accept =&gt; "products", :hoverclass =&gt; "cart-active",
+      :loading =&gt; "Element.show('indicator')",
+      :complete =&gt; "Element.hide('indicator')" %&gt;
+      
+&lt;%= drop_receiving_element "wastebin", 
+      :update =&gt; "items", :url =&gt; { :action =&gt; "remove" },
+      :accept =&gt; "cart-items", :hoverclass =&gt; "wastebin-active",
+      :before =&gt; "Element.hide(element)",
+      :loading =&gt; "Element.show('indicator')",
+      :complete =&gt; "Element.hide('indicator')" %&gt;
+    
+# controller
+class ShopController &lt; ApplicationController
+  
+  def index
+    session[:cart] ||= {}
+    @products = Product.find(:all)
+  end
+  
+  def add
+    product_id = params[:id].split("_")[1]
+    
+    session[:cart][product_id] = 
+      session[:cart].include?(product_id) ?  
+      session[:cart][product_id]+1 : 1
+  
+    render :partial =&gt; 'cart'
+  end
+  
+  def remove
+    product_id = params[:id].split("_")[1]
+    
+    if session[:cart][product_id] &gt; 1 
+      session[:cart][product_id] = session[:cart][product_id]-1
+    else
+      session[:cart].delete(product_id)
+    end
+    
+    render :partial =&gt; 'cart'
+  end
+  
+end
+
+
+# _cart.rhtml partial
+&lt;% session[:cart].each do |product,quantity| %&gt;
+&lt;div&gt;
+  &lt;% quantity.times do |i| %&gt;
+    &lt;%= image_tag "/images/products/product#{product}", 
+          :class =&gt; "cart-items", 
+          :id =&gt; "item_#{product}_#{i}", 
+          :style =&gt; "position:relative;" %&gt;
+    &lt;%= draggable_element "item_#{product}_#{i}", :revert =&gt; true %&gt;
+  &lt;% end %&gt;
+  &lt;span class="title"&gt;
+    &lt;%= Product.find(product).title + " (#{quantity})" %&gt;
+  &lt;/span&gt;
+&lt;/div&gt;
+&lt;% end %&gt;
+&lt;%= "Here's your shopping cart." if session[:cart].empty? %&gt;
+</CODE></PRE></DIV>
+<DIV id=footer>
+<P>Â© 2005 Thomas Fuchs <A 
+onclick="new Effect.BlindDown('license'); return false;" 
+href="http://demo.script.aculo.us/shop#">License</A> <A 
+href="http://validator.w3.org/check?uri=referer">validate</A> <A 
+href="http://mir.aculo.us/">mir.aculo.us</A> </P>
+<P class=info><A href="http://script.aculo.us/">script.aculo.us</A> demo site 
+version <EM>2005/07/04</EM> </P>
+<DIV id=license style="DISPLAY: none"><PRE>      script.aculo.us:
+      
+      Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+      
+      Permission is hereby granted, free of charge, to any person obtaining
+      a copy of this software and associated documentation files (the
+      "Software"), to deal in the Software without restriction, including
+      without limitation the rights to use, copy, modify, merge, publish,
+      distribute, sublicense, and/or sell copies of the Software, and to
+      permit persons to whom the Software is furnished to do so, subject to
+      the following conditions:
+      
+      The above copyright notice and this permission notice shall be
+      included in all copies or substantial portions of the Software.
+      
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+      LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+      OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+      WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+      
+      <A onclick="new Effect.BlindUp('license'); return false;" href="http://demo.script.aculo.us/shop#">Hide</A>
+      </PRE></DIV></DIV></BODY></HTML>
Index: /temp/trunk/html/test/nakatest/dragdrop/drecom.html
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/drecom.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/drecom.html	(revision 1328)
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0105)http://members.cms.drecom.jp/sec/SidefuncOrder.blog%3bjsessionid=E8DA4FE5C69A98F200C5E619643544B4.cms-ap1 -->
+<HTML lang=ja><HEAD><TITLE>¥Ñ¡¼¥ÄÁªÂò¡¦ÊÂ¤ÓÂØ¤¨ - ¥É¥ê¥³¥àCMS</TITLE>
+<META http-equiv=Content-Type content=text/html;charset=EUC-JP>
+<META content=CMS,¥É¥ê¥³¥à name=keywords>
+<META content=¥É¥ê¥³¥àCMS name=abstract>
+<META content=¥É¥ê¥³¥àCMS name=description>
+<SCRIPT src="files/style.js" type=text/javascript></SCRIPT>
+<LINK href="files/style.css" type=text/css rel=stylesheet><LINK 
+href="files/text.css" type=text/css rel=stylesheet>
+<SCRIPT src="files/common.js" type=text/javascript></SCRIPT>
+
+<SCRIPT src="files/xbs.js" type=text/javascript></SCRIPT>
+<!-- added by Takanori Ishikawa, 04/04/06 -->
+<SCRIPT src="files/sidefunc_order.js" type=text/javascript></SCRIPT>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY bottomMargin=0 leftMargin=0 topMargin=10 marginwidth="0" marginheight="0">
+ <SCRIPT language=JavaScript>
+    <!--
+      var help_add_sidefunc= '<b>¥µ¥¤¥É¥Ñ¡¼¥Ä¤ÎÄÉ²Ã¡¦ÊÔ½¸</b>¤ò¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£';
+    //-->
+</SCRIPT>
+
+<SCRIPT src="files/access_key.js" type=text/javascript></SCRIPT>
+
+<SCRIPT language=JavaScript>
+<!--
+function showUpdatedMessage() {
+	if (document.SidefuncOrderForm.isUpdated.value == 'true') {
+		htmlAlert("¥µ¥¤¥É¥Ð¡¼¤ÎÊÑ¹¹¤òÊÝÂ¸¤·¤Þ¤·¤¿¡£", 150, 300);
+	}
+}
+
+function nonSelectable(){
+	//
+	// Internet Explorer DHTML
+	// selection object -> empty method
+	// 
+	// ÁªÂò¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
+	if (document.selection && document.selection.empty) {
+		document.selection.empty();
+	}
+}
+
+/* onload */
+sidefunc_order_body_onload = function() {
+	// ¥µ¥¤¥É¥Ð¡¼ÊÂ¤ÓÂØ¤¨¥Ñ¥Í¥ë¤Î½é´ü²½
+	resizeBox();
+	SFDragManager.onload();
+	showUpdatedMessage();
+
+	
+	document.onkeydown = access_key_onkeydown_hock;
+}
+
+// invoked by document.onkeydown: Cntl + s
+function execSave()
+{
+	document.SidefuncOrderForm ? document.SidefuncOrderForm.submit() : void(0);
+}
+
+function resizeBox()
+{
+	var divs_ids = Array("out_box", "DISABLE", "in_box", "LEFT", "RIGHT");
+	var div = null;
+	var nBoxiesHeight = (BoxConfig.height + BoxConfig.padding) * 4;
+	nBoxiesHeight = (nBoxiesHeight < MIN_BOXIES_HEIGHT ? MIN_BOXIES_HEIGHT : nBoxiesHeight);
+		
+	
+	for (var i = 0; i < divs_ids.length; i++) {
+		div = XBSLayer.makeLayer(divs_ids[i]);
+		div.setHeight(div.getHeight() + nBoxiesHeight);
+	}
+}	
+	
+UtilKit.addhook(window, 'onload', sidefunc_order_body_onload);
+
+//-->
+</SCRIPT>
+
+      <TABLE class=sidebodybox onmousemove=nonSelectable(); height=400 cellSpacing=0 cellPadding=10 width=620 border=0>
+        <TBODY>
+        <TR>
+        <FORM name=SidefuncOrderForm action="./test.php" method=post><INPUT type=hidden name=isUpdated> 
+          <TD vAlign=top align=middle><BR>
+            <TABLE onmousemove=nonSelectable(); cellSpacing=0 cellPadding=0 
+            width=450 border=0>
+              <TBODY>
+              <TR>
+                <TD width=140>
+                  <DIV id=out_box 
+                  style="BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-LEFT: #000 1px solid; WIDTH: 140px; BORDER-BOTTOM: #000 1px solid; POSITION: relative; HEIGHT: 52px">
+                  <DIV class=normalfont 
+                  style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; BACKGROUND: #eee; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #000 1px solid" 
+                  align=center>»ÈÍÑ¤·¤Ê¤¤¥Ñ¡¼¥Ä</DIV>
+                  <DIV id=DISABLE 
+                  style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; LEFT: 4px; BORDER-LEFT: #ccc 1px solid; WIDTH: 130px; BORDER-BOTTOM: #ccc 1px solid; POSITION: relative; TOP: 4px; HEIGHT: 20px; BACKGROUND-COLOR: #ffffee"></DIV></DIV></TD>
+                <TD width=10><IMG height=1 src="files/spacer.gif" 
+                  width=10></TD>
+                <TD width=350>
+                  <DIV id=in_box 
+                  style="BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-LEFT: #000 1px solid; WIDTH: 350px; BORDER-BOTTOM: #000 1px solid; POSITION: relative; HEIGHT: 52px">
+                  <DIV class=normalfont 
+                  style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; BACKGROUND: #eee; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #000 1px solid" 
+                  align=center>»ÈÍÑ¤¹¤ë¥Ñ¡¼¥Ä</DIV>
+                  <DIV id=LEFT 
+                  style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; LEFT: 4px; BORDER-LEFT: #ccc 1px solid; WIDTH: 130px; BORDER-BOTTOM: #ccc 1px solid; POSITION: absolute; TOP: 26px; HEIGHT: 20px; BACKGROUND-COLOR: #eaf2ff"></DIV>
+                  <DIV id=RIGHT 
+                  style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; RIGHT: 4px; BORDER-LEFT: #ccc 1px solid; WIDTH: 130px; BORDER-BOTTOM: #ccc 1px solid; POSITION: absolute; TOP: 26px; HEIGHT: 20px; BACKGROUND-COLOR: #eaf2ff"></DIV></DIV></TD></TR></TBODY></TABLE><BR>
+            <DIV id=checkline 
+            style="VISIBILITY: hidden; WIDTH: 130px; POSITION: absolute; HEIGHT: 1px">
+            <HR color=#ff5555>
+            </DIV>
+            <DIV id=f0 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>ºÇ¿·¥³¥á¥ó¥È </DIV><INPUT type=hidden value=4 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=ºÇ¿·¥³¥á¥ó¥È name=sidefuncName> <INPUT type=hidden 
+            value=0 name=order> <INPUT type=hidden value=0 name=position> 
+            <DIV id=f1 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>ºÇ¿·¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ </DIV><INPUT type=hidden value=5 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=ºÇ¿·¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ name=sidefuncName> <INPUT type=hidden 
+            value=1 name=order> <INPUT type=hidden value=0 name=position> 
+            <DIV id=f2 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>RSS¥¢¥¤¥³¥ó </DIV><INPUT type=hidden value=9 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=RSS¥¢¥¤¥³¥ó name=sidefuncName> <INPUT type=hidden 
+            value=1 name=order> <INPUT type=hidden value=1 name=position> 
+            <DIV id=f3 
+            style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: gray 1px solid; COLOR: #666666; PADDING-TOP: 2px; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff" 
+            align=center>¥µ¥¤¥É¥á¥Ë¥å¡¼ </DIV><INPUT type=hidden value=10 
+            name=sidefuncId> <INPUT type=hidden value=0 name=authorCd> <INPUT 
+            type=hidden value=¥µ¥¤¥É¥á¥Ë¥å¡¼ name=sidefuncName> <INPUT type=hidden 
+            value=0 name=order> <INPUT type=hidden value=1 name=position> 
+            <DIV style="MARGIN: 20px 0px" align=center><INPUT class=button type=submit value=¡¡ÊÝ¡¡Â¸¡¡></DIV></TD></FORM></TR></TBODY></TABLE></A></TD></TR>
+</TBODY></TABLE>
+</TD></TR></TBODY></TABLE></BODY></HTML>
Index: /temp/trunk/html/test/nakatest/dragdrop/js/dragdrop.js
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/js/dragdrop.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/js/dragdrop.js	(revision 1328)
@@ -0,0 +1,196 @@
+var obj;
+var offsetX;
+var offsetY;
+var arrObj;
+var objParam;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Param() {
+	this.ITEM_MAX = 3;		
+}
+
+// ¥µ¥¤¥º´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Size() {
+	this.id = '';
+	this.left = 0;
+	this.top = 0;
+	this.width = 0;
+	this.height = 0;
+	this.obj;
+};
+
+// ¥ª¥ó¥í¡¼¥É½èÍý
+onload=function () {
+	// ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+	objParam = new SC_Param();
+	
+	// WIN-IE
+	if (document.all) {
+		objlist = document.all.tags("div");
+	// WIN-NN,WIN-FF   
+	} else if (document.getElementsByTagName) {
+		objlist = document.getElementsByTagName("div");
+	} else {
+		return;
+	}
+	
+	arrObj = new Array();
+	for (i = 0; i < objlist.length; i++) {
+		id = objlist[i].id;
+		arrObj[id] = new SC_Size();
+		arrObj[id].id = id;
+		arrObj[id].obj = objlist[id];
+		arrObj[id].left = objlist[id].style.left;
+		arrObj[id].top = objlist[id].style.top;
+		arrObj[id].width = objlist[id].style.width;
+		arrObj[id].height = objlist[id].style.height;
+		arrObj[id].left = Number(arrObj[id].left.replace(/px/, ''));
+		arrObj[id].top = Number(arrObj[id].top.replace(/px/, ''));
+		arrObj[id].width = Number(arrObj[id].width.replace(/px/, ''));
+		arrObj[id].height = Number(arrObj[id].height.replace(/px/, ''));
+		arrObj[id].right = Number(arrObj[id].left) + Number(arrObj[id].width);
+		arrObj[id].bottom =Number(arrObj[id].top) + Number(arrObj[id].height);
+	}
+	
+	// MouseDown¥¤¥Ù¥ó¥È½èÍý¤ÎÆþ¤ìÂØ¤¨
+	objlist['item0'].onmousedown = onMouseDown;
+	objlist['item1'].onmousedown = onMouseDown;
+	objlist['item2'].onmousedown = onMouseDown;
+	
+	document.onmousemove = onMouseMove;
+	document.onmouseup = onMouseUp;
+}
+
+// MouseDown¥¤¥Ù¥ó¥È
+function onMouseDown(e) {
+   obj = this;
+   // WIN-IE
+   if (document.all) {
+      offsetX = event.offsetX + 2;
+      offsetY = event.offsetY + 2;
+   // WIN-NN,WIN-FF
+   } else if (obj.getElementsByTagName) {
+      offsetX = e.pageX - parseInt(obj.style.left);
+      offsetY = e.pageY - parseInt(obj.style.top);
+   }
+   return false;
+}
+
+// MouseMove¥¤¥Ù¥ó¥È
+function onMouseMove(e) {
+	if (!obj) {
+		return true;
+	}	
+	// WIN-IE
+	if (document.all) {
+		x = event.clientX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = document.body.clientWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		y = event.clientY - offsetY;
+		if(y <= 0) {
+			y = 0;
+		}
+		top_max = document.body.clientHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;		
+	// WIN-NN,WIN-FF
+	} else if (obj.getElementsByTagName) {
+		x = e.pageX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = window.innerWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		
+		y = e.pageY - offsetY;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(y <= 0) {
+			y = 0;
+			obj.style.top = 0;
+		}
+		top_max = window.innerHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;
+	}
+	
+	if(isInFlame('flame0', obj)) {
+		document.getElementById('td1').style.backgroundColor = '#fffadd';
+	} else {
+		document.getElementById('td1').style.backgroundColor = '#ffffff';
+	}
+	return false;
+}
+
+// MouseUp¥¤¥Ù¥ó¥È
+function onMouseUp(e) {
+	if (!obj) {
+		return true;
+	}
+	
+	if(!isInFlame('flame0', obj)) {
+		// WIN-IE
+		if (document.all) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		// WIN-NN,WIN-FF
+		} else if (obj.getElementsByTagName) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		}
+	}	
+	document.getElementById('td1').style.backgroundColor = '#ffffff';	
+	obj = null;
+}
+
+// ¥Õ¥ì¡¼¥àÆâ¤Ë¥¢¥¤¥Æ¥à¤¬Â¸ºß¤¹¤ë¤«È½Äê¤¹¤ë¡¡
+function isInFlame(flame_id, item) {
+	top_val = item.style.top;
+	top_val = Number(top_val.replace(/px/, ''));
+	bottom_val = top_val + arrObj[item.id].height;
+	left_val = item.style.left;
+	left_val = Number(left_val.replace(/px/, ''))
+	right_val = left_val + arrObj[item.id].width;		
+	if(
+		top_val > arrObj[flame_id].top &&
+		bottom_val < arrObj[flame_id].bottom &&
+		left_val > arrObj[flame_id].left &&
+		right_val < arrObj[flame_id].right
+		) {
+		return true;
+	}
+	return false;
+}
+
+// Á÷¿®Á°¤Î½èÍý
+function preSubmit() {
+	for(i = 0; i < 3; i++) {
+		id = 'item' + i;
+		obj = arrObj[id].obj;
+		if(isInFlame ('flame0', obj)) {
+			document.form1[obj.id].value = "in";
+		} else {
+			document.form1[obj.id].value = "out";
+		}
+	}
+}
+
+
+
Index: /temp/trunk/html/test/nakatest/dragdrop/simple.html
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/simple.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/simple.html	(revision 1328)
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0054)http://www.res-system.com/weblog/media/1/dragdrop.html -->
+<HTML><HEAD><TITLE>DragDrop Sample</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=utf-8">
+<SCRIPT type=text/javascript>
+<!--
+var obj;
+var offsetX;
+var offsetY;
+
+onload=function () {
+   if (document.all) {
+   	  // WIN-IE
+      objlist = document.all.tags("div");
+   } else if (document.getElementsByTagName) {
+      // WIN-NN,WIN-FF
+      objlist = document.getElementsByTagName("div");
+   } else {
+   	  alert("3");   
+      return;
+   }
+   for (i = 0; i < objlist.length; i++) {
+      objlist[i].onmousedown = onMouseDown;
+   }
+   document.onmousemove = onMouseMove;
+   document.onmouseup = onMouseUp;
+}
+function onMouseDown(e) {
+   obj = this;
+   if (document.all) {
+      offsetX = event.offsetX + 2;
+      offsetY = event.offsetY + 2;
+   } else if (obj.getElementsByTagName) {
+      offsetX = e.pageX - parseInt(obj.style.left);
+      offsetY = e.pageY - parseInt(obj.style.top);
+   }
+   return false;
+}
+function onMouseMove(e) {
+   if (!obj) {
+      return true;
+   }
+   if (document.all) {
+      obj.style.left = event.clientX - offsetX + document.body.scrollLeft;
+      obj.style.top = event.clientY - offsetY + document.body.scrollTop;
+   } else if (obj.getElementsByTagName) {
+      obj.style.left = e.pageX - offsetX;
+      obj.style.top = e.pageY - offsetY;
+   }
+   return false;
+}
+function onMouseUp(e) {
+   obj = null;
+}
+
+-->
+</SCRIPT>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<DIV 
+style="BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 5px; LEFT: 200px; PADDING-BOTTOM: 5px; BORDER-LEFT: #000000 1px solid; WIDTH: 200px; CURSOR: move; PADDING-TOP: 5px; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 100px; HEIGHT: 50px; BACKGROUND-COLOR: #eeeeee; TEXT-ALIGN: center">Web 
+Artisan Blog </DIV></BODY></HTML>
Index: /temp/trunk/html/test/nakatest/dragdrop/naka1.html
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/naka1.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/naka1.html	(revision 1328)
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0054)http://www.res-system.com/weblog/media/1/dragdrop.html -->
+<HTML><HEAD><TITLE>DragDrop Sample</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=EUC-JP">
+<SCRIPT src="./js/dragdrop.js" type=text/javascript></SCRIPT>
+
+<STYLE TYPE="text/css">
+<!--
+.style_item0{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaaaff;
+	TEXT-ALIGN: center;
+}
+
+.style_item1{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #ffaaaa;
+	TEXT-ALIGN: center;
+}
+
+.style_item2{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaffaa;
+	TEXT-ALIGN: center;
+}
+
+.style_item2{
+	BORDER-RIGHT: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	BORDER-TOP: #000000 1px solid;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	BORDER-LEFT: #000000 1px solid;
+	CURSOR: move;
+	PADDING-TOP: 5px;
+	BORDER-BOTTOM: #000000 1px solid;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaffaa;
+	TEXT-ALIGN: center;
+}
+
+.style_flame{
+	POSITION: absolute;
+}
+
+-->
+</STYLE>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<table>
+	<tr><td height="150"></td></tr>
+</table>
+<table width="500" bgcolor="#cccccc"  border="0" cellspacing="1" cellpadding="10" summary=" ">
+<form name="form1" id="form1" method="post" action="./recv_post.php" onsubmit="preSubmit()">
+<input type="hidden" name="item0" value="0">
+<input type="hidden" name="item1" value="0">
+<input type="hidden" name="item2" value="0">
+	<tr>
+		<td bgcolor="#f5f5f5" align="center">flame1</td>
+	</tr>
+	<tr>
+		<td height="200" id="td1" bgcolor="#ffffff"><DIV id="flame0" class="style_flame" style="TOP: 200px; LEFT: 10px; WIDTH: 500px; HEIGHT: 200px;"></DIV></td>
+	</tr>
+</table>
+<table width="500">
+	<tr><td height="5"></td></tr>
+	<tr><td align="center"><input type="submit" name="subm" value="¥¢¥¤¥Æ¥à¤Î¾õ¶·¤òÁ÷¿®"></td></tr>
+</form>
+</table>
+
+<DIV id="item0" class="style_item0" style="TOP: 100px; LEFT: 45px; WIDTH: 100px; HEIGHT: 20px;">item0</DIV>
+<DIV id="item1" class="style_item1" style="TOP: 100px; LEFT: 195px; WIDTH: 100px; HEIGHT: 20px;">item1</DIV>
+<DIV id="item2" class="style_item2" style="TOP: 100px; LEFT: 345px; WIDTH: 100px; HEIGHT: 20px;">item2</DIV>
+</BODY>
+</HTML>
Index: /temp/trunk/html/test/nakatest/dragdrop/naka2.html
===================================================================
--- /temp/trunk/html/test/nakatest/dragdrop/naka2.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/dragdrop/naka2.html	(revision 1328)
@@ -0,0 +1,91 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0054)http://www.res-system.com/weblog/media/1/dragdrop.html -->
+<HTML><HEAD><TITLE>DragDrop Sample</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=EUC-JP">
+<SCRIPT src="./js/dragdrop.js" type=text/javascript></SCRIPT>
+
+<STYLE TYPE="text/css">
+<!--
+.style_item0{
+	BORDER-RIGHT: #000000 1px solid;
+	BORDER-TOP: #000000 1px solid;
+	BORDER-LEFT: #000000 1px solid;
+	BORDER-BOTTOM: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	PADDING-TOP: 5px;	
+	CURSOR: move;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaaaff;
+	TEXT-ALIGN: center;
+}
+
+.style_item1{
+	BORDER-RIGHT: #000000 1px solid;
+	BORDER-TOP: #000000 1px solid;
+	BORDER-LEFT: #000000 1px solid;
+	BORDER-BOTTOM: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	PADDING-TOP: 5px;	
+	CURSOR: move;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #ffaaaa;
+	TEXT-ALIGN: center;
+}
+
+.style_item2{
+	BORDER-RIGHT: #000000 1px solid;
+	BORDER-TOP: #000000 1px solid;
+	BORDER-LEFT: #000000 1px solid;
+	BORDER-BOTTOM: #000000 1px solid;
+	PADDING-RIGHT: 5px;
+	PADDING-LEFT: 5px;
+	PADDING-BOTTOM: 5px;
+	PADDING-TOP: 5px;	
+	CURSOR: move;
+	POSITION: absolute;
+	BACKGROUND-COLOR: #aaffaa;
+	TEXT-ALIGN: center;
+}
+
+.style_flame{
+	POSITION: absolute;
+}
+
+-->
+</STYLE>
+
+<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
+<BODY>
+<table>
+	<tr><td height="200"></td></tr>
+</table>
+<table width="500" bgcolor="#cccccc"  border="0" cellspacing="1" cellpadding="10" summary=" ">
+<form name="form1" id="form1" method="post" action="./recv_post.php" onsubmit="preSubmit()">
+<input type="hidden" name="item0" value="0">
+<input type="hidden" name="item1" value="0">
+<input type="hidden" name="item2" value="0">
+	<tr>
+		<td bgcolor="#f5f5f5" align="center">¥«¥´¤ËÆþ¤ì¤ë</td>
+	</tr>
+	<tr>
+		<td height="250" id="td1" bgcolor="#ffffff"><DIV id="flame0" class="style_flame" style="TOP: 250px; LEFT: 10px; WIDTH: 500px; HEIGHT: 250px;"></DIV></td>
+	</tr>
+</table>
+<table width="500">
+	<tr><td height="5"></td></tr>
+	<tr><td align="center"><input type="submit" name="subm" value="¥¢¥¤¥Æ¥à¤Î¾õ¶·¤òÁ÷¿®"></td></tr>
+</form>
+</table>
+
+<DIV id="item0" class="style_item0" style="TOP: 50px; LEFT: 45px; WIDTH: 100px; HEIGHT: 135px;">
+<img src="./img/item0.jpg"></DIV>
+<DIV id="item1" class="style_item1" style="TOP: 50px; LEFT: 195px; WIDTH: 100px; HEIGHT: 75px;">
+<img src="./img/item1.jpg"></DIV>
+<DIV id="item2" class="style_item2" style="TOP: 50px; LEFT: 345px; WIDTH: 100px; HEIGHT: 75px;">
+<img src="./img/item2.jpg"></DIV>
+</BODY>
+</HTML>
Index: /temp/trunk/html/test/nakatest/image/test.php
===================================================================
--- /temp/trunk/html/test/nakatest/image/test.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/image/test.php	(revision 1328)
@@ -0,0 +1,26 @@
+<?php
+header("Content-type: image/jpeg");
+$im  = imagecreatetruecolor(200, 200);
+$w   = imagecolorallocate($im, 255, 255, 255);
+$red = imagecolorallocate($im, 255, 0, 0);
+
+/* 5 ¥Ô¥¯¥»¥ë¤ÎÀÖÀþ¤È 5 ¥Ô¥¯¥»¥ë¤ÎÇòÀþ¤ÎÇËÀþ¤òÉÁ²è¤¹¤ë */
+$style = array($red, $red, $red, $red, $red, $w, $w, $w, $w, $w);
+imagesetstyle($im, $style);
+imageline($im, 0, 0, 100, 100, IMG_COLOR_STYLED);
+
+/*
+// imagesetstyle ¤òÊ»ÍÑ¤·¤¿ imagesetbrush() ¤ò»ÈÍÑ¤·¤Æ happy face ¤ÎÀþ¤òÉÁ²è¤¹¤ë
+$style = array($w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $red);
+imagesetstyle($im, $style);
+
+$brush = imagecreatefrompng("http://www.libpng.org/pub/png/images/smile.happy.png");
+$w2 = imagecolorallocate($brush, 255, 255, 255);
+imagecolortransparent($brush, $w2);
+imagesetbrush($im, $brush);
+imageline($im, 100, 0, 0, 100, IMG_COLOR_STYLEDBRUSHED);
+*/
+
+imagejpeg($im);
+imagedestroy($im);
+?>
Index: /temp/trunk/html/test/nakatest/pie.php
===================================================================
--- /temp/trunk/html/test/nakatest/pie.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/pie.php	(revision 1328)
@@ -0,0 +1,44 @@
+<?php
+require_once("./class/SC_GraphPie.php");
+require_once("./class/SC_GraphLine.php");
+
+$objGraphPie = new SC_GraphPie();
+$objGraphLine = new SC_GraphLine();
+
+$arrLegend = array(
+	'»î¸³1',
+	'»î¸³2',
+	'»î¸³3',
+	'»î¸³4',
+	'»î¸³5',
+	'»î¸³6',
+	'»î¸³7',
+	'»î¸³8',
+	'»î¸³5',
+	'»î¸³6',
+	'»î¸³7',
+	'»î¸³8'	
+);
+
+$arrData = array(
+	250,
+	23,
+	33,
+	58,
+	120,
+	300,
+	223,
+	100
+);
+
+// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+$objGraphPie->setData($arrData);
+// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+$objGraphPie->setLegend($arrLegend);
+
+// ±ß¥°¥é¥ÕÉÁ²è
+$objGraphPie->drawGraph();
+
+// ¥°¥é¥Õ¤Î½ÐÎÏ
+$objGraphPie->outputGraph();
+?>
Index: /temp/trunk/html/test/nakatest/class/SC_GraphBar.php
===================================================================
--- /temp/trunk/html/test/nakatest/class/SC_GraphBar.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/class/SC_GraphBar.php	(revision 1328)
@@ -0,0 +1,78 @@
+<?
+$SC_GRAPHBAR_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHBAR_DIR . "/SC_GraphLine.php");	
+
+// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphBar extends SC_GraphLine{
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphLine(
+		$bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP,
+		$area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
+		parent::SC_GraphLine($bgw, $bgh, $left, $top, $area_width, $area_height);	
+	}
+	
+	// ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawGraph() {
+		$this->drawYLine();
+		$this->drawXLine(true);
+		
+		// ËÀ¥°¥é¥Õ¤ÎÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawBar($i);
+		}
+		
+		// ¥é¥Ù¥ë¤ÎÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLabel($i);
+		}
+		
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend();	
+	}
+	
+	// ËÀ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawBar($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		// ¥Ç¡¼¥¿¿ô¤ò¿ô¤¨¤ë
+		$count = count($arrPointList);
+		// È¾ÌÜÀ¹¤ê¤ÎÉý¤òµá¤á¤ë
+		$half_scale = intval($this->area_width / ($count + 1) / 2);
+		// ÌÜÀ¹¤ê¤ÎÉý¤òµá¤á¤ë
+		$scale_width = intval($this->area_width / ($count + 1));
+		// ËÀ¥°¥é¥Õ¤Î¥µ¥¤¥º¤òµá¤á¤ë
+		$bar_width = intval(($scale_width - (BAR_PAD * 2)) / $this->line_max);
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		for($i = 0; $i < $count; $i++) {
+			$left = $arrPointList[$i][0] - $half_scale + BAR_PAD + ($bar_width * $line_no);
+			$top = $arrPointList[$i][1];
+			$right = $left + $bar_width;
+			$bottom = $this->top + $this->area_height;
+			
+			// ±Æ¤ÎÉÁ²è
+			if($this->shade_on) {
+				imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom, $this->shade_color);
+			}
+			//imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[($i % $c_max)]);
+			imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[$line_no]);			
+			imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color);					
+		}
+	}
+	
+	// ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($line_no) {
+		$arrData = $this->arrDataList[$line_no];
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			$text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE);
+			$y_pos = $y - FONT_SIZE - 5;
+			$x_pos = $x - $text_width / 2;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i]));
+		}
+	}
+	
+}
+?>
Index: /temp/trunk/html/test/nakatest/class/SC_GraphLine.php
===================================================================
--- /temp/trunk/html/test/nakatest/class/SC_GraphLine.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/class/SC_GraphLine.php	(revision 1328)
@@ -0,0 +1,268 @@
+<?
+$SC_GRAPHLINE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHLINE_DIR . "/SC_GraphBase.php");	
+
+// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphLine extends SC_GraphBase{
+	var $area_width;
+	var $area_height;
+	var $ygrid_on;
+	var $graph_max;		// ¥°¥é¥Õ¤Î¥¨¥ê¥¢ºÇÂçÃÍ(Y¼´ÄºÅÀ¤ÎÃÍ)
+	var $arrXLabel;		
+	var $XTitle;		// X¼´¥¿¥¤¥È¥ë
+	var $YTitle;		// Y¼´¥¿¥¤¥È¥ë
+	var $arrDataList;	// ¥°¥é¥Õ¥Ç¡¼¥¿¤ò³ÊÇ¼
+	var $arrPointList;	// ÀÞ¤ìÀþºÂÉ¸¤ò³ÊÇ¼
+	var $line_max;		// Ê£¿ô¤ÎÉÁ²è¤Î¾ì¹ç¤Ë²Ã»»¤·¤Æ¤¤¤¯
+			
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphLine(
+		$bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP,
+		$area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
+		parent::SC_GraphBase($bgw, $bgh, $left, $top);	
+		$this->area_width = $area_width;
+		$this->area_height = $area_height;
+		$this->ygrid_on = true;
+		$this->line_max = 0;
+		$this->graph_max = 0;
+	}
+	
+	// Y¼´¥¿¥¤¥È¥ë
+	function drawYTitle() {
+		// Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë
+		if($this->YTitle != "") {
+			$text_width = $this->getTextWidth($this->YTitle, FONT_SIZE);
+			$x_pos = $this->left - ($text_width / 2);
+			$y_pos = $this->top - FONT_SIZE - LINE_YTITLE_PAD;		
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, $this->YTitle);
+		}
+	}
+	
+	// X¼´¥¿¥¤¥È¥ë
+	function drawXTitle() {
+		// Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë
+		if($this->XTitle != "") {
+			$text_width = $this->getTextWidth($this->XTitle, FONT_SIZE);
+			$x_pos = $this->left + $this->area_width - ($text_width / 2);
+			$y_pos = $this->top + $this->area_height + LINE_XTITLE_PAD;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, $this->XTitle);
+		}
+	}
+	
+	// Y¼´¤ÎÉÁ²è
+	function drawYLine() {
+		imageline($this->image, $this->left, $this->top, $this->left, $this->top + $this->area_height, $this->flame_color);
+		// ÌÜÀ¹¤êÉý¤òµá¤á¤ë(Ãæ´ÖÅÀ¤Ï¼«Æ°)
+		$size = $this->area_height / (LINE_Y_SCALE * 2);
+		// ¾å¤«¤éÌÜÀ¹¤ê¤òÆþ¤ì¤Æ¤¤¤¯
+		$pos = 0;
+		for($i = 0; $i < (LINE_Y_SCALE * 2); $i++) {
+			// ÌÜÀ¹¤êÉý
+			if(($i % 2) == 0) {
+				$sw = LINE_SCALE_SIZE;
+				if($this->ygrid_on) {
+					imageline($this->image, $this->left, $this->top + $pos, $this->left + $this->area_width, $this->top + $pos, $this->grid_color);
+				}
+			} else {
+				$sw = LINE_SCALE_SIZE / 2;
+			}
+			imageline($this->image, $this->left, $this->top + $pos, $this->left + $sw, $this->top + $pos, $this->flame_color);
+			$pos += $size;
+		}
+		// Y¼´¤ËÌÜÀ¹¤êÃÍ¤òÆþ¤ì¤ë
+		$this->setYScale();
+		$this->drawYTitle();	
+	}
+	
+	// X¼´¤ÎÉÁ²è
+	function drawXLine($bar = false) {
+		imageline($this->image, $this->left, $this->top + $this->area_height, $this->left + $this->area_width, $this->top + $this->area_height, $this->flame_color);
+		$arrPointList = $this->arrPointList[0];
+		$count = count($arrPointList);
+		
+		// ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏÈ¾ÌÜÀ¹¤ê¤º¤é¤¹
+		if($bar) {
+			$half_scale = intval($this->area_width / ($count + 1) / 2);
+		} else {
+			$half_scale = 0;
+		}
+		
+		// ¥é¥Ù¥ë¤ÎÉ½¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤ò»»½Ð
+		$interval = ceil($count / LINE_XLABEL_MAX);	// ÀÚ¤ê¾å¤²				
+		for($i = 0; $i < $count; $i++) {
+			// X¼´¤ËÌÜÀ¹¤ê¤òÆþ¤ì¤ë
+			$x = $arrPointList[$i][0];
+			$pos = $this->top + $this->area_height;
+			imageline($this->image, $x - $half_scale, $pos, $x - $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);			
+			// ¥é¥Ù¥ë¤òÆþ¤ì¤ë
+			if(($i % $interval) == 0) {
+				$text_width = $this->getTextWidth($this->arrXLabel[$i], FONT_SIZE);
+				$x_pos = $x - ($text_width / 2);
+				$this->setText(FONT_SIZE, $x_pos, $pos + FONT_SIZE, $this->arrXLabel[$i]);
+			}
+		}
+		
+		// ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏºÇ¸å¤ÎÌÜÀ¹¤ê¤ò°ì¤ÄÄÉ²Ã¤¹¤ë
+		if($bar) {
+			imageline($this->image, $x + $half_scale, $pos, $x + $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);	
+		}
+		
+		$this->drawXTitle();
+	}
+		
+	// ¥°¥ê¥Ã¥ÉÉ½¼¨
+	function setYGridOn($ygrid_on) {
+		$this->ygrid_on = $ygrid_on;
+	}
+	
+	// ¥Ý¥¤¥ó¥È¤ÎÉÁ²è
+	function setMark($line_no, $left, $top, $size = LINE_MARK_SIZE) {
+		// ¶ö¿ô¤ËÊÑ´¹¤·¤Æ¤ª¤¯
+		$size += $size % 2;
+		$array = array(
+			$left, $top - ($size / 2),
+			$left + ($size / 2), $top,
+			$left, $top + ($size / 2),
+			$left - ($size / 2), $top,
+		);		
+		imagefilledpolygon($this->image, $array, 4, $this->arrColor[$line_no]);
+		imagepolygon($this->image, $array, 4, $this->flame_color);
+ 		imagesetpixel ($this->image, $left, $top + ($size / 2), $this->flame_color);
+	}	
+	
+	// Y¼´ÌÜÀ¹¤ê¤ËÃÍ¤òÆþ¤ì¤ë
+	function setYScale() {
+		// 1ÌÜÀ¹¤ê¤ÎÃÍ
+		$number = intval($this->graph_max / LINE_Y_SCALE);				
+		// ÌÜÀ¹¤êÉý¤òµá¤á¤ë
+		$size = $this->area_height / LINE_Y_SCALE;
+		$pos = 0;
+		for($i = 0; $i <= LINE_Y_SCALE; $i++) {
+			$snumber = $number * (LINE_Y_SCALE - $i);
+			$disp_number = number_format($snumber);
+			$num_width = $this->getTextWidth($disp_number, FONT_SIZE);
+			$this->setText(FONT_SIZE, $this->left - $num_width - 2, $this->top + $pos - (FONT_SIZE / 2), $disp_number);
+			$pos += $size;
+		}
+	}
+	
+	// 
+	function setMax($arrData) {
+		// ¥Ç¡¼¥¿¤ÎºÇÂçÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+		$data_max = max($arrData);
+		// 10¤Î²¿ÇÜ¤«¤ò¼èÆÀ
+		$figure = strlen($data_max) - 1;
+		// ¼¡¤Î·å¤ò·×»»¤¹¤ë
+		$tenval = pow(10, $figure);
+		// ¥°¥é¥Õ¾å¤Ç¤ÎºÇÂçÃÍ¤òµá¤á¤ë
+		$this->graph_max = $tenval * (intval($data_max / $tenval) + 1);
+		// ºÇÂçÃÍ¤¬10Ì¤Ëþ¤Î¾ì¹ç¤ÎÂÐ±þ
+		if($this->graph_max < 10) {
+			$this->graph_max = 10;
+		}	
+	}
+	
+	// ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawGraph() {
+		// ¥°¥é¥ÕÇØ·Ê¤òÉÁ²è
+		$this->drawYLine();
+		$this->drawXLine();
+		
+		// ÀÞ¤ìÀþ¥°¥é¥ÕÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLine($i);
+		}
+		
+		// ¥Þ¡¼¥¯¤òÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawMark($i);
+		}
+		
+		// ¥é¥Ù¥ë¤òÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLabel($i);		
+		}
+
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend();	
+	}
+	
+	// ¥é¥¤¥ó¤òÉÁ²è¤¹¤ë
+	function drawLine($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			if(isset($arrPointList[$i + 1])) {
+				$next_x = $arrPointList[$i + 1][0];
+				$next_y = $arrPointList[$i + 1][1];
+				imageline($this->image, $x, $y, $next_x, $next_y, $this->arrColor[$line_no]);
+			}
+		}
+	}
+	
+	// ¥Þ¡¼¥¯¤òÉÁ²è¤¹¤ë
+	function drawMark($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];			
+			$this->setMark($line_no, $x, $y);
+		}
+	}
+	
+	// ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($line_no) {
+		$arrData = $this->arrDataList[$line_no];
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			$text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE);
+			$y_pos = $y - FONT_SIZE - 5;
+			$x_pos = $x - $text_width / 2;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i]));
+		}
+	}
+	
+	// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+	function setData($arrData) {
+		$this->arrDataList[$this->line_max] = array_values((array)$arrData);
+		$this->setMax($this->arrDataList[$this->line_max]);
+		// ÃÍ¤ÎÉÁ²èÊÑ´¹Î¨
+		$rate = $this->area_height / $this->graph_max;
+		// ÉÁ²èÎ¨¤ò·×»»
+		$count = count($this->arrDataList[$this->line_max]);
+		$scale_width = $this->area_width / ($count + 1);		
+		$this->arrPointList[$this->line_max] = array();
+		for($i = 0; $i < $count; $i++) {
+			// XºÂÉ¸¤òµá¤á¤ë
+			$x = intval($this->left + ($scale_width * ($i + 1)));
+			// YºÂÉ¸¤òµá¤á¤ë
+			$y = intval($this->top + $this->area_height - ($this->arrDataList[$this->line_max][$i] * $rate));
+			// XYºÂÉ¸¤òÊÝÂ¸¤¹¤ë
+			$this->arrPointList[$this->line_max][] = array($x, $y);
+		}
+		$this->line_max++;
+	}
+	
+	// X¼´¥é¥Ù¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setXLabel($arrXLabel) {
+		$this->arrXLabel = array_values((array)$arrXLabel);
+	}
+	
+	// X¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setXTitle($title) {
+		$this->XTitle = $title;
+	}
+	
+	// Y¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setYTitle($title) {
+		$this->YTitle = $title;
+	}	
+}
+?>
Index: /temp/trunk/html/test/nakatest/class/SC_GraphBase.php
===================================================================
--- /temp/trunk/html/test/nakatest/class/SC_GraphBase.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/class/SC_GraphBase.php	(revision 1328)
@@ -0,0 +1,209 @@
+<?php
+
+$SC_GRAPHPIE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHPIE_DIR . "/config.php");
+require_once($SC_GRAPHPIE_DIR . "/lib.php");	
+
+// SC_Graph¶¦ÄÌ¥¯¥é¥¹
+class SC_GraphBase {
+	var $arrRGB;
+	var $arrColor;
+	var $arrDarkColor;
+	var $image;
+	var $left;
+	var $top;
+	var $shade_color;
+	var $flame_color;
+	var $shade_on;
+	var $text_color;
+	var $labelbg_color;
+	var $bgw;
+	var $bgh;
+	var $clabelbg_color;
+	var $title_color;
+	var $text_top;
+	var $mark_color;
+	var $arrLegend;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphBase($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left, $top) {
+		global $ARR_GRAPH_RGB;
+		global $ARR_BG_COLOR;
+		global $ARR_SHADE_COLOR;
+		global $ARR_FLAME_COLOR;
+		global $ARR_TEXT_COLOR;
+		global $ARR_LABELBG_COLOR;
+		global $ARR_LEGENDBG_COLOR;
+		global $ARR_TITLE_COLOR;
+		global $ARR_GRID_COLOR;
+		
+		// ²èÁüºîÀ®
+		$this->bgw = $bgw;
+		$this->bgh = $bgh;	
+		$this->image = imagecreatetruecolor($bgw, $bgh);
+		// ¥¢¥ó¥Á¥¨¥¤¥ê¥¢¥¹Í­¸ú
+		imageantialias($this->image, true);
+		// ÇØ·Ê¿§¤ò¥»¥Ã¥È
+		imagefill($this->image, 0, 0, lfGetImageColor($this->image, $ARR_BG_COLOR));
+		// »ÈÍÑ¿§¤ÎÀ¸À®
+		$this->setColorList($ARR_GRAPH_RGB);
+		// ¥°¥é¥ÕÉÁ²è°ÌÃÖ¤ÎÀßÄê
+		$this->left = $left;
+		$this->top = $top;
+		$this->shade_color = lfGetImageColor($this->image, $ARR_SHADE_COLOR);
+		$this->flame_color = lfGetImageColor($this->image, $ARR_FLAME_COLOR);
+		$this->text_color = lfGetImageColor($this->image, $ARR_TEXT_COLOR);
+		$this->labelbg_color = lfGetImageColor($this->image, $ARR_LABELBG_COLOR);
+		$this->clabelbg_color = lfGetImageColor($this->image, $ARR_LEGENDBG_COLOR);
+		$this->title_color = lfGetImageColor($this->image, $ARR_TITLE_COLOR);
+		$this->grid_color = lfGetImageColor($this->image, $ARR_GRID_COLOR);
+			
+		// ±Æ¤¢¤ê
+		$this->shade_on = true;
+    }
+	
+	// ¥ª¥Ö¥¸¥§¥¯¥È¥«¥é¡¼¤ÎÀßÄê
+	function setColorList($arrRGB) {
+		$this->arrRGB = $arrRGB;
+		$count = count($this->arrRGB);
+		// ÄÌ¾ï¿§¤ÎÀßÄê
+		for($i = 0; $i < $count; $i++) {
+			$this->arrColor[$i] = lfGetImageColor($this->image, $this->arrRGB[$i]);
+		}
+		// °Å¿§¤ÎÀßÄê
+		for($i = 0; $i < $count; $i++) {
+			$this->arrDarkColor[$i] = lfGetImageDarkColor($this->image, $this->arrRGB[$i]);
+		}		
+	}
+	
+	// ±Æ¤Î¤¢¤ê¤Ê¤·
+	function setShadeOn($shade_on) {
+		$this->shade_on = $shade_on;
+	}
+	
+	// ²èÁü¤ò½ÐÎÏ¤¹¤ë
+	function outputGraph($header = true) {
+		if($header) {
+			header('Content-type: image/png');
+		}
+		imagepng($this->image);
+		imagedestroy($this->image);
+	}
+	
+	// ÉÁ²è»þ¤Î¥Æ¥­¥¹¥ÈÉý¤òµá¤á¤ë
+	function getTextWidth($text, $font_size) {
+		$text_len = strlen($text);
+		$ret = $font_size * $text_len * TEXT_RATE;	
+		/*
+			¢¨Àµ³Î¤ÊÃÍ¤¬¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¤Î¤ÇÇÑ»ß
+			// ¥Æ¥­¥¹¥ÈÉý¤Î¼èÆÀ
+			$arrPos = imagettfbbox($font_size, 0, FONT_PATH, $text);
+			$ret = $arrPos[2] - $arrPos[0];
+		*/
+		return $ret;
+	}
+	
+	// ¥Æ¥­¥¹¥È¤ò½ÐÎÏ¤¹¤ë
+	function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) {
+		// »þ·×²ó¤ê¤Ë³ÑÅÙ¤òÊÑ¹¹
+		$angle = -$angle;		
+		// ¥é¥Ù¥ëÇØ·Ê
+		if($labelbg) {
+			$text_width = $this->getTextWidth($text, $font_size);
+			imagefilledrectangle($this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color);
+		}
+		$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+		if($color != NULL) {
+			ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_PATH, $text);
+		} else {
+			ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $this->text_color, FONT_PATH, $text);			
+		}
+	}
+	
+	// ¥¿¥¤¥È¥ë¤ò½ÐÎÏ¤¹¤ë
+	function drawTitle($text, $font_size = TITLE_FONT_SIZE) {
+		// ½ÐÎÏ°ÌÃÖ¤Î»»½Ð
+		$text_width = $this->getTextWidth($text, $font_size);
+		$left = ($this->bgw - $text_width) / 2;
+		$top = TITLE_TOP;
+		$this->setText($font_size, $left, $top, $text, $this->title_color);		
+	}
+	
+	// ¥í¥°¤ò½ÐÎÏ¤¹¤ë
+	function debugPrint($text) {
+		$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+		if(!isset($this->text_top)) {
+			$this->text_top = FONT_SIZE + LINE_PAD;
+		}		
+		// ¥Æ¥­¥¹¥ÈÉÁ²è
+		ImageTTFText($this->image, FONT_SIZE, 0, LINE_PAD, $this->text_top, $this->text_color, FONT_PATH, $text);
+		$this->text_top += FONT_SIZE + LINE_PAD;
+	}
+		
+	// ¥«¥é¡¼¥é¥Ù¥ë¤òÉÁ²è
+	function drawLegend($legend_max = "", $clabelbg = true) {
+		// ËÞÎã¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐÃæ»ß
+		if(count($this->arrLegend) <= 0) {
+			return;
+		}		
+		
+		if($legend_max != "") {
+			$label_max = $legend_max;
+		} else {
+			$label_max = count($this->arrLegend);
+		}
+
+		$height_max = 0;
+		$text_max = 0;
+		$width_max = 0;
+		
+		// °ìÈÖÊ¸»ú¿ô¤¬Â¿¤¤¤â¤Î¤ò¼èÆÀ
+		for($i = 0; $i < $label_max; $i++) {
+			$text_len = strlen($this->arrLegend[$i]);
+			if($text_max < $text_len) {
+				$text_max = $text_len;
+			}
+			$height_max += FONT_SIZE + LINE_PAD;
+		}
+		$width_max = FONT_SIZE * $text_max * TEXT_RATE;		
+
+		// 	¥«¥é¡¼¥¢¥¤¥³¥ó¤ÈÊ¸»ú´Ö¤ò´Þ¤á¤¿Éý
+		$width_max += FONT_SIZE + (LINE_PAD * 2);	
+		$left = $this->bgw - $width_max - LEGEND_RIGHT;
+		$top = LEGEND_TOP;
+		// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+		if($clabelbg) {
+			$this->drawClabelBG($left - LINE_PAD, $top, $left + $width_max, $top + $height_max + LINE_PAD);
+		}
+		$top += LINE_PAD;
+				
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		for($i = 0; $i < $label_max; $i++) {			
+			// ¥«¥é¡¼¥¢¥¤¥³¥ó¤ÎÉ½¼¨
+			imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color);
+			imagefilledrectangle($this->image, $left + 1, $top + 1, $left + FONT_SIZE - 1, $top + FONT_SIZE - 1, $this->arrColor[($i % $c_max)]);
+			// ¥é¥Ù¥ë¤ÎÉ½¼¨
+			$this->setText(FONT_SIZE, $left + FONT_SIZE + LINE_PAD, $top, $this->arrLegend[$i]);
+			$top += FONT_SIZE + LINE_PAD;
+		}
+	}
+	
+	// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+	function drawClabelBG($left, $top, $right, $bottom) {
+		// ±Æ¤ÎÉÁ²è
+		if($this->shade_on) {
+			imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color);
+		}
+		// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+		imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->clabelbg_color);
+		imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color);
+	}
+	
+	// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+	function setLegend($arrLegend) {
+		$this->arrLegend = array_values((array)$arrLegend);
+	}
+}
+
+?>
Index: /temp/trunk/html/test/nakatest/class/SC_GraphPie.php
===================================================================
--- /temp/trunk/html/test/nakatest/class/SC_GraphPie.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/class/SC_GraphPie.php	(revision 1328)
@@ -0,0 +1,192 @@
+<?php
+
+$SC_GRAPHPIE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHPIE_DIR . "/SC_GraphBase.php");	
+
+// ±ß¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphPie extends SC_GraphBase{
+	var $cw;
+	var $ch;
+	var $cz;
+	var $cx;
+	var $cy;
+	var $arrLabel;
+	var $arrData;
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphPie($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT, $top = PIE_TOP) {
+		parent::SC_GraphBase($bgw, $bgh, $left, $top);
+		// ¥µ¥¤¥ºÀßÄê
+		$this->setSize(PIE_WIDTH, PIE_HEIGHT, PIE_THICK);
+		// °ÌÃÖÀßÄê
+		$this->setPosition($this->left + ($this->cw / 2), $this->top + ($this->ch / 2));
+    }
+	
+	// ¥Ç¡¼¥¿¤ò360¡ëÃÍ¤ËÊÑ´¹¤¹¤ë
+	function getCircleData($array) {
+		if(!is_array($array)) {
+			return;
+		}
+		$arrRet = array();
+		foreach($array as $val) {
+			$total += $val;			
+		}
+		if($total <= 0) {
+			return;
+		}		
+		$rate = 360 / $total;
+		// ¥é¥Ù¥ëÉ½¼¨ÍÑ
+		$p_rate = 100 / $total;
+		$cnt = 0;
+		foreach($array as $val) {
+			$ret = round($val * $rate);
+			$new_total+= $ret;
+			$arrRet[] = $ret;
+			// ¥Ñ¡¼¥»¥ó¥ÈÉ½¼¨ÍÑ
+			$this->arrLabel[] = round($val * $p_rate) . " %";
+			$cnt++;
+		}
+		// ¹ç·×¤¬360¤Ë¤Ê¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤ª¤¯
+		$arrRet[0] -= $new_total - 360;
+		return $arrRet;
+	}	
+		
+	// ±ß¤Î°ÌÃÖÀßÄê¤ò¹Ô¤¦
+	function setPosition($cx, $cy) {
+		$this->cx = $cx;
+		$this->cy = $cy;
+	}
+		
+	// ±ß¤Î¥µ¥¤¥ºÀßÄê¤ò¹Ô¤¦
+	function setSize($cw, $ch, $cz = 0) {
+		$this->cw = $cw;
+		$this->ch = $ch;
+		$this->cz = $cz;
+	}
+	
+	// ±Æ¤ÎÉÁ²è
+	function drawShade() {
+		$move = 1;
+		for($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) {
+			imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE);
+			$move += 0.5;
+		}
+	}
+	
+	// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+	function setData($arrData) {
+		$this->arrData = array_values($arrData);
+	}
+	
+	// ±ß¥°¥é¥Õ¤òÉÁ²è¤¹¤ë
+	function drawGraph() {
+		$x = $this->cx;
+		$y = $this->cy;
+		$z = $this->cz;
+		$h = $this->ch;
+		$w = $this->cw;
+		
+		$arrRad = $this->getCircleData($this->arrData);
+		$rd_max = count($arrRad);
+		
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç
+		if($rd_max <= 0) {
+			return;
+		}
+		
+		// ±Æ¤ÎÉÁ²è
+		if($this->shade_on) {
+			$this->drawShade();
+		}
+			
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		$dc_max = count($this->arrDarkColor);
+		
+		// Â¦ÌÌ¤ÎÉÁ²è		
+		for ($i = ($y + $z - 1); $i >= $y; $i--) {
+			$start = 0;
+			for($j = 0; $j < $rd_max; $j++) {
+				$end = $start + $arrRad[$j];
+				if($start == 0 && $end == 360) {
+					// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+					imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]);
+				} else {
+					// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë
+					imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[($j % $dc_max)]);	
+				}			
+				$start = $end;
+			}
+		}
+		// ÄìÌÌ¤ÎÉÁ²è
+		imagearc($this->image, $x, $y + $z, $w, $h, 0, 180 , $this->flame_color);
+
+		// ¾åÌÌ¤ÎÉÁ²è
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			if($start == 0 && $end == 360) {
+				// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+				imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);			
+			} else {
+				// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£		
+				imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);
+			}
+			$start = $end;
+		}
+
+		// ¾åÌÌ¤Î±ï¼è¤ê
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			if($start == 0 && $end == 360) {
+				// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+				imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color);
+			}
+			// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£
+			imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL);
+			$start = $end;
+		}
+
+		// Â¦ÌÌ¤Î±ï¼è¤ê
+		imageline($this->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $this->flame_color);
+		imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color);
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			// Á°ÌÌ¤Î¤ß
+			if($end > 90 && $end < 270) {
+				list($ax, $ay) = lfGetArcPos($x, $y, $w, $h, $end);
+				// ¥é¥¤¥ó¤Î¤º¤ì¤òÊäÀµ¤¹¤ë
+				if($end > 180) {
+					$ax = $ax + 1;
+				}
+				imageline($this->image, $ax, $ay, $ax, $ay + $z, $this->flame_color);
+			}
+			$start = $end;	
+		}
+				
+		// ¥é¥Ù¥ë¤ÎÉÁ²è
+		$this->drawLabel($arrRad);
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend(count($this->arrData));			
+	}
+	
+	// ±ß¥°¥é¥Õ¤Î¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($arrRad) {
+		$rd_max = count($arrRad);
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$center = $start + ($arrRad[$i] / 2);
+			$end = $start + $arrRad[$i];
+			list($sx, $sy) = lfGetArcPos($this->cx, $this->cy, ($this->cw / 1.5), ($this->ch / 1.5), $center);
+			list($ex, $ey) = lfGetArcPos($this->cx, $this->cy, ($this->cw * 1.5), ($this->ch * 1.5), $center);
+			// »Ø¼¨Àþ¤ÎÉÁ²è
+			imageline($this->image, $sx, $sy, $ex + 2, $ey - PIE_LABEL_UP, $this->flame_color);
+			$this->setText(FONT_SIZE, $ex - 10, $ey - PIE_LABEL_UP - FONT_SIZE, $this->arrLabel[$i], NULL, 0, true);
+			$start = $end;
+		}
+	}	
+}
+
+?>
Index: /temp/trunk/html/test/nakatest/class/config.php
===================================================================
--- /temp/trunk/html/test/nakatest/class/config.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/class/config.php	(revision 1328)
@@ -0,0 +1,93 @@
+<?php
+
+/*
+	¶¦ÄÌ 
+*/
+// TTF¥Õ¥©¥ó¥È¥Õ¥¡¥¤¥ë
+define("FONT_PATH", "/home/web/os-test.lockon.co.jp/data/fonts/ipag.ttf");
+define("FONT_SIZE", 8);			// ¥Õ¥©¥ó¥È¥µ¥¤¥º
+define("TITLE_FONT_SIZE", 10);	// ¥¿¥¤¥È¥ë¥Õ¥©¥ó¥È¥µ¥¤¥º
+define("BG_WIDTH", 720);		// ÇØ·ÊÉý
+define("BG_HEIGHT", 400);		// ÇØ·Ê¹â¤µ
+define("LINE_PAD", 5);			// ¹Ô´Ö
+define("TEXT_RATE", 0.75);		// ¥Õ¥©¥ó¥ÈÊäÀµÃÍ(¼ÂºÝ¤ÎÉÁ²èÉý/¥Õ¥©¥ó¥È¥µ¥¤¥º)
+
+/*
+	±ß¥°¥é¥Õ
+*/
+define("PIE_LEFT", 200);			// ±ß¥°¥é¥Õ°ÌÃÖ
+define("PIE_TOP", 150);				// ±ß¥°¥é¥Õ°ÌÃÖ
+define("PIE_WIDTH", 230);			// ±ß¥°¥é¥ÕÉý
+define("PIE_HEIGHT", 100);			// ±ß¥°¥é¥Õ¹â¤µ
+define("PIE_THICK", 100);			// ±ß¥°¥é¥ÕÂÀ¤µ
+define("PIE_LABEL_UP", 20);			// ±ß¥°¥é¥Õ¤Î¥é¥Ù¥ë°ÌÃÖ¤ò¾å¤Ë¤¢¤²¤ë
+define("PIE_SHADE_IMPACT", 0.3);	// ÃÍ¤¬Âç¤­¤¤¤Û¤É±Æ¤¬Ä¹¤¯¤Ê¤ë
+
+/*
+	ÀÞ¤ìÀþ¥°¥é¥Õ
+*/
+define("LINE_Y_SCALE", 10);			// Y¼´¤ÎÌÜÀ¹¤ê¿ô
+define("LINE_X_SCALE", 10);			// X¼´¤ÎÌÜÀ¹¤ê¿ô
+define("LINE_LEFT", 60);			// Àþ¥°¥é¥Õ°ÌÃÖ
+define("LINE_TOP", 50);				// Àþ¥°¥é¥Õ°ÌÃÖ
+define("LINE_AREA_WIDTH", 600);		// Àþ¥°¥é¥ÕÇØ·Ê¤Î¥µ¥¤¥º
+define("LINE_AREA_HEIGHT", 300);	// Àþ¥°¥é¥ÕÇØ·Ê¤Î¥µ¥¤¥º
+define("LINE_MARK_SIZE", 6);		// Àþ¥°¥é¥Õ¥Þ¡¼¥¯¤Î¥µ¥¤¥º
+define("LINE_SCALE_SIZE", 6);		// ÌÜÀ¹¤êÉý
+define("LINE_XLABEL_MAX", 30);		// X¼´¤Î¥é¥Ù¥ë¤ÎÉ½¼¨À©¸Â¿ô
+define("LINE_XTITLE_PAD", 25);		// X¼´¤Î¥¿¥¤¥È¥ë¤È¼´¤Î´Ö³Ö
+define("LINE_YTITLE_PAD", 15);		// Y¼´¤Î¥¿¥¤¥È¥ë¤È¼´¤Î´Ö³Ö
+
+/* 
+	ËÀ¥°¥é¥Õ
+*/
+define("BAR_PAD", 6);				// ¥°¥é¥Õ¤ÈÌÜÀ¹¤ê¤Î´Ö³Ö
+
+/*
+	¥¿¥¤¥È¥ë¥é¥Ù¥ë
+*/
+define("TITLE_TOP", 10);	// ÇØ·ÊÏÈ¤È¤Î¾åÉý
+
+/*
+	ËÞÎã
+*/
+define("LEGEND_TOP", 10); 	// ÇØ·ÊÏÈ¤È¤Î¾åÉý
+define("LEGEND_RIGHT", 10); // ÇØ·ÊÏÈ¤È¤Î±¦Éý
+
+
+/*
+	É½¼¨¿§
+*/
+// ËÞÎãÇØ·Ê
+$ARR_LEGENDBG_COLOR = array(245,245,245);
+// ¥é¥Ù¥ëÇØ·Ê
+$ARR_LABELBG_COLOR = array(255,255,255);
+// ¥°¥é¥Õ¥«¥é¡¼
+$ARR_GRAPH_RGB = array(
+	array(200,50,50),
+	array(50,50,200),
+	array(50,200,50),
+	array(255,255,255),
+	array(244,200,200),
+	array(200,200,255),
+	array(50,200,50),
+	array(255,255,255),
+	array(244,244,244),
+);
+// ±Æ¤Î¿§
+$ARR_SHADE_COLOR = array(100,100,100);
+// ±ï¤Î¿§
+$ARR_FLAME_COLOR = array(100, 100, 140);
+// Ê¸»ú¿§
+$ARR_TEXT_COLOR = array(0, 0, 0);
+// ÇØ·Ê¥«¥é¡¼
+$ARR_BG_COLOR = array(255,252,232);	
+// ¥¿¥¤¥È¥ëÊ¸»ú¿§
+$ARR_TITLE_COLOR = array(100, 50, 50);
+// ¥°¥ê¥Ã¥ÉÀþ¿§
+$ARR_GRID_COLOR = array(200, 200, 200);
+// ¥Þ¡¼¥¯¤Î¿§
+$ARR_MARK_COLOR = array(130, 130, 255);
+
+
+?>
Index: /temp/trunk/html/test/nakatest/class/lib.php
===================================================================
--- /temp/trunk/html/test/nakatest/class/lib.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/class/lib.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+
+// ±ß¤ÎÃæ¿´ÅÀ¤ÈÄ¾·Â¤«¤é¸Ì¤Î½ªÃ¼ºÂÉ¸¤ò»»½Ð¤¹¤ë¡£
+/*
+	$cx	: Ãæ¿´ÅÀXºÂÉ¸
+	$cy	: Ãæ¿´ÅÀYºÂÉ¸
+	$r	: È¾·Â
+	$e	: ³ÑÅÙ
+*/
+function lfGetArcPos($cx, $cy, $cw, $ch, $e) {
+	// »°³Ñ´Ø¿ôÍÑ¤Î³ÑÅÙ¤òµá¤á¤ë
+	$s = 90 - $e;
+	$r = $cw / 2;
+	// °ÌÃÖ¤òµá¤á¤ë
+	$x = $cx + ($r * cos(deg2rad($s)));
+	$y = $cy - (($r * sin(deg2rad($s))) * ($ch / $cw));		
+	return array(round($x), round($y));
+}
+
+
+
+/* ²èÁü¤Ë¥Æ¥­¥¹¥È¤òÉÁ²è¤¹¤ë */
+function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) {
+	$color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]);
+	$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+	// É½¼¨³ÑÅÙ	
+	$angle = 0;
+	// ¥Æ¥­¥¹¥ÈÉÁ²è
+	ImageTTFText($dst_image, $font_size, $angle, $left, $top, $color, $font, $text);
+}
+
+// É½¼¨¿§¤Î¼èÆÀ
+function lfGetImageColor($image, $array) {
+	if(count($array) != 3) {
+		return NULL;
+	}
+	$ret = imagecolorallocate($image, $array[0], $array[1], $array[2]);
+	return $ret;
+}
+
+// ±ÆÍÑÉ½¼¨¿§¤Î¼èÆÀ
+function lfGetImageDarkColor($image, $array) {
+	if(count($array) != 3) {
+		return NULL;
+	}
+	$i = 0;
+	foreach($array as $val) {
+		$dark[$i] = $val - 45;
+		if($dark[$i] < 0) {
+			$dark[$i] = 0;
+		}
+		$i++;
+	}
+	$ret = imagecolorallocate($image, $dark[0], $dark[1], $dark[2]);
+	return $ret;
+}
+?>
Index: /temp/trunk/html/test/nakatest/test.php
===================================================================
--- /temp/trunk/html/test/nakatest/test.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/test.php	(revision 1328)
@@ -0,0 +1,81 @@
+<?php
+
+require_once("../../require.php");
+
+sfGetParentsArray("dtb_category","parent_category_id", "category_id", 230);
+sfGetChildrenArray("dtb_category","parent_category_id", "category_id", 6);
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é»ÒIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
+function sfGetChildrenArray($table, $pid_name, $id_name, $id) {
+	$objQuery = new SC_Query();
+	$col = $pid_name . "," . $id_name;
+ 	$arrData = $objQuery->select($col, $table);
+	
+	$arrPID = array();
+	$arrPID[] = $id;
+	$arrChildren = array();
+	$arrChildren[] = $id;
+	
+	$arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID);
+	
+	while(count($arrRet) > 0) {
+		$arrChildren = array_merge($arrChildren, $arrRet);
+		$arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrRet);
+	}
+	
+	return $arrChildren;
+}
+
+/* ¿ÆIDÄ¾²¼¤Î»ÒID¤ò¤¹¤Ù¤Æ¼èÆÀ¤¹¤ë */
+function sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID) {
+	$arrChildren = array();
+	$max = count($arrData);
+	
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrPID as $val) {
+			if($arrData[$i][$pid_name] == $val) {
+				$arrChildren[] = $arrData[$i][$id_name];
+			}
+		}
+	}
+	return $arrChildren;
+}
+
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é¿ÆIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
+function sfGetParentsArray($table, $pid_name, $id_name, $id) {
+	$objQuery = new SC_Query();
+	$col = $pid_name . "," . $id_name;
+ 	$arrData = $objQuery->select($col, $table);
+	
+	$arrParents = array();
+	$arrParents[] = $id;
+	$child = $id;
+	
+	$ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $child);
+	
+	while($ret != "") {
+		$arrParents = array_merge($arrParents, $ret);
+		$ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $ret);
+	}
+	
+	$arrParents = array_reverse($arrParents);
+	
+	return $arrParents;
+}
+
+/* »ÒID½êÂ°¤¹¤ë¿ÆID¤ò¼èÆÀ¤¹¤ë */
+function sfGetParentsArraySub($arrData, $pid_name, $id_name, $child) {
+	$max = count($arrData);
+	$parent = "";
+	for($i = 0; $i < $max; $i++) {
+		if($arrData[$i][$id_name] == $child) {
+			$parent = $arrData[$i][$pid_name];
+			break;
+		}
+	}
+	return $parent;
+}
+
+
+?>
Index: /temp/trunk/html/test/nakatest/test1.php
===================================================================
--- /temp/trunk/html/test/nakatest/test1.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/test1.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once("../../require.php");
+
+$arrRet = sfGetChildrenArray("dtb_category","parent_category_id", "category_id", 1);
+
+sfPrintR($arrRet);
+
+
+?>
Index: /temp/trunk/html/test/nakatest/test2.php
===================================================================
--- /temp/trunk/html/test/nakatest/test2.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/test2.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?
+
+$arrRet = array("1", "2", "3", "4", "5", "0");
+
+if(array_search("2", $arrRet)) {
+	echo '2:find';
+}
+
+if(array_search("1", $arrRet)) {
+	echo '1:find';
+}
+
+if(array_search("3", $arrRet)) {
+	echo '3:find';
+}
+
+if(array_search("4", $arrRet)) {
+	echo '4:find';
+}
+
+if(array_search("0", $arrRet)) {
+	echo '0:find';
+}
+
+print(array_search("1", $arrRet));
+print(array_search("2", $arrRet));
+
+?>
Index: /temp/trunk/html/test/nakatest/test3.php
===================================================================
--- /temp/trunk/html/test/nakatest/test3.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/test3.php	(revision 1328)
@@ -0,0 +1,5 @@
+<?php
+	$ret = ereg_replace("^[a-zA-Z0-9_~=&\?\/-]+", "", "naka.lockon.co.jp");
+	
+	print($ret);
+?>
Index: /temp/trunk/html/test/nakatest/zip.php
===================================================================
--- /temp/trunk/html/test/nakatest/zip.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/zip.php	(revision 1328)
@@ -0,0 +1,84 @@
+<?php
+
+require_once("../../require.php");
+
+define("ZIP_CSV_LINE_MAX", 8192);
+define("IMAGE_MAX", 680);	// ²èÁü¤ÎÉ½¼¨¸Ä¿ô
+
+$path = ROOT_DIR . "html/install/KEN_ALL.CSV";
+
+$objQuery = new SC_Query();
+
+$fp = fopen($path, "r");
+
+// °ìÉô¤ÎIE¤Ï256¥Ð¥¤¥È°Ê¾å¼õ¤±¼è¤Ã¤Æ¤«¤éÉ½¼¨¤ò³«»Ï¤¹¤ë¡£
+for($i = 0; $i < 256; $i++) {
+	print(" ");
+}
+print("\n");
+flush();
+
+if(!$fp) {
+	sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+} else {
+	print("<img src='/img/install/main_w.jpg'><br>");
+	flush();
+	
+	// CSV¤Î·ï¿ô¤ò¿ô¤¨¤ë
+	$line = 0;
+	while(!feof($fp)) {
+		fgets($fp, ZIP_CSV_LINE_MAX);
+		$line++;
+	}
+	
+	print("<img src='/img/install/space_w.gif'>");
+	flush();
+		
+	// ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤òÌá¤¹
+	fseek($fp, 0);
+	
+	// ²èÁü¤ò°ì¸ÄÉ½¼¨¤¹¤ë·ï¿ô¤òµá¤á¤ë¡£
+	$disp_line = intval($line / IMAGE_MAX);
+	
+	// ´û¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤ò¿ô¤¨¤ë
+	$end_cnt = $objQuery->count("mtb_zip");
+	
+	$cnt = 1;
+	$img_cnt = 0;
+	while (!feof($fp)) {
+		$arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX);
+		
+		// ¤¹¤Ç¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤òÈô¤Ð¤¹¡£
+		if($cnt > $end_cnt) {
+			$sqlval['code'] = $arrCSV[0];
+			$sqlval['old_zipcode'] = $arrCSV[1];
+			$sqlval['zipcode'] = $arrCSV[2];
+			$sqlval['state_kana'] = $arrCSV[3];
+			$sqlval['city_kana'] = $arrCSV[4];
+			$sqlval['town_kana'] = $arrCSV[5];
+			$sqlval['state'] = $arrCSV[6];
+			$sqlval['city'] = $arrCSV[7];
+			$sqlval['town'] = $arrCSV[8];
+			$sqlval['flg1'] = $arrCSV[9];
+			$sqlval['flg2'] = $arrCSV[10];
+			$sqlval['flg3'] = $arrCSV[11];
+			$sqlval['flg4'] = $arrCSV[12];
+			$sqlval['flg5'] = $arrCSV[13];
+			$sqlval['flg6'] = $arrCSV[14];	
+			$objQuery->insert("mtb_zip", $sqlval);
+		}
+		
+		$cnt++;
+		// $disp_line·ï¤´¤È¤Ë¿ÊÄ½É½¼¨¤¹¤ë
+		if($cnt % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
+			print("<img src='/img/install/graph_1_w.gif'>");
+			flush();
+			$img_cnt++;
+		}
+	}
+	fclose($fp);
+	print("<img src='/img/install/space_w.gif'>");
+}
+
+
+?>
Index: /temp/trunk/html/test/nakatest/bar.php
===================================================================
--- /temp/trunk/html/test/nakatest/bar.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/bar.php	(revision 1328)
@@ -0,0 +1,75 @@
+<?php
+require_once("./class/SC_GraphBar.php");
+
+$objGraphBar = new SC_GraphBar();
+
+$arrData1 = array(
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+);
+
+$arrData2 = array(
+	533,
+	1158,
+	3250,
+	423,
+	1120,
+	100,
+	250,
+	1300,
+	2223,
+);
+
+$arrData3 = array(
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	3250,
+	423,
+	533,
+	1158,
+);
+
+$arrXLabel = array(
+	'»î¸³1',
+	'»î¸³2',
+	'»î¸³3',
+	'»î¸³4',
+	'»î¸³5',
+	'»î¸³6',
+	'»î¸³7',
+	'»î¸³8',
+	'»î¸³9',
+	'»î¸³10',
+	'»î¸³11',
+);
+
+$arrLegend = array(
+	'»î¸³1',
+	'»î¸³2',
+	'»î¸³3',
+	'»î¸³4'
+);
+
+// ¥°¥é¥ÕÉÁ²è
+$objGraphBar->setXLabel($arrXLabel);
+$objGraphBar->setXTitle("´ü´Ö(·î)");
+$objGraphBar->setYTitle("Çä¾å¤²(±ß)");
+$objGraphBar->setData($arrData1);
+$objGraphBar->setData($arrData2);
+$objGraphBar->setData($arrData3);
+$objGraphBar->setLegend($arrLegend);
+$objGraphBar->drawGraph();
+
+$objGraphBar->outputGraph();
+
+?>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/fullscreen.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/fullscreen.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/fullscreen.html	(revision 1328)
@@ -0,0 +1,133 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html>
+  <head>
+    <title>Fullscreen HTMLArea</title>
+    <script type="text/javascript">
+      _editor_url = window.opener._editor_url;
+      _editor_lang = window.opener._editor_lang;
+      var BASE = window.opener.document.baseURI || window.opener.document.URL;
+      var head = document.getElementsByTagName("head")[0];
+      var base = document.createElement("base");
+      base.href = BASE;
+      head.appendChild(base);
+    </script>
+
+    <script type="text/javascript" src="../htmlarea.js"></script>
+
+    <script type="text/javascript">
+	// load HTMLArea scripts that are present in the opener frame
+	var scripts = window.opener.HTMLArea._scripts;
+	for (var i = 4; i < scripts.length; ++i) {
+           document.write("<scr" + "ipt type='text/javascript' src='" + scripts[i] + "'></scr" + "ipt>");
+        }
+    </script>
+
+    <!-- browser takes a coffee break here -->
+    <script type="text/javascript">
+var parent_object  = null;
+var editor	   = null;	// to be initialized later [ function init() ]
+
+/* ---------------------------------------------------------------------- *\
+   Function    : 
+   Description : 
+\* ---------------------------------------------------------------------- */
+
+function _CloseOnEsc(ev) {
+	ev || (ev = window.event);
+	if (ev.keyCode == 27) {
+		// update_parent();
+		window.close();
+		return;
+	}
+}
+
+/* ---------------------------------------------------------------------- *\
+   Function    : resize_editor
+   Description : resize the editor when the user resizes the popup
+\* ---------------------------------------------------------------------- */
+
+function resize_editor() {  // resize editor to fix window
+	var newHeight;
+	if (document.all) {
+		// IE
+		newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
+		if (newHeight < 0) { newHeight = 0; }
+	} else {
+		// Gecko
+		newHeight = window.innerHeight - editor._toolbar.offsetHeight;
+	}
+	if (editor.config.statusBar) {
+		newHeight -= editor._statusBar.offsetHeight;
+	}
+	editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";
+}
+
+/* ---------------------------------------------------------------------- *\
+   Function    : init
+   Description : run this code on page load
+\* ---------------------------------------------------------------------- */
+
+function init() {
+	parent_object	   = opener.HTMLArea._object;
+	var config	   = HTMLArea.cloneObject( parent_object.config );
+	config.width	   = "100%";
+	config.height	   = "auto";
+
+	// change maximize button to minimize button
+	config.btnList["popupeditor"] = [ 'Minimize Editor', _editor_url + 'images/fullscreen_minimize.gif', true,
+					  function() { window.close(); } ];
+
+	// generate editor and resize it
+	editor = new HTMLArea("editor", config);
+
+	// register the plugins, if any
+	for (var i in parent_object.plugins) {
+		var plugin = parent_object.plugins[i];
+		editor.registerPlugin2(plugin.name, plugin.args);
+	}
+	// and restore the original toolbar
+        config.toolbar = parent_object.config.toolbar;
+	editor.generate();
+	editor._iframe.style.width = "100%";
+	editor._textArea.style.width = "100%";
+	resize_editor();
+
+	editor.doctype = parent_object.doctype;
+
+	// set child window contents and event handlers, after a small delay
+	setTimeout(function() {
+			   editor.setHTML(parent_object.getInnerHTML());
+
+			   // switch mode if needed
+			   if (parent_object._mode == "textmode") { editor.setMode("textmode"); }
+
+			   // continuously update parent editor window
+			   setInterval(update_parent, 500);
+
+			   // setup event handlers
+			   document.body.onkeypress = _CloseOnEsc;
+			   editor._doc.body.onkeypress = _CloseOnEsc;
+			   editor._textArea.onkeypress = _CloseOnEsc;
+			   window.onresize = resize_editor;
+		   }, 333);			 // give it some time to meet the new frame
+}
+
+/* ---------------------------------------------------------------------- *\
+   Function    : update_parent
+   Description : update parent window editor field with contents from child window
+   \* ---------------------------------------------------------------------- */
+
+function update_parent() {
+	// use the fast version
+	parent_object.setHTML(editor.getInnerHTML());
+}
+
+    </script>
+    <style type="text/css"> html, body { height: 100%; margin: 0px; border: 0px; background-color: buttonface; } </style>
+  </head>
+  <body scroll="no" onload="setTimeout(function(){init();}, 500)" onunload="update_parent()">
+    <form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">
+      <textarea name="editor" id="editor" style="width:100%; height:300px">&nbsp;</textarea>
+    </form>
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/old_insert_image.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/old_insert_image.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/old_insert_image.html	(revision 1328)
@@ -0,0 +1,206 @@
+<!-- based on insimage.dlg -->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
+<HTML  id=dlgImage STYLE="width: 432px; height: 194px; ">
+<HEAD>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="MSThemeCompatible" content="Yes">
+<TITLE>Insert Image</TITLE>
+<style>
+  html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
+</style>
+<SCRIPT defer>
+
+function _CloseOnEsc() {
+  if (event.keyCode == 27) { window.close(); return; }
+}
+
+function _getTextRange(elm) {
+  var r = elm.parentTextEdit.createTextRange();
+  r.moveToElementText(elm);
+  return r;
+}
+
+window.onerror = HandleError
+
+function HandleError(message, url, line) {
+  var str = "An error has occurred in this dialog." + "\n\n"
+  + "Error: " + line + "\n" + message;
+  alert(str);
+  window.close();
+  return true;
+}
+
+function Init() {
+  var elmSelectedImage;
+  var htmlSelectionControl = "Control";
+  var globalDoc = window.dialogArguments;
+  var grngMaster = globalDoc.selection.createRange();
+  
+  // event handlers  
+  document.body.onkeypress = _CloseOnEsc;
+  btnOK.onclick = new Function("btnOKClick()");
+
+  txtFileName.fImageLoaded = false;
+  txtFileName.intImageWidth = 0;
+  txtFileName.intImageHeight = 0;
+
+  if (globalDoc.selection.type == htmlSelectionControl) {
+    if (grngMaster.length == 1) {
+      elmSelectedImage = grngMaster.item(0);
+      if (elmSelectedImage.tagName == "IMG") {
+        txtFileName.fImageLoaded = true;
+        if (elmSelectedImage.src) {
+          txtFileName.value          = elmSelectedImage.src.replace(/^[^*]*(\*\*\*)/, "$1");  // fix placeholder src values that editor converted to abs paths
+          txtFileName.intImageHeight = elmSelectedImage.height;
+          txtFileName.intImageWidth  = elmSelectedImage.width;
+          txtVertical.value          = elmSelectedImage.vspace;
+          txtHorizontal.value        = elmSelectedImage.hspace;
+          txtBorder.value            = elmSelectedImage.border;
+          txtAltText.value           = elmSelectedImage.alt;
+          selAlignment.value         = elmSelectedImage.align;
+        }
+      }
+    }
+  }
+  txtFileName.value = txtFileName.value || "http://";
+  txtFileName.focus();
+}
+
+function _isValidNumber(txtBox) {
+  var val = parseInt(txtBox);
+  if (isNaN(val) || val < 0 || val > 999) { return false; }
+  return true;
+}
+
+function btnOKClick() {
+  var elmImage;
+  var intAlignment;
+  var htmlSelectionControl = "Control";
+  var globalDoc = window.dialogArguments;
+  var grngMaster = globalDoc.selection.createRange();
+  
+  // error checking
+
+  if (!txtFileName.value || txtFileName.value == "http://") { 
+    alert("Image URL must be specified.");
+    txtFileName.focus();
+    return;
+  }
+  if (txtHorizontal.value && !_isValidNumber(txtHorizontal.value)) {
+    alert("Horizontal spacing must be a number between 0 and 999.");
+    txtHorizontal.focus();
+    return;
+  }
+  if (txtBorder.value && !_isValidNumber(txtBorder.value)) {
+    alert("Border thickness must be a number between 0 and 999.");
+    txtBorder.focus();
+    return;
+  }
+  if (txtVertical.value && !_isValidNumber(txtVertical.value)) {
+    alert("Vertical spacing must be a number between 0 and 999.");
+    txtVertical.focus();
+    return;
+  }
+
+  // delete selected content and replace with image
+  if (globalDoc.selection.type == htmlSelectionControl && !txtFileName.fImageLoaded) {
+    grngMaster.execCommand('Delete');
+    grngMaster = globalDoc.selection.createRange();
+  }
+    
+  idstr = "\" id=\"556e697175657e537472696e67";     // new image creation ID
+  if (!txtFileName.fImageLoaded) {
+    grngMaster.execCommand("InsertImage", false, idstr);
+    elmImage = globalDoc.all['556e697175657e537472696e67'];
+    elmImage.removeAttribute("id");
+    elmImage.removeAttribute("src");
+    grngMaster.moveStart("character", -1);
+  } else {
+    elmImage = grngMaster.item(0);
+    if (elmImage.src != txtFileName.value) {
+      grngMaster.execCommand('Delete');
+      grngMaster = globalDoc.selection.createRange();
+      grngMaster.execCommand("InsertImage", false, idstr);
+      elmImage = globalDoc.all['556e697175657e537472696e67'];
+      elmImage.removeAttribute("id");
+      elmImage.removeAttribute("src");
+      grngMaster.moveStart("character", -1);
+      txtFileName.fImageLoaded = false;
+    }
+    grngMaster = _getTextRange(elmImage);
+  }
+
+  if (txtFileName.fImageLoaded) {
+    elmImage.style.width = txtFileName.intImageWidth;
+    elmImage.style.height = txtFileName.intImageHeight;
+  }
+
+  if (txtFileName.value.length > 2040) {
+    txtFileName.value = txtFileName.value.substring(0,2040);
+  }
+  
+  elmImage.src = txtFileName.value;
+  
+  if (txtHorizontal.value != "") { elmImage.hspace = parseInt(txtHorizontal.value); }
+  else                           { elmImage.hspace = 0; }
+
+  if (txtVertical.value != "") { elmImage.vspace = parseInt(txtVertical.value); }
+  else                         { elmImage.vspace = 0; }
+  
+  elmImage.alt = txtAltText.value;
+
+  if (txtBorder.value != "") { elmImage.border = parseInt(txtBorder.value); }
+  else                       { elmImage.border = 0; }
+
+  elmImage.align = selAlignment.value;
+  grngMaster.collapse(false);
+  grngMaster.select();
+  window.close();
+}
+</SCRIPT>
+</HEAD>
+<BODY id=bdy onload="Init()" style="background: threedface; color: windowtext;" scroll=no>
+
+<DIV id=divFileName style="left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; ">Image URL:</DIV>
+<INPUT ID=txtFileName type=text style="left: 8.54em; top: 1.0647em; width: 21.5em;height: 2.1294em; " tabIndex=10 onfocus="select()">
+
+<DIV id=divAltText style="left: 0.98em; top: 4.1067em; width: 6.58em; height: 1.2168em; ">Alternate Text:</DIV>
+<INPUT type=text ID=txtAltText tabIndex=15 style="left: 8.54em; top: 3.8025em; width: 21.5em; height: 2.1294em; " onfocus="select()">
+
+<FIELDSET id=fldLayout style="left: .9em; top: 7.1em; width: 17.08em; height: 7.6em;">
+<LEGEND id=lgdLayout>Layout</LEGEND>
+</FIELDSET>
+
+<FIELDSET id=fldSpacing style="left: 18.9em; top: 7.1em; width: 11em; height: 7.6em;">
+<LEGEND id=lgdSpacing>Spacing</LEGEND>
+</FIELDSET>
+
+<DIV id=divAlign style="left: 1.82em; top: 9.126em; width: 4.76em; height: 1.2168em; ">Alignment:</DIV>
+<SELECT size=1 ID=selAlignment tabIndex=20 style="left: 10.36em; top: 8.8218em; width: 6.72em; height: 1.2168em; ">
+<OPTION id=optNotSet value=""> Not set </OPTION>
+<OPTION id=optLeft value=left> Left </OPTION>
+<OPTION id=optRight value=right> Right </OPTION>
+<OPTION id=optTexttop value=textTop> Texttop </OPTION>
+<OPTION id=optAbsMiddle value=absMiddle> Absmiddle </OPTION>
+<OPTION id=optBaseline value=baseline SELECTED> Baseline </OPTION>
+<OPTION id=optAbsBottom value=absBottom> Absbottom </OPTION>
+<OPTION id=optBottom value=bottom> Bottom </OPTION>
+<OPTION id=optMiddle value=middle> Middle </OPTION>
+<OPTION id=optTop value=top> Top </OPTION>
+</SELECT>
+
+<DIV id=divHoriz style="left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; ">Horizontal:</DIV>
+<INPUT ID=txtHorizontal style="left: 24.92em; top: 8.8218em; width: 4.2em; height: 2.1294em; ime-mode: disabled;" type=text size=3 maxlength=3 value="" tabIndex=25 onfocus="select()">
+
+<DIV id=divBorder style="left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; ">Border Thickness:</DIV>
+<INPUT ID=txtBorder style="left: 10.36em; top: 11.5596em; width: 6.72em; height: 2.1294em; ime-mode: disabled;" type=text size=3 maxlength=3 value="" tabIndex=21 onfocus="select()">
+
+<DIV id=divVert style="left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; ">Vertical:</DIV>
+<INPUT ID=txtVertical style="left: 24.92em; top: 11.5596em; width: 4.2em; height: 2.1294em; ime-mode: disabled;" type=text size=3 maxlength=3 value="" tabIndex=30 onfocus="select()">
+
+<BUTTON ID=btnOK style="left: 31.36em; top: 1.0647em; width: 7em; height: 2.2em; " type=submit tabIndex=40>OK</BUTTON>
+<BUTTON ID=btnCancel style="left: 31.36em; top: 3.6504em; width: 7em; height: 2.2em; " type=reset tabIndex=45 onClick="window.close();">Cancel</BUTTON>
+
+</BODY>
+</HTML>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/insert_image.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/insert_image.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/insert_image.html	(revision 1328)
@@ -0,0 +1,191 @@
+<html>
+
+<head>
+  <title>Insert Image</title>
+
+<script type="text/javascript" src="popup.js"></script>
+
+<script type="text/javascript">
+
+window.resizeTo(400, 100);
+
+function Init() {
+  __dlg_init();
+  var param = window.dialogArguments;
+  if (param) {
+      document.getElementById("f_url").value = param["f_url"];
+      document.getElementById("f_alt").value = param["f_alt"];
+      document.getElementById("f_border").value = param["f_border"];
+      document.getElementById("f_align").value = param["f_align"];
+      document.getElementById("f_vert").value = param["f_vert"];
+      document.getElementById("f_horiz").value = param["f_horiz"];
+      window.ipreview.location.replace(param.f_url);
+  }
+  document.getElementById("f_url").focus();
+};
+
+function onOK() {
+  var required = {
+    "f_url": "You must enter the URL"
+  };
+  for (var i in required) {
+    var el = document.getElementById(i);
+    if (!el.value) {
+      alert(required[i]);
+      el.focus();
+      return false;
+    }
+  }
+  // pass data back to the calling window
+  var fields = ["f_url", "f_alt", "f_align", "f_border",
+                "f_horiz", "f_vert"];
+  var param = new Object();
+  for (var i in fields) {
+    var id = fields[i];
+    var el = document.getElementById(id);
+    param[id] = el.value;
+  }
+  __dlg_close(param);
+  return false;
+};
+
+function onCancel() {
+  __dlg_close(null);
+  return false;
+};
+
+function onPreview() {
+  var f_url = document.getElementById("f_url");
+  var url = f_url.value;
+  if (!url) {
+    alert("You have to enter an URL first");
+    f_url.focus();
+    return false;
+  }
+  window.ipreview.location.replace(url);
+  return false;
+};
+</script>
+
+<style type="text/css">
+html, body {
+  background: ButtonFace;
+  color: ButtonText;
+  font: 11px Tahoma,Verdana,sans-serif;
+  margin: 0px;
+  padding: 0px;
+}
+body { padding: 5px; }
+table {
+  font: 11px Tahoma,Verdana,sans-serif;
+}
+form p {
+  margin-top: 5px;
+  margin-bottom: 5px;
+}
+.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
+.fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
+fieldset { padding: 0px 10px 5px 5px; }
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+button { width: 70px; }
+.space { padding: 2px; }
+
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+border-bottom: 1px solid black; letter-spacing: 2px;
+}
+form { padding: 0px; margin: 0px; }
+</style>
+
+</head>
+
+<body onload="Init()">
+
+<div class="title">Insert Image</div>
+<!--- new stuff --->
+<form action="" method="get">
+<table border="0" width="100%" style="padding: 0px; margin: 0px">
+  <tbody>
+
+  <tr>
+    <td style="width: 7em; text-align: right">Image URL:</td>
+    <td><input type="text" name="url" id="f_url" style="width:75%"
+      title="Enter the image URL here" />
+      <button name="preview" onclick="return onPreview();"
+      title="Preview the image in a new window">Preview</button>
+    </td>
+  </tr>
+  <tr>
+    <td style="width: 7em; text-align: right">Alternate text:</td>
+    <td><input type="text" name="alt" id="f_alt" style="width:100%"
+      title="For browsers that don't support images" /></td>
+  </tr>
+
+  </tbody>
+</table>
+
+<p />
+
+<fieldset style="float: left; margin-left: 5px;">
+<legend>Layout</legend>
+
+<div class="space"></div>
+
+<div class="fl">Alignment:</div>
+<select size="1" name="align" id="f_align"
+  title="Positioning of this image">
+  <option value=""                             >Not set</option>
+  <option value="left"                         >Left</option>
+  <option value="right"                        >Right</option>
+  <option value="texttop"                      >Texttop</option>
+  <option value="absmiddle"                    >Absmiddle</option>
+  <option value="baseline" selected="1"        >Baseline</option>
+  <option value="absbottom"                    >Absbottom</option>
+  <option value="bottom"                       >Bottom</option>
+  <option value="middle"                       >Middle</option>
+  <option value="top"                          >Top</option>
+</select>
+
+<p />
+
+<div class="fl">Border thickness:</div>
+<input type="text" name="border" id="f_border" size="5"
+title="Leave empty for no border" />
+
+<div class="space"></div>
+
+</fieldset>
+
+<fieldset style="float:right; margin-right: 5px;">
+<legend>Spacing</legend>
+
+<div class="space"></div>
+
+<div class="fr">Horizontal:</div>
+<input type="text" name="horiz" id="f_horiz" size="5"
+title="Horizontal padding" />
+
+<p />
+
+<div class="fr">Vertical:</div>
+<input type="text" name="vert" id="f_vert" size="5"
+title="Vertical padding" />
+
+<div class="space"></div>
+
+</fieldset>
+<br clear="all" />
+<table width="100%" style="margin-bottom: 0.2em">
+ <tr>
+  <td valign="bottom">
+    Image Preview:<br />
+    <iframe name="ipreview" id="ipreview" frameborder="0" style="border : 1px solid gray;" height="200" width="300" src=""></iframe>
+  </td>
+  <td valign="bottom" style="text-align: right">
+    <button type="button" name="ok" onclick="return onOK();">OK</button><br>
+    <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+  </td>
+ </tr>
+</table>
+</form>
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/blank.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/blank.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/blank.html	(revision 1328)
@@ -0,0 +1,2 @@
+<html>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/about.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/about.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/about.html	(revision 1328)
@@ -0,0 +1,378 @@
+<!--
+
+(c) dynarch.com, 2003-2004
+Author: Mihai Bazon, http://dynarch.com/mishoo
+Distributed as part of HTMLArea 3.0
+
+"You are not expected to understand this...  I don't neither."
+
+                      (from The Linux Kernel Source Code,
+                            ./arch/x86_64/ia32/ptrace.c:90)
+
+;-)
+
+-->
+
+<html style="height: 100%">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>About HTMLArea</title>
+<script type="text/javascript" src="popup.js"></script>
+<script type="text/javascript">
+window.resizeTo(450, 250);
+var TABS = [];
+var CURRENT_TAB = 0;
+var CONTENT_HEIGHT_DIFF = 0;
+var CONTENT_WIDTH_DIFF = 0;
+function selectTab(idx) {
+  var ct = TABS[CURRENT_TAB];
+  ct.className = ct.className.replace(/\s*tab-current\s*/, ' ');
+  ct = TABS[CURRENT_TAB = idx];
+  ct.className += ' tab-current';
+  for (var i = TABS.length; --i >= 0;) {
+    var area = document.getElementById("tab-area-" + i);
+    if (CURRENT_TAB == i) {
+      area.style.display = "block";
+    } else {
+      area.style.display = "none";
+    }
+  }
+  document.body.style.visibility = "hidden";
+  document.body.style.visibility = "visible";
+  document.cookie = "HTMLAREA-ABOUT-TAB=" + idx;
+}
+var editor = null;
+function initDocument() {
+  editor = window.dialogArguments;
+  HTMLArea = window.opener.HTMLArea;
+
+  var plugins = document.getElementById("plugins");
+  var j = 0;
+  var html = "<table width='99%' cellpadding='0' style='margin-top: 1em; collapse-borders: collapse; border: 1px solid #8b8;'>" +
+	  "<thead><tr>" +
+	  "<td>Name</td>" +
+	  "<td>Developer</td>" +
+	  "<td>Sponsored by</td>" +
+	  "<td>License<sup>*</sup></td>" +
+	  "</tr></thead><tbody>";
+  for (var i in editor.plugins) {
+    var info = editor.plugins[i];
+    html += "<tr><td>" + info.name + " v" + info.version + "</td>" + 
+            "<td><a href='" + info.developer_url + "' target='_blank' title='Visit developer website'>" +
+	    info.developer + "</a></td>" +
+	    "<td><a href='" + info.sponsor_url + "' target='_blank' title='Visit sponsor website'>" +
+	    info.sponsor + "</a></td>" +
+	    "<td>" + info.license + "</td></tr>";
+    ++j;
+  }
+
+  if (j) {
+          html += "</tbody></table>" +
+		  "<p><sup>*</sup> License \"htmlArea\" means that the plugin is distributed under the same terms " +
+		  "as HTMLArea itself.  Such plugins are likely to be those included in the official " +
+		  "HTMLArea distribution</p>";
+	  plugins.innerHTML = "<p>The following plugins have been loaded.</p>" + html;
+  } else {
+	  plugins.innerHTML = "<p>No plugins have been loaded</p>";
+  }
+
+  plugins.innerHTML += "<p>User agent reports:<br/>" + navigator.userAgent + "</p>";
+
+  var content = document.getElementById("content");
+  if (window.innerHeight) {
+    CONTENT_HEIGHT_DIFF = window.innerHeight - 250;
+    CONTENT_WIDTH_DIFF = window.innerWidth - content.offsetWidth;
+  } else {
+    CONTENT_HEIGHT_DIFF = document.body.offsetHeight - 250;
+    CONTENT_WIDTH_DIFF = document.body.offsetWidth - 400;
+  }
+  window.onresize();
+  var bar = document.getElementById("tabbar");
+  j = 0;
+  for (var i = bar.firstChild; i; i = i.nextSibling) {
+    TABS.push(i);
+    i.__msh_tab = j;
+    i.onmousedown = function(ev) { selectTab(this.__msh_tab); HTMLArea._stopEvent(ev || window.event); };
+    var area = document.getElementById("tab-area-" + j);
+    if (/tab-current/.test(i.className)) {
+      CURRENT_TAB = j;
+      area.style.display = "block";
+    } else {
+      area.style.display = "none";
+    }
+    ++j;
+  }
+  if (document.cookie.match(/HTMLAREA-ABOUT-TAB=([0-9]+)/))
+    selectTab(RegExp.$1);
+}
+window.onresize = function() {
+  var content = document.getElementById("content");
+  if (window.innerHeight) {
+    content.style.height = (window.innerHeight - CONTENT_HEIGHT_DIFF) + "px";
+    content.style.width = (window.innerWidth - CONTENT_WIDTH_DIFF) + "px";
+  } else {
+    content.style.height = (document.body.offsetHeight - CONTENT_HEIGHT_DIFF) + "px";
+    //content.style.width = (document.body.offsetWidth - CONTENT_WIDTH_DIFF) + "px";
+  }
+}
+</script>
+<style>
+  html,body,textarea,table { font-family: tahoma,verdana,arial; font-size: 11px;
+padding: 0px; margin: 0px; }
+  tt { font-size: 120%; }
+  body { padding: 0px; background: #cea; color: 000; }
+  a:link, a:visited { color: #00f; }
+  a:hover { color: #f00; }
+  a:active { color: #f80; }
+  button { font: 11px tahoma,verdana,sans-serif; background-color: #cea;
+      border-width: 1px; }
+
+  p { margin: 0.5em 0px; }
+
+  h1 { font: bold 130% georgia,"times new roman",serif; margin: 0px; border-bottom: 1px solid #6a6; }
+  h2 { font: bold 110% georgia,"times new roman",serif; margin: 0.7em 0px; }
+
+  thead {
+    font-weight: bold;
+    background-color: #dfb;
+  }
+
+  .logo, .logo-hover {
+    white-space: nowrap;
+    background-color: #8f4; color: #040; padding: 3px; border-bottom: 1px solid #555;
+    height: 5em;
+  }
+  .logo .brand, .logo-hover .brand {
+    margin-left: 0.5em; margin-right: 0.5em; padding-bottom: 0.1em;
+    font-family: impact,'arial black',arial,sans-serif; font-size: 28px;
+    border-bottom: 1px solid #595; text-align: center;
+    cursor: pointer;
+  }
+  .logo-hover {
+    background-color: #fff;
+  }
+  .logo-hover .brand {
+    color: #800;
+    border-color: #04f;
+  }
+  .logo .letter, .logo-hover .letter { position: relative; font-family: monospace; }
+  .logo .letter1 { top: 0.1em; }
+  .logo .letter2 { top: 0.05em; }
+  .logo .letter3 { top: -0.05em; }
+  .logo .letter4 { top: -0.1em; }
+
+  .logo-hover .letter1 { top: -0.1em; }
+  .logo-hover .letter2 { top: -0.05em; }
+  .logo-hover .letter3 { top: 0.05em; }
+  .logo-hover .letter4 { top: 0.1em; }
+  .logo .version, .logo-hover .version { font-family: georgia,"times new roman",serif; }
+  .logo .release {
+    font-size: 90%; margin-bottom: 1em;
+    text-align: center; color: #484;
+  }
+  .logo .visit { display: none; }
+  .logo-hover .release { display: none; }
+  .logo-hover .visit {
+    font-size: 90%; margin-bottom: 1em;
+    text-align: center; color: #448;
+  }
+  .buttons {
+    text-align: right; padding: 3px; background-color: #8f4;
+    border-top: 1px solid #555;
+  }
+  #tabbar {
+    position: relative;
+    left: 10px;
+  }
+  .tab {
+    color: #454;
+    cursor: pointer;
+    margin-left: -5px;
+    float: left; position: relative;
+    border: 1px solid #555;
+    top: -3px; left: -2px;
+    padding: 2px 10px 3px 10px;
+    border-top: none; background-color: #9b7;
+    -moz-border-radius: 0px 0px 4px 4px;
+    z-index: 0;
+  }
+  .tab-current {
+    color: #000;
+    top: -4px;
+    background-color: #cea;
+    padding: 3px 10px 4px 10px;
+    z-index: 10;
+  }
+  table.sponsors { border-top: 1px solid #aca; }
+  table.sponsors td {
+    border-bottom: 1px solid #aca; vertical-align: top;
+  }
+  table.sponsors tr td { padding: 2px 0px; }
+  table.sponsors tr td.sponsor { text-align: right; padding-right: 0.3em; white-space: nowrap; }
+  li, ol, ul { margin-top: 0px; margin-bottom: 0px; }
+</style></head>
+<body onload="__dlg_init(); initDocument();"
+><table cellspacing="0" cellpadding="0" style="border-collapse: collapse;
+      width: 100%; height: 100%;">
+
+<tr style="height: 1em"><td id="tdheader">
+
+<div class="logo">
+<div class="brand"
+onmouseover="this.parentNode.className='logo-hover';"
+onmouseout="this.parentNode.className='logo';"
+onclick="window.open('http://dynarch.com/htmlarea/');">
+<span class="letter letter1">&lt;H</span><span
+class="letter letter2">T</span><span
+class="letter letter3">M</span><span
+class="letter letter4">L</span>Area <span class="letter">/&gt;</span>
+<span class="version">3.0 <span style="position: relative; top: -0.6em; font-size: 50%; font-weight: normal">[ rev. rc1 ]</span></span></div>
+<div class="release">Compiled on Mar  1, 2004 19:37 GMT</div>
+<div class="visit">Go to http://dynarch.com/htmlarea/ [latest milestone release]</div>
+</div>
+
+</td></tr>
+<tr><td id="tdcontent" style="padding: 0.5em;">
+
+<div style="overflow: auto; height: 250px;" id="content">
+<div id="tab-areas">
+
+<div id="tab-area-0">
+
+  <h1>HTMLArea</h1>
+  
+  <p>A free WYSIWYG editor replacement for <tt>&lt;textarea&gt;</tt> fields.<br />
+  For Mozilla 1.3+ (any platform) or Internet Explorer 5.5+ (Windows).
+  </p>
+
+  <p style="text-align: center"
+  >&copy; 2002-2004 <a href="http://interactivetools.com" target="_blank">interactivetools.com</a>, inc.<br />
+  &copy; 2003-2004 <a href="http://dynarch.com" target="_blank">dynarch.com</a> LLC.<br />
+  All Rights Reserved.</p>
+
+  <h2>Project resources</h2>
+
+  <ul>
+  <li><a href="http://sourceforge.net/projects/itools-htmlarea/" target="_blank"
+  >Project page</a> (@ sourceforge.net)</li>
+  <li><a href="http://sourceforge.net/cvs/?group_id=69750" target="_blank"
+  >Anonymous CVS access</a> (@ sourceforge.net)</li>
+  <li><a href="http://sourceforge.net/tracker/?atid=525656&group_id=69750&func=browse" target="_blank"
+  >Bug system</a> (@ sourceforge.net)</li>
+  <li><a href="http://www.interactivetools.com/forum/gforum.cgi?forum=14;" target="_blank"
+  >Forum</a> (@ interactivetools.com)</li>
+  <li><a href="http://www.dynarch.com/htmlarea/" target="_blank"
+  >Last public release</a> (@ dynarch.com)</li>
+  </ul>
+
+  <p>
+  For download section please see the <a href="http://sourceforge.net/projects/itools-htmlarea/" target="_blank"
+  >project page @ SourceForge</a>.
+  </p>
+
+<p style="margin-top: 1em; text-align: center;">Version 3.0 developed and maintained by <a
+href="http://dynarch.com/mishoo/" title="http://dynarch.com/mishoo/" target="_blank">Mihai Bazon</a> / <a
+href="http://dynarch.com" title="http://dynarch.com/" target="_blank">dynarch.com</a></p>
+
+</div>
+
+<div id="tab-area-1">
+<h1>Thank you</h1>
+
+  <p>
+  <a href="http://dynarch.com" target="_blank">dynarch.com</a> would like to thank the following
+  companies/persons for their <em>donations</em> to support development of HTMLArea (listed alphabetically):
+  </p>
+
+  <ul>
+    <li><a href="http://www.neomedia.ro">Neomedia</a> (Romania)</li>
+    <li><a href="http://www.os3.it" target="_blank">OS3</a> (Italy)</li>
+    <li><a href="http://www.softwerk.net">SoftWerk</a> (Italy)</li>
+  </ul>
+
+  <p>Also many thanks to all people at InteractiveTools.com
+  <a href="http://www.interactivetools.com/forum/gforum.cgi?forum=14;">HTMLArea forums</a> for
+  contributing translations, feedback, bug reports and fixes.</p>
+
+  <p>
+  Last but not least, this project wouldn't have existed without
+  <a href="http://interactivetools.com" target="_blank">InteractiveTools.com</a>.
+  </p>
+
+</div>
+
+<div id="tab-area-2">
+<h1>htmlArea License (based on BSD license)</h1>
+
+<p style="text-align: center">© 2002-2004, interactivetools.com, inc.<br />
+  © 2003-2004 dynarch.com LLC<br />
+  All rights reserved.</p>
+
+<p>
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+</p>
+
+<ol>
+<li>
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+</li>
+
+<li>
+Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+</li>
+
+<li>
+Neither the name of interactivetools.com, inc. nor the names of its
+contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+</li>
+</ol>
+
+<p>
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+</p>
+
+</div>
+
+<div id="tab-area-3">
+<h1>Plugins</h1>
+<div id="plugins">
+</div>
+</div>
+
+</div></div>
+
+
+</tr></td>
+<tr style="height: 1em"><td id="tdfooter">
+
+
+<div class="buttons">
+<div id="tabbar"
+><div class="tab tab-current"
+>About</div><div class="tab"
+>Thanks</div><div class="tab"
+>License</div><div class="tab"
+>Plugins</div></div>
+<button type="button" onclick="__dlg_close(null);">I agree it's cool</button>
+</div>
+
+</td></tr></table>
+
+</body></html>
+
+
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/insert_table.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/insert_table.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/insert_table.html	(revision 1328)
@@ -0,0 +1,174 @@
+<html>
+
+<head>
+  <title>Insert Table</title>
+
+<script type="text/javascript" src="popup.js"></script>
+
+<script type="text/javascript">
+
+window.resizeTo(400, 100);
+
+function Init() {
+  __dlg_init();
+  document.getElementById("f_rows").focus();
+};
+
+function onOK() {
+  var required = {
+    "f_rows": "You must enter a number of rows",
+    "f_cols": "You must enter a number of columns"
+  };
+  for (var i in required) {
+    var el = document.getElementById(i);
+    if (!el.value) {
+      alert(required[i]);
+      el.focus();
+      return false;
+    }
+  }
+  var fields = ["f_rows", "f_cols", "f_width", "f_unit",
+                "f_align", "f_border", "f_spacing", "f_padding"];
+  var param = new Object();
+  for (var i in fields) {
+    var id = fields[i];
+    var el = document.getElementById(id);
+    param[id] = el.value;
+  }
+  __dlg_close(param);
+  return false;
+};
+
+function onCancel() {
+  __dlg_close(null);
+  return false;
+};
+
+</script>
+
+<style type="text/css">
+html, body {
+  background: ButtonFace;
+  color: ButtonText;
+  font: 11px Tahoma,Verdana,sans-serif;
+  margin: 0px;
+  padding: 0px;
+}
+body { padding: 5px; }
+table {
+  font: 11px Tahoma,Verdana,sans-serif;
+}
+form p {
+  margin-top: 5px;
+  margin-bottom: 5px;
+}
+.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
+.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
+fieldset { padding: 0px 10px 5px 5px; }
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+button { width: 70px; }
+.space { padding: 2px; }
+
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+border-bottom: 1px solid black; letter-spacing: 2px;
+}
+form { padding: 0px; margin: 0px; }
+</style>
+
+</head>
+
+<body onload="Init()">
+
+<div class="title">Insert Table</div>
+
+<form action="" method="get">
+<table border="0" style="padding: 0px; margin: 0px">
+  <tbody>
+
+  <tr>
+    <td style="width: 4em; text-align: right">Rows:</td>
+    <td><input type="text" name="rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>
+    <td></td>
+    <td></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td style="width: 4em; text-align: right">Cols:</td>
+    <td><input type="text" name="cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>
+    <td style="width: 4em; text-align: right">Width:</td>
+    <td><input type="text" name="width" id="f_width" size="5" title="Width of the table" value="100" /></td>
+    <td><select size="1" name="unit" id="f_unit" title="Width unit">
+      <option value="%" selected="1"  >Percent</option>
+      <option value="px"              >Pixels</option>
+      <option value="em"              >Em</option>
+    </select></td>
+  </tr>
+
+  </tbody>
+</table>
+
+<p />
+
+<fieldset style="float: left; margin-left: 5px;">
+<legend>Layout</legend>
+
+<div class="space"></div>
+
+<div class="fl">Alignment:</div>
+<select size="1" name="align" id="f_align"
+  title="Positioning of this image">
+  <option value="" selected="1"                >Not set</option>
+  <option value="left"                         >Left</option>
+  <option value="right"                        >Right</option>
+  <option value="texttop"                      >Texttop</option>
+  <option value="absmiddle"                    >Absmiddle</option>
+  <option value="baseline"                     >Baseline</option>
+  <option value="absbottom"                    >Absbottom</option>
+  <option value="bottom"                       >Bottom</option>
+  <option value="middle"                       >Middle</option>
+  <option value="top"                          >Top</option>
+</select>
+
+<p />
+
+<div class="fl">Border thickness:</div>
+<input type="text" name="border" id="f_border" size="5" value="1"
+title="Leave empty for no border" />
+<!--
+<p />
+
+<div class="fl">Collapse borders:</div>
+<input type="checkbox" name="collapse" id="f_collapse" />
+-->
+<div class="space"></div>
+
+</fieldset>
+
+<fieldset style="float:right; margin-right: 5px;">
+<legend>Spacing</legend>
+
+<div class="space"></div>
+
+<div class="fr">Cell spacing:</div>
+<input type="text" name="spacing" id="f_spacing" size="5" value="1"
+title="Space between adjacent cells" />
+
+<p />
+
+<div class="fr">Cell padding:</div>
+<input type="text" name="padding" id="f_padding" size="5" value="1"
+title="Space between content and border in cell" />
+
+<div class="space"></div>
+
+</fieldset>
+
+<div style="margin-top: 85px; border-top: 1px solid #999; padding: 2px; text-align: right;">
+<button type="button" name="ok" onclick="return onOK();">OK</button>
+<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+</div>
+
+</form>
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/popup.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/popup.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/popup.js	(revision 1328)
@@ -0,0 +1,109 @@
+// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
+// This copyright notice MUST stay intact for use (see license.txt).
+//
+// Portions (c) dynarch.com, 2003
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon.
+//   http://dynarch.com/mishoo
+//
+// $Id$
+
+function getAbsolutePos(el) {
+	var r = { x: el.offsetLeft, y: el.offsetTop };
+	if (el.offsetParent) {
+		var tmp = getAbsolutePos(el.offsetParent);
+		r.x += tmp.x;
+		r.y += tmp.y;
+	}
+	return r;
+};
+
+function comboSelectValue(c, val) {
+	var ops = c.getElementsByTagName("option");
+	for (var i = ops.length; --i >= 0;) {
+		var op = ops[i];
+		op.selected = (op.value == val);
+	}
+	c.value = val;
+};
+
+function __dlg_onclose() {
+	opener.Dialog._return(null);
+};
+
+function __dlg_init(bottom) {
+	var body = document.body;
+	var body_height = 0;
+	if (typeof bottom == "undefined") {
+		var div = document.createElement("div");
+		body.appendChild(div);
+		var pos = getAbsolutePos(div);
+		body_height = pos.y;
+	} else {
+		var pos = getAbsolutePos(bottom);
+		body_height = pos.y + bottom.offsetHeight;
+	}
+	window.dialogArguments = opener.Dialog._arguments;
+	if (!document.all) {
+		window.sizeToContent();
+		window.sizeToContent();	// for reasons beyond understanding,
+					// only if we call it twice we get the
+					// correct size.
+		window.addEventListener("unload", __dlg_onclose, true);
+		// center on parent
+		var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
+		var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
+		window.moveTo(x, y);
+		window.innerWidth = body.offsetWidth + 5;
+		window.innerHeight = body_height + 2;
+	} else {
+		// window.dialogHeight = body.offsetHeight + 50 + "px";
+		// window.dialogWidth = body.offsetWidth + "px";
+		window.resizeTo(body.offsetWidth, body_height);
+		var ch = body.clientHeight;
+		var cw = body.clientWidth;
+		window.resizeBy(body.offsetWidth - cw, body_height - ch);
+		var W = body.offsetWidth;
+		var H = 2 * body_height - ch;
+		var x = (screen.availWidth - W) / 2;
+		var y = (screen.availHeight - H) / 2;
+		window.moveTo(x, y);
+	}
+	document.body.onkeypress = __dlg_close_on_esc;
+};
+
+function __dlg_translate(i18n) {
+	var types = ["span", "option", "td", "button", "div"];
+	for (var type in types) {
+		var spans = document.getElementsByTagName(types[type]);
+		for (var i = spans.length; --i >= 0;) {
+			var span = spans[i];
+			if (span.firstChild && span.firstChild.data) {
+				var txt = i18n[span.firstChild.data];
+				if (txt)
+					span.firstChild.data = txt;
+			}
+		}
+	}
+	var txt = i18n[document.title];
+	if (txt)
+		document.title = txt;
+};
+
+// closes the dialog and passes the return info upper.
+function __dlg_close(val) {
+	opener.Dialog._return(val);
+	window.close();
+};
+
+function __dlg_close_on_esc(ev) {
+	ev || (ev = window.event);
+	if (ev.keyCode == 27) {
+		window.close();
+		return false;
+	}
+	return true;
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/custom2.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/custom2.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/custom2.html	(revision 1328)
@@ -0,0 +1,35 @@
+<html style="width:300px; Height: 60px;">
+ <head>
+  <title>Select Phrase</title>
+<script language="javascript">
+
+var myTitle = window.dialogArguments;
+document.title = myTitle;
+
+
+function returnSelected() {
+  var idx  = document.all.textPulldown.selectedIndex;
+  var text = document.all.textPulldown[idx].text;
+
+  window.returnValue = text;          // set return value
+  window.close();                     // close dialog
+}
+
+</script>
+</head>
+<body bgcolor="#FFFFFF" topmargin=15 leftmargin=0>
+
+<form method=get onSubmit="Set(document.all.ColorHex.value); return false;">
+<div align=center>
+
+<select name="textPulldown">
+<option>The quick brown</option>
+<option>fox jumps over</option>
+<option>the lazy dog.</option>
+</select>
+
+<input type="button" value=" Go " onClick="returnSelected()">
+
+</div>
+</form>
+</body></html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/link.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/link.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/link.html	(revision 1328)
@@ -0,0 +1,142 @@
+<html>
+
+<head>
+  <title>Insert/Modify Link</title>
+  <script type="text/javascript" src="popup.js"></script>
+  <script type="text/javascript">
+    window.resizeTo(400, 200);
+
+I18N = window.opener.HTMLArea.I18N.dialogs;
+
+function i18n(str) {
+  return (I18N[str] || str);
+};
+
+function onTargetChanged() {
+  var f = document.getElementById("f_other_target");
+  if (this.value == "_other") {
+    f.style.visibility = "visible";
+    f.select();
+    f.focus();
+  } else f.style.visibility = "hidden";
+};
+
+function Init() {
+  __dlg_translate(I18N);
+  __dlg_init();
+  var param = window.dialogArguments;
+  var target_select = document.getElementById("f_target");
+  if (param) {
+      document.getElementById("f_href").value = param["f_href"];
+      document.getElementById("f_title").value = param["f_title"];
+      comboSelectValue(target_select, param["f_target"]);
+      if (target_select.value != param.f_target) {
+        var opt = document.createElement("option");
+        opt.value = param.f_target;
+        opt.innerHTML = opt.value;
+        target_select.appendChild(opt);
+        opt.selected = true;
+      }
+  }
+  var opt = document.createElement("option");
+  opt.value = "_other";
+  opt.innerHTML = i18n("Other");
+  target_select.appendChild(opt);
+  target_select.onchange = onTargetChanged;
+  document.getElementById("f_href").focus();
+  document.getElementById("f_href").select();
+};
+
+function onOK() {
+  var required = {
+    "f_href": i18n("You must enter the URL where this link points to")
+  };
+  for (var i in required) {
+    var el = document.getElementById(i);
+    if (!el.value) {
+      alert(required[i]);
+      el.focus();
+      return false;
+    }
+  }
+  // pass data back to the calling window
+  var fields = ["f_href", "f_title", "f_target" ];
+  var param = new Object();
+  for (var i in fields) {
+    var id = fields[i];
+    var el = document.getElementById(id);
+    param[id] = el.value;
+  }
+  if (param.f_target == "_other")
+    param.f_target = document.getElementById("f_other_target").value;
+  __dlg_close(param);
+  return false;
+};
+
+function onCancel() {
+  __dlg_close(null);
+  return false;
+};
+
+</script>
+
+<style type="text/css">
+html, body {
+  background: ButtonFace;
+  color: ButtonText;
+  font: 11px Tahoma,Verdana,sans-serif;
+  margin: 0px;
+  padding: 0px;
+}
+body { padding: 5px; }
+table {
+  font: 11px Tahoma,Verdana,sans-serif;
+}
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+button { width: 70px; }
+table .label { text-align: right; width: 8em; }
+
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+border-bottom: 1px solid black; letter-spacing: 2px;
+}
+
+#buttons {
+      margin-top: 1em; border-top: 1px solid #999;
+      padding: 2px; text-align: right;
+}
+</style>
+
+</head>
+
+<body onload="Init()">
+<div class="title">Insert/Modify Link</div>
+
+<table border="0" style="width: 100%;">
+  <tr>
+    <td class="label">URL:</td>
+    <td><input type="text" id="f_href" style="width: 100%" /></td>
+  </tr>
+  <tr>
+    <td class="label">Title (tooltip):</td>
+    <td><input type="text" id="f_title" style="width: 100%" /></td>
+  </tr>
+  <tr>
+    <td class="label">Target:</td>
+    <td><select id="f_target">
+      <option value="">None (use implicit)</option>
+      <option value="_blank">New window (_blank)</option>
+      <option value="_self">Same frame (_self)</option>
+      <option value="_top">Top frame (_top)</option>
+    </select>
+    <input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
+    </td>
+  </tr>
+</table>
+
+<div id="buttons">
+  <button type="button" name="ok" onclick="return onOK();">OK</button>
+  <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+</div>
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/select_color.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/select_color.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/select_color.html	(revision 1328)
@@ -0,0 +1,347 @@
+<!-- note: this version of the color picker is optimized for IE 5.5+ only -->
+
+<html><head><title>Select Color</title>
+
+<script type="text/javascript" src="popup.js"></script>
+
+<script type="text/javascript">
+
+window.resizeTo(240, 182);
+function _CloseOnEsc() {
+  if (event.keyCode == 27) { window.close(); return; }
+}
+
+function Init() {                                                       // run on page load
+  __dlg_init();    // <!-- this can be found in popup.js -->
+  document.body.onkeypress = _CloseOnEsc;
+
+  var color = window.dialogArguments;
+  color = ValidateColor(color) || '000000';
+  View(color);                                                          // set default color
+}
+
+function View(color) {                  // preview color
+  document.getElementById("ColorPreview").style.backgroundColor = '#' + color;
+  document.getElementById("ColorHex").value = '#' + color;
+}
+
+function Set(string) {                   // select color
+  var color = ValidateColor(string);
+  if (color == null) { alert("Invalid color code: " + string); }        // invalid color
+  else {                                                                // valid color
+    View(color);                          // show selected color
+    __dlg_close(color);
+  }
+}
+
+function ValidateColor(string) {                // return valid color code
+  string = string || '';
+  string = string + "";
+  string = string.toUpperCase();
+  var chars = '0123456789ABCDEF';
+  var out   = '';
+
+  for (var i=0; i<string.length; i++) {             // remove invalid color chars
+    var schar = string.charAt(i);
+    if (chars.indexOf(schar) != -1) { out += schar; }
+  }
+
+  if (out.length != 6) { return null; }            // check length
+  return out;
+}
+
+</script>
+</head>
+<body style="background:ButtonFace; margin:0px; padding:0px" onload="Init()">
+
+<form method="get" style="margin:0px; padding:0px" onSubmit="Set(document.getElementById('ColorHex').value); return false;">
+<table border="0px" cellspacing="0px" cellpadding="4" width="100%">
+ <tr>
+  <td style="background:buttonface" valign=center><div style="background-color: #000000; padding: 1; height: 21px; width: 50px"><div id="ColorPreview" style="height: 100%; width: 100%"></div></div></td>
+  <td style="background:buttonface" valign=center><input type="text" name="ColorHex"
+    id="ColorHex" value="" size=15 style="font-size: 12px"></td>
+  <td style="background:buttonface" width=100%></td>
+ </tr>
+</table>
+</form>
+
+<table border="0" cellspacing="1px" cellpadding="0px" width="100%" bgcolor="#000000" style="cursor: hand;">
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#003300 onMouseOver=View('003300') onClick=Set('003300') height="10px" width="10px"></td>
+<td bgcolor=#006600 onMouseOver=View('006600') onClick=Set('006600') height="10px" width="10px"></td>
+<td bgcolor=#009900 onMouseOver=View('009900') onClick=Set('009900') height="10px" width="10px"></td>
+<td bgcolor=#00CC00 onMouseOver=View('00CC00') onClick=Set('00CC00') height="10px" width="10px"></td>
+<td bgcolor=#00FF00 onMouseOver=View('00FF00') onClick=Set('00FF00') height="10px" width="10px"></td>
+<td bgcolor=#330000 onMouseOver=View('330000') onClick=Set('330000') height="10px" width="10px"></td>
+<td bgcolor=#333300 onMouseOver=View('333300') onClick=Set('333300') height="10px" width="10px"></td>
+<td bgcolor=#336600 onMouseOver=View('336600') onClick=Set('336600') height="10px" width="10px"></td>
+<td bgcolor=#339900 onMouseOver=View('339900') onClick=Set('339900') height="10px" width="10px"></td>
+<td bgcolor=#33CC00 onMouseOver=View('33CC00') onClick=Set('33CC00') height="10px" width="10px"></td>
+<td bgcolor=#33FF00 onMouseOver=View('33FF00') onClick=Set('33FF00') height="10px" width="10px"></td>
+<td bgcolor=#660000 onMouseOver=View('660000') onClick=Set('660000') height="10px" width="10px"></td>
+<td bgcolor=#663300 onMouseOver=View('663300') onClick=Set('663300') height="10px" width="10px"></td>
+<td bgcolor=#666600 onMouseOver=View('666600') onClick=Set('666600') height="10px" width="10px"></td>
+<td bgcolor=#669900 onMouseOver=View('669900') onClick=Set('669900') height="10px" width="10px"></td>
+<td bgcolor=#66CC00 onMouseOver=View('66CC00') onClick=Set('66CC00') height="10px" width="10px"></td>
+<td bgcolor=#66FF00 onMouseOver=View('66FF00') onClick=Set('66FF00') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#333333 onMouseOver=View('333333') onClick=Set('333333') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#000033 onMouseOver=View('000033') onClick=Set('000033') height="10px" width="10px"></td>
+<td bgcolor=#003333 onMouseOver=View('003333') onClick=Set('003333') height="10px" width="10px"></td>
+<td bgcolor=#006633 onMouseOver=View('006633') onClick=Set('006633') height="10px" width="10px"></td>
+<td bgcolor=#009933 onMouseOver=View('009933') onClick=Set('009933') height="10px" width="10px"></td>
+<td bgcolor=#00CC33 onMouseOver=View('00CC33') onClick=Set('00CC33') height="10px" width="10px"></td>
+<td bgcolor=#00FF33 onMouseOver=View('00FF33') onClick=Set('00FF33') height="10px" width="10px"></td>
+<td bgcolor=#330033 onMouseOver=View('330033') onClick=Set('330033') height="10px" width="10px"></td>
+<td bgcolor=#333333 onMouseOver=View('333333') onClick=Set('333333') height="10px" width="10px"></td>
+<td bgcolor=#336633 onMouseOver=View('336633') onClick=Set('336633') height="10px" width="10px"></td>
+<td bgcolor=#339933 onMouseOver=View('339933') onClick=Set('339933') height="10px" width="10px"></td>
+<td bgcolor=#33CC33 onMouseOver=View('33CC33') onClick=Set('33CC33') height="10px" width="10px"></td>
+<td bgcolor=#33FF33 onMouseOver=View('33FF33') onClick=Set('33FF33') height="10px" width="10px"></td>
+<td bgcolor=#660033 onMouseOver=View('660033') onClick=Set('660033') height="10px" width="10px"></td>
+<td bgcolor=#663333 onMouseOver=View('663333') onClick=Set('663333') height="10px" width="10px"></td>
+<td bgcolor=#666633 onMouseOver=View('666633') onClick=Set('666633') height="10px" width="10px"></td>
+<td bgcolor=#669933 onMouseOver=View('669933') onClick=Set('669933') height="10px" width="10px"></td>
+<td bgcolor=#66CC33 onMouseOver=View('66CC33') onClick=Set('66CC33') height="10px" width="10px"></td>
+<td bgcolor=#66FF33 onMouseOver=View('66FF33') onClick=Set('66FF33') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#666666 onMouseOver=View('666666') onClick=Set('666666') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#000066 onMouseOver=View('000066') onClick=Set('000066') height="10px" width="10px"></td>
+<td bgcolor=#003366 onMouseOver=View('003366') onClick=Set('003366') height="10px" width="10px"></td>
+<td bgcolor=#006666 onMouseOver=View('006666') onClick=Set('006666') height="10px" width="10px"></td>
+<td bgcolor=#009966 onMouseOver=View('009966') onClick=Set('009966') height="10px" width="10px"></td>
+<td bgcolor=#00CC66 onMouseOver=View('00CC66') onClick=Set('00CC66') height="10px" width="10px"></td>
+<td bgcolor=#00FF66 onMouseOver=View('00FF66') onClick=Set('00FF66') height="10px" width="10px"></td>
+<td bgcolor=#330066 onMouseOver=View('330066') onClick=Set('330066') height="10px" width="10px"></td>
+<td bgcolor=#333366 onMouseOver=View('333366') onClick=Set('333366') height="10px" width="10px"></td>
+<td bgcolor=#336666 onMouseOver=View('336666') onClick=Set('336666') height="10px" width="10px"></td>
+<td bgcolor=#339966 onMouseOver=View('339966') onClick=Set('339966') height="10px" width="10px"></td>
+<td bgcolor=#33CC66 onMouseOver=View('33CC66') onClick=Set('33CC66') height="10px" width="10px"></td>
+<td bgcolor=#33FF66 onMouseOver=View('33FF66') onClick=Set('33FF66') height="10px" width="10px"></td>
+<td bgcolor=#660066 onMouseOver=View('660066') onClick=Set('660066') height="10px" width="10px"></td>
+<td bgcolor=#663366 onMouseOver=View('663366') onClick=Set('663366') height="10px" width="10px"></td>
+<td bgcolor=#666666 onMouseOver=View('666666') onClick=Set('666666') height="10px" width="10px"></td>
+<td bgcolor=#669966 onMouseOver=View('669966') onClick=Set('669966') height="10px" width="10px"></td>
+<td bgcolor=#66CC66 onMouseOver=View('66CC66') onClick=Set('66CC66') height="10px" width="10px"></td>
+<td bgcolor=#66FF66 onMouseOver=View('66FF66') onClick=Set('66FF66') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#999999 onMouseOver=View('999999') onClick=Set('999999') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#000099 onMouseOver=View('000099') onClick=Set('000099') height="10px" width="10px"></td>
+<td bgcolor=#003399 onMouseOver=View('003399') onClick=Set('003399') height="10px" width="10px"></td>
+<td bgcolor=#006699 onMouseOver=View('006699') onClick=Set('006699') height="10px" width="10px"></td>
+<td bgcolor=#009999 onMouseOver=View('009999') onClick=Set('009999') height="10px" width="10px"></td>
+<td bgcolor=#00CC99 onMouseOver=View('00CC99') onClick=Set('00CC99') height="10px" width="10px"></td>
+<td bgcolor=#00FF99 onMouseOver=View('00FF99') onClick=Set('00FF99') height="10px" width="10px"></td>
+<td bgcolor=#330099 onMouseOver=View('330099') onClick=Set('330099') height="10px" width="10px"></td>
+<td bgcolor=#333399 onMouseOver=View('333399') onClick=Set('333399') height="10px" width="10px"></td>
+<td bgcolor=#336699 onMouseOver=View('336699') onClick=Set('336699') height="10px" width="10px"></td>
+<td bgcolor=#339999 onMouseOver=View('339999') onClick=Set('339999') height="10px" width="10px"></td>
+<td bgcolor=#33CC99 onMouseOver=View('33CC99') onClick=Set('33CC99') height="10px" width="10px"></td>
+<td bgcolor=#33FF99 onMouseOver=View('33FF99') onClick=Set('33FF99') height="10px" width="10px"></td>
+<td bgcolor=#660099 onMouseOver=View('660099') onClick=Set('660099') height="10px" width="10px"></td>
+<td bgcolor=#663399 onMouseOver=View('663399') onClick=Set('663399') height="10px" width="10px"></td>
+<td bgcolor=#666699 onMouseOver=View('666699') onClick=Set('666699') height="10px" width="10px"></td>
+<td bgcolor=#669999 onMouseOver=View('669999') onClick=Set('669999') height="10px" width="10px"></td>
+<td bgcolor=#66CC99 onMouseOver=View('66CC99') onClick=Set('66CC99') height="10px" width="10px"></td>
+<td bgcolor=#66FF99 onMouseOver=View('66FF99') onClick=Set('66FF99') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#CCCCCC onMouseOver=View('CCCCCC') onClick=Set('CCCCCC') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#0000CC onMouseOver=View('0000CC') onClick=Set('0000CC') height="10px" width="10px"></td>
+<td bgcolor=#0033CC onMouseOver=View('0033CC') onClick=Set('0033CC') height="10px" width="10px"></td>
+<td bgcolor=#0066CC onMouseOver=View('0066CC') onClick=Set('0066CC') height="10px" width="10px"></td>
+<td bgcolor=#0099CC onMouseOver=View('0099CC') onClick=Set('0099CC') height="10px" width="10px"></td>
+<td bgcolor=#00CCCC onMouseOver=View('00CCCC') onClick=Set('00CCCC') height="10px" width="10px"></td>
+<td bgcolor=#00FFCC onMouseOver=View('00FFCC') onClick=Set('00FFCC') height="10px" width="10px"></td>
+<td bgcolor=#3300CC onMouseOver=View('3300CC') onClick=Set('3300CC') height="10px" width="10px"></td>
+<td bgcolor=#3333CC onMouseOver=View('3333CC') onClick=Set('3333CC') height="10px" width="10px"></td>
+<td bgcolor=#3366CC onMouseOver=View('3366CC') onClick=Set('3366CC') height="10px" width="10px"></td>
+<td bgcolor=#3399CC onMouseOver=View('3399CC') onClick=Set('3399CC') height="10px" width="10px"></td>
+<td bgcolor=#33CCCC onMouseOver=View('33CCCC') onClick=Set('33CCCC') height="10px" width="10px"></td>
+<td bgcolor=#33FFCC onMouseOver=View('33FFCC') onClick=Set('33FFCC') height="10px" width="10px"></td>
+<td bgcolor=#6600CC onMouseOver=View('6600CC') onClick=Set('6600CC') height="10px" width="10px"></td>
+<td bgcolor=#6633CC onMouseOver=View('6633CC') onClick=Set('6633CC') height="10px" width="10px"></td>
+<td bgcolor=#6666CC onMouseOver=View('6666CC') onClick=Set('6666CC') height="10px" width="10px"></td>
+<td bgcolor=#6699CC onMouseOver=View('6699CC') onClick=Set('6699CC') height="10px" width="10px"></td>
+<td bgcolor=#66CCCC onMouseOver=View('66CCCC') onClick=Set('66CCCC') height="10px" width="10px"></td>
+<td bgcolor=#66FFCC onMouseOver=View('66FFCC') onClick=Set('66FFCC') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#FFFFFF onMouseOver=View('FFFFFF') onClick=Set('FFFFFF') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#0000FF onMouseOver=View('0000FF') onClick=Set('0000FF') height="10px" width="10px"></td>
+<td bgcolor=#0033FF onMouseOver=View('0033FF') onClick=Set('0033FF') height="10px" width="10px"></td>
+<td bgcolor=#0066FF onMouseOver=View('0066FF') onClick=Set('0066FF') height="10px" width="10px"></td>
+<td bgcolor=#0099FF onMouseOver=View('0099FF') onClick=Set('0099FF') height="10px" width="10px"></td>
+<td bgcolor=#00CCFF onMouseOver=View('00CCFF') onClick=Set('00CCFF') height="10px" width="10px"></td>
+<td bgcolor=#00FFFF onMouseOver=View('00FFFF') onClick=Set('00FFFF') height="10px" width="10px"></td>
+<td bgcolor=#3300FF onMouseOver=View('3300FF') onClick=Set('3300FF') height="10px" width="10px"></td>
+<td bgcolor=#3333FF onMouseOver=View('3333FF') onClick=Set('3333FF') height="10px" width="10px"></td>
+<td bgcolor=#3366FF onMouseOver=View('3366FF') onClick=Set('3366FF') height="10px" width="10px"></td>
+<td bgcolor=#3399FF onMouseOver=View('3399FF') onClick=Set('3399FF') height="10px" width="10px"></td>
+<td bgcolor=#33CCFF onMouseOver=View('33CCFF') onClick=Set('33CCFF') height="10px" width="10px"></td>
+<td bgcolor=#33FFFF onMouseOver=View('33FFFF') onClick=Set('33FFFF') height="10px" width="10px"></td>
+<td bgcolor=#6600FF onMouseOver=View('6600FF') onClick=Set('6600FF') height="10px" width="10px"></td>
+<td bgcolor=#6633FF onMouseOver=View('6633FF') onClick=Set('6633FF') height="10px" width="10px"></td>
+<td bgcolor=#6666FF onMouseOver=View('6666FF') onClick=Set('6666FF') height="10px" width="10px"></td>
+<td bgcolor=#6699FF onMouseOver=View('6699FF') onClick=Set('6699FF') height="10px" width="10px"></td>
+<td bgcolor=#66CCFF onMouseOver=View('66CCFF') onClick=Set('66CCFF') height="10px" width="10px"></td>
+<td bgcolor=#66FFFF onMouseOver=View('66FFFF') onClick=Set('66FFFF') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#FF0000 onMouseOver=View('FF0000') onClick=Set('FF0000') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#990000 onMouseOver=View('990000') onClick=Set('990000') height="10px" width="10px"></td>
+<td bgcolor=#993300 onMouseOver=View('993300') onClick=Set('993300') height="10px" width="10px"></td>
+<td bgcolor=#996600 onMouseOver=View('996600') onClick=Set('996600') height="10px" width="10px"></td>
+<td bgcolor=#999900 onMouseOver=View('999900') onClick=Set('999900') height="10px" width="10px"></td>
+<td bgcolor=#99CC00 onMouseOver=View('99CC00') onClick=Set('99CC00') height="10px" width="10px"></td>
+<td bgcolor=#99FF00 onMouseOver=View('99FF00') onClick=Set('99FF00') height="10px" width="10px"></td>
+<td bgcolor=#CC0000 onMouseOver=View('CC0000') onClick=Set('CC0000') height="10px" width="10px"></td>
+<td bgcolor=#CC3300 onMouseOver=View('CC3300') onClick=Set('CC3300') height="10px" width="10px"></td>
+<td bgcolor=#CC6600 onMouseOver=View('CC6600') onClick=Set('CC6600') height="10px" width="10px"></td>
+<td bgcolor=#CC9900 onMouseOver=View('CC9900') onClick=Set('CC9900') height="10px" width="10px"></td>
+<td bgcolor=#CCCC00 onMouseOver=View('CCCC00') onClick=Set('CCCC00') height="10px" width="10px"></td>
+<td bgcolor=#CCFF00 onMouseOver=View('CCFF00') onClick=Set('CCFF00') height="10px" width="10px"></td>
+<td bgcolor=#FF0000 onMouseOver=View('FF0000') onClick=Set('FF0000') height="10px" width="10px"></td>
+<td bgcolor=#FF3300 onMouseOver=View('FF3300') onClick=Set('FF3300') height="10px" width="10px"></td>
+<td bgcolor=#FF6600 onMouseOver=View('FF6600') onClick=Set('FF6600') height="10px" width="10px"></td>
+<td bgcolor=#FF9900 onMouseOver=View('FF9900') onClick=Set('FF9900') height="10px" width="10px"></td>
+<td bgcolor=#FFCC00 onMouseOver=View('FFCC00') onClick=Set('FFCC00') height="10px" width="10px"></td>
+<td bgcolor=#FFFF00 onMouseOver=View('FFFF00') onClick=Set('FFFF00') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#00FF00 onMouseOver=View('00FF00') onClick=Set('00FF00') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#990033 onMouseOver=View('990033') onClick=Set('990033') height="10px" width="10px"></td>
+<td bgcolor=#993333 onMouseOver=View('993333') onClick=Set('993333') height="10px" width="10px"></td>
+<td bgcolor=#996633 onMouseOver=View('996633') onClick=Set('996633') height="10px" width="10px"></td>
+<td bgcolor=#999933 onMouseOver=View('999933') onClick=Set('999933') height="10px" width="10px"></td>
+<td bgcolor=#99CC33 onMouseOver=View('99CC33') onClick=Set('99CC33') height="10px" width="10px"></td>
+<td bgcolor=#99FF33 onMouseOver=View('99FF33') onClick=Set('99FF33') height="10px" width="10px"></td>
+<td bgcolor=#CC0033 onMouseOver=View('CC0033') onClick=Set('CC0033') height="10px" width="10px"></td>
+<td bgcolor=#CC3333 onMouseOver=View('CC3333') onClick=Set('CC3333') height="10px" width="10px"></td>
+<td bgcolor=#CC6633 onMouseOver=View('CC6633') onClick=Set('CC6633') height="10px" width="10px"></td>
+<td bgcolor=#CC9933 onMouseOver=View('CC9933') onClick=Set('CC9933') height="10px" width="10px"></td>
+<td bgcolor=#CCCC33 onMouseOver=View('CCCC33') onClick=Set('CCCC33') height="10px" width="10px"></td>
+<td bgcolor=#CCFF33 onMouseOver=View('CCFF33') onClick=Set('CCFF33') height="10px" width="10px"></td>
+<td bgcolor=#FF0033 onMouseOver=View('FF0033') onClick=Set('FF0033') height="10px" width="10px"></td>
+<td bgcolor=#FF3333 onMouseOver=View('FF3333') onClick=Set('FF3333') height="10px" width="10px"></td>
+<td bgcolor=#FF6633 onMouseOver=View('FF6633') onClick=Set('FF6633') height="10px" width="10px"></td>
+<td bgcolor=#FF9933 onMouseOver=View('FF9933') onClick=Set('FF9933') height="10px" width="10px"></td>
+<td bgcolor=#FFCC33 onMouseOver=View('FFCC33') onClick=Set('FFCC33') height="10px" width="10px"></td>
+<td bgcolor=#FFFF33 onMouseOver=View('FFFF33') onClick=Set('FFFF33') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#0000FF onMouseOver=View('0000FF') onClick=Set('0000FF') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#990066 onMouseOver=View('990066') onClick=Set('990066') height="10px" width="10px"></td>
+<td bgcolor=#993366 onMouseOver=View('993366') onClick=Set('993366') height="10px" width="10px"></td>
+<td bgcolor=#996666 onMouseOver=View('996666') onClick=Set('996666') height="10px" width="10px"></td>
+<td bgcolor=#999966 onMouseOver=View('999966') onClick=Set('999966') height="10px" width="10px"></td>
+<td bgcolor=#99CC66 onMouseOver=View('99CC66') onClick=Set('99CC66') height="10px" width="10px"></td>
+<td bgcolor=#99FF66 onMouseOver=View('99FF66') onClick=Set('99FF66') height="10px" width="10px"></td>
+<td bgcolor=#CC0066 onMouseOver=View('CC0066') onClick=Set('CC0066') height="10px" width="10px"></td>
+<td bgcolor=#CC3366 onMouseOver=View('CC3366') onClick=Set('CC3366') height="10px" width="10px"></td>
+<td bgcolor=#CC6666 onMouseOver=View('CC6666') onClick=Set('CC6666') height="10px" width="10px"></td>
+<td bgcolor=#CC9966 onMouseOver=View('CC9966') onClick=Set('CC9966') height="10px" width="10px"></td>
+<td bgcolor=#CCCC66 onMouseOver=View('CCCC66') onClick=Set('CCCC66') height="10px" width="10px"></td>
+<td bgcolor=#CCFF66 onMouseOver=View('CCFF66') onClick=Set('CCFF66') height="10px" width="10px"></td>
+<td bgcolor=#FF0066 onMouseOver=View('FF0066') onClick=Set('FF0066') height="10px" width="10px"></td>
+<td bgcolor=#FF3366 onMouseOver=View('FF3366') onClick=Set('FF3366') height="10px" width="10px"></td>
+<td bgcolor=#FF6666 onMouseOver=View('FF6666') onClick=Set('FF6666') height="10px" width="10px"></td>
+<td bgcolor=#FF9966 onMouseOver=View('FF9966') onClick=Set('FF9966') height="10px" width="10px"></td>
+<td bgcolor=#FFCC66 onMouseOver=View('FFCC66') onClick=Set('FFCC66') height="10px" width="10px"></td>
+<td bgcolor=#FFFF66 onMouseOver=View('FFFF66') onClick=Set('FFFF66') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#FFFF00 onMouseOver=View('FFFF00') onClick=Set('FFFF00') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#990099 onMouseOver=View('990099') onClick=Set('990099') height="10px" width="10px"></td>
+<td bgcolor=#993399 onMouseOver=View('993399') onClick=Set('993399') height="10px" width="10px"></td>
+<td bgcolor=#996699 onMouseOver=View('996699') onClick=Set('996699') height="10px" width="10px"></td>
+<td bgcolor=#999999 onMouseOver=View('999999') onClick=Set('999999') height="10px" width="10px"></td>
+<td bgcolor=#99CC99 onMouseOver=View('99CC99') onClick=Set('99CC99') height="10px" width="10px"></td>
+<td bgcolor=#99FF99 onMouseOver=View('99FF99') onClick=Set('99FF99') height="10px" width="10px"></td>
+<td bgcolor=#CC0099 onMouseOver=View('CC0099') onClick=Set('CC0099') height="10px" width="10px"></td>
+<td bgcolor=#CC3399 onMouseOver=View('CC3399') onClick=Set('CC3399') height="10px" width="10px"></td>
+<td bgcolor=#CC6699 onMouseOver=View('CC6699') onClick=Set('CC6699') height="10px" width="10px"></td>
+<td bgcolor=#CC9999 onMouseOver=View('CC9999') onClick=Set('CC9999') height="10px" width="10px"></td>
+<td bgcolor=#CCCC99 onMouseOver=View('CCCC99') onClick=Set('CCCC99') height="10px" width="10px"></td>
+<td bgcolor=#CCFF99 onMouseOver=View('CCFF99') onClick=Set('CCFF99') height="10px" width="10px"></td>
+<td bgcolor=#FF0099 onMouseOver=View('FF0099') onClick=Set('FF0099') height="10px" width="10px"></td>
+<td bgcolor=#FF3399 onMouseOver=View('FF3399') onClick=Set('FF3399') height="10px" width="10px"></td>
+<td bgcolor=#FF6699 onMouseOver=View('FF6699') onClick=Set('FF6699') height="10px" width="10px"></td>
+<td bgcolor=#FF9999 onMouseOver=View('FF9999') onClick=Set('FF9999') height="10px" width="10px"></td>
+<td bgcolor=#FFCC99 onMouseOver=View('FFCC99') onClick=Set('FFCC99') height="10px" width="10px"></td>
+<td bgcolor=#FFFF99 onMouseOver=View('FFFF99') onClick=Set('FFFF99') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#00FFFF onMouseOver=View('00FFFF') onClick=Set('00FFFF') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#9900CC onMouseOver=View('9900CC') onClick=Set('9900CC') height="10px" width="10px"></td>
+<td bgcolor=#9933CC onMouseOver=View('9933CC') onClick=Set('9933CC') height="10px" width="10px"></td>
+<td bgcolor=#9966CC onMouseOver=View('9966CC') onClick=Set('9966CC') height="10px" width="10px"></td>
+<td bgcolor=#9999CC onMouseOver=View('9999CC') onClick=Set('9999CC') height="10px" width="10px"></td>
+<td bgcolor=#99CCCC onMouseOver=View('99CCCC') onClick=Set('99CCCC') height="10px" width="10px"></td>
+<td bgcolor=#99FFCC onMouseOver=View('99FFCC') onClick=Set('99FFCC') height="10px" width="10px"></td>
+<td bgcolor=#CC00CC onMouseOver=View('CC00CC') onClick=Set('CC00CC') height="10px" width="10px"></td>
+<td bgcolor=#CC33CC onMouseOver=View('CC33CC') onClick=Set('CC33CC') height="10px" width="10px"></td>
+<td bgcolor=#CC66CC onMouseOver=View('CC66CC') onClick=Set('CC66CC') height="10px" width="10px"></td>
+<td bgcolor=#CC99CC onMouseOver=View('CC99CC') onClick=Set('CC99CC') height="10px" width="10px"></td>
+<td bgcolor=#CCCCCC onMouseOver=View('CCCCCC') onClick=Set('CCCCCC') height="10px" width="10px"></td>
+<td bgcolor=#CCFFCC onMouseOver=View('CCFFCC') onClick=Set('CCFFCC') height="10px" width="10px"></td>
+<td bgcolor=#FF00CC onMouseOver=View('FF00CC') onClick=Set('FF00CC') height="10px" width="10px"></td>
+<td bgcolor=#FF33CC onMouseOver=View('FF33CC') onClick=Set('FF33CC') height="10px" width="10px"></td>
+<td bgcolor=#FF66CC onMouseOver=View('FF66CC') onClick=Set('FF66CC') height="10px" width="10px"></td>
+<td bgcolor=#FF99CC onMouseOver=View('FF99CC') onClick=Set('FF99CC') height="10px" width="10px"></td>
+<td bgcolor=#FFCCCC onMouseOver=View('FFCCCC') onClick=Set('FFCCCC') height="10px" width="10px"></td>
+<td bgcolor=#FFFFCC onMouseOver=View('FFFFCC') onClick=Set('FFFFCC') height="10px" width="10px"></td>
+</tr>
+<tr>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#FF00FF onMouseOver=View('FF00FF') onClick=Set('FF00FF') height="10px" width="10px"></td>
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
+<td bgcolor=#9900FF onMouseOver=View('9900FF') onClick=Set('9900FF') height="10px" width="10px"></td>
+<td bgcolor=#9933FF onMouseOver=View('9933FF') onClick=Set('9933FF') height="10px" width="10px"></td>
+<td bgcolor=#9966FF onMouseOver=View('9966FF') onClick=Set('9966FF') height="10px" width="10px"></td>
+<td bgcolor=#9999FF onMouseOver=View('9999FF') onClick=Set('9999FF') height="10px" width="10px"></td>
+<td bgcolor=#99CCFF onMouseOver=View('99CCFF') onClick=Set('99CCFF') height="10px" width="10px"></td>
+<td bgcolor=#99FFFF onMouseOver=View('99FFFF') onClick=Set('99FFFF') height="10px" width="10px"></td>
+<td bgcolor=#CC00FF onMouseOver=View('CC00FF') onClick=Set('CC00FF') height="10px" width="10px"></td>
+<td bgcolor=#CC33FF onMouseOver=View('CC33FF') onClick=Set('CC33FF') height="10px" width="10px"></td>
+<td bgcolor=#CC66FF onMouseOver=View('CC66FF') onClick=Set('CC66FF') height="10px" width="10px"></td>
+<td bgcolor=#CC99FF onMouseOver=View('CC99FF') onClick=Set('CC99FF') height="10px" width="10px"></td>
+<td bgcolor=#CCCCFF onMouseOver=View('CCCCFF') onClick=Set('CCCCFF') height="10px" width="10px"></td>
+<td bgcolor=#CCFFFF onMouseOver=View('CCFFFF') onClick=Set('CCFFFF') height="10px" width="10px"></td>
+<td bgcolor=#FF00FF onMouseOver=View('FF00FF') onClick=Set('FF00FF') height="10px" width="10px"></td>
+<td bgcolor=#FF33FF onMouseOver=View('FF33FF') onClick=Set('FF33FF') height="10px" width="10px"></td>
+<td bgcolor=#FF66FF onMouseOver=View('FF66FF') onClick=Set('FF66FF') height="10px" width="10px"></td>
+<td bgcolor=#FF99FF onMouseOver=View('FF99FF') onClick=Set('FF99FF') height="10px" width="10px"></td>
+<td bgcolor=#FFCCFF onMouseOver=View('FFCCFF') onClick=Set('FFCCFF') height="10px" width="10px"></td>
+<td bgcolor=#FFFFFF onMouseOver=View('FFFFFF') onClick=Set('FFFFFF') height="10px" width="10px"></td>
+</tr>
+</table>
+
+</body></html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/editor_help.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/editor_help.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/editor_help.html	(revision 1328)
@@ -0,0 +1,16 @@
+<html>
+ <head>
+  <title>Editor Help</title>
+  <style>
+    body, td, p, div { font-family: arial; font-size: x-small; }
+  </style>
+ </head>
+<body>
+
+<h2>Editor Help<hr></h2>
+
+Todo...
+
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popups/old-fullscreen.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popups/old-fullscreen.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popups/old-fullscreen.html	(revision 1328)
@@ -0,0 +1,131 @@
+<html>
+<head><title>Fullscreen Editor</title>
+<style type="text/css"> body {	margin: 0px; border: 0px; background-color: buttonface; } </style>
+
+<script>
+
+// if we pass the "window" object as a argument and then set opener to
+// equal that we can refer to dialogWindows and popupWindows the same way
+if (window.dialogArguments) { opener = window.dialogArguments; }
+
+var _editor_url = "../";
+document.write('<scr'+'ipt src="' +_editor_url+ 'editor.js" language="Javascript1.2"></scr'+'ipt>');
+
+var parent_objname = location.search.substring(1,location.search.length);  // parent editor objname
+var parent_config  = opener.document.all[parent_objname].config;
+
+var config         = cloneObject( parent_config );
+var objname        = 'editor'; // name of this editor
+
+//  DOMViewerObj = config;
+//  DOMViewerName = 'config';
+//  window.open('/innerHTML/domviewer.htm');  
+
+/* ---------------------------------------------------------------------- *\
+  Function    : 
+  Description : 
+\* ---------------------------------------------------------------------- */
+
+function _CloseOnEsc() {
+  if (event.keyCode == 27) {
+    update_parent();
+    window.close();
+    return;
+  }
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : cloneObject
+  Description : copy an object by value instead of by reference
+  Usage       : var newObj = cloneObject(oldObj);
+\* ---------------------------------------------------------------------- */
+
+function cloneObject(obj) {
+  var newObj          = new Object; 
+
+  // check for array objects
+  if (obj.constructor.toString().indexOf('function Array(') == 1) {
+    newObj = obj.constructor();
+  }
+
+  for (var n in obj) {
+    var node = obj[n];
+    if (typeof node == 'object') { newObj[n] = cloneObject(node); }
+    else                         { newObj[n] = node; }
+  }
+  
+  return newObj;
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : resize_editor
+  Description : resize the editor when the user resizes the popup
+\* ---------------------------------------------------------------------- */
+
+function resize_editor() {  // resize editor to fix window
+  var editor = document.all['_editor_editor'];
+
+  newWidth  = document.body.offsetWidth;
+  newHeight = document.body.offsetHeight - editor.offsetTop;
+
+  if (newWidth < 0) { newWidth = 0; }
+  if (newHeight < 0) { newHeight = 0; }
+
+  editor.style.width  = newWidth;
+  editor.style.height = newHeight;
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : init
+  Description : run this code on page load
+\* ---------------------------------------------------------------------- */
+
+function init() {
+  // change maximize button to minimize button
+  config.btnList["popupeditor"] = ['popupeditor', 'Minimize Editor',  'update_parent(); window.close();', 'fullscreen_minimize.gif'];
+
+  // set htmlmode button to refer to THIS editor
+  config.btnList["htmlmode"]    = ['HtmlMode',    'View HTML Source', 'editor_setmode(\'editor\')',  'ed_html.gif'];
+
+  // change image url to be relative to current path
+  config.imgURL = "../images/";
+  
+  // generate editor and resize it
+  editor_generate('editor', config);
+  resize_editor();
+
+  // switch mode if needed
+  if (parent_config.mode == 'textedit') { editor_setmode(objname, 'textedit'); }
+
+  // set child window contents
+  var parentHTML = opener.editor_getHTML(parent_objname);
+  editor_setHTML(objname, parentHTML);
+
+  // continuously update parent editor window
+  window.setInterval(update_parent, 333);
+
+  // setup event handlers
+  document.body.onkeypress = _CloseOnEsc;
+  window.onresize = resize_editor;
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : update_parent
+  Description : update parent window editor field with contents from child window
+\* ---------------------------------------------------------------------- */
+
+function update_parent() {
+  var childHTML = editor_getHTML(objname);
+  opener.editor_setHTML(parent_objname, childHTML);
+}
+
+
+</script>
+</head>
+<body scroll="no" onload="init()" onunload="update_parent()">
+
+<div style="margin: 0 0 0 0; border-width: 1; border-style: solid; border-color: threedshadow threedhighlight threedhighlight threedshadow; "></div>
+
+<textarea name="editor" style="width:100%; height:300px"></textarea><br>
+
+</body></html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/htmlarea.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/htmlarea.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/htmlarea.js	(revision 1328)
@@ -0,0 +1,2175 @@
+// htmlArea v3.0 - Copyright (c) 2002-2004 interactivetools.com, inc.
+// This copyright notice MUST stay intact for use (see license.txt).
+//
+// Portions (c) dynarch.com, 2003-2004
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon.
+//   http://dynarch.com/mishoo
+//
+// $Id$
+
+if (typeof _editor_url == "string") {
+	// Leave exactly one backslash at the end of _editor_url
+	_editor_url = _editor_url.replace(/\x2f*$/, '/');
+} else {
+	alert("WARNING: _editor_url is not set!  You should set this variable to the editor files path; it should preferably be an absolute path, like in '/htmlarea', but it can be relative if you prefer.  Further we will try to load the editor files correctly but we'll probably fail.");
+	_editor_url = '';
+}
+
+// make sure we have a language
+if (typeof _editor_lang == "string") {
+	_editor_lang = _editor_lang.toLowerCase();
+} else {
+	_editor_lang = "en";
+}
+
+// Creates a new HTMLArea object.  Tries to replace the textarea with the given
+// ID with it.
+function HTMLArea(textarea, config) {
+	if (HTMLArea.checkSupportedBrowser()) {
+		if (typeof config == "undefined") {
+			this.config = new HTMLArea.Config();
+		} else {
+			this.config = config;
+		}
+		this._htmlArea = null;
+		this._textArea = textarea;
+		this._editMode = "wysiwyg";
+		this.plugins = {};
+		this._timerToolbar = null;
+		this._timerUndo = null;
+		this._undoQueue = new Array(this.config.undoSteps);
+		this._undoPos = -1;
+		this._customUndo = false;
+		this._mdoc = document; // cache the document, we need it in plugins
+		this.doctype = '';
+	}
+};
+
+// load some scripts
+(function() {
+	var scripts = HTMLArea._scripts = [ _editor_url + "htmlarea.js",
+					    _editor_url + "dialog.js",
+					    _editor_url + "popupwin.js",
+					    _editor_url + "lang/" + _editor_lang + ".js" ];
+	var head = document.getElementsByTagName("head")[0];
+	// start from 1, htmlarea.js is already loaded
+	for (var i = 1; i < scripts.length; ++i) {
+		var script = document.createElement("script");
+		script.src = scripts[i];
+		head.appendChild(script);
+	}
+})();
+
+// cache some regexps
+HTMLArea.RE_tagName = /(<\/|<)\s*([^ \t\n>]+)/ig;
+HTMLArea.RE_doctype = /(<!doctype((.|\n)*?)>)\n?/i;
+HTMLArea.RE_head    = /<head>((.|\n)*?)<\/head>/i;
+HTMLArea.RE_body    = /<body>((.|\n)*?)<\/body>/i;
+
+HTMLArea.Config = function () {
+	this.version = "3.0";
+
+	this.width = "auto";
+	this.height = "auto";
+
+	// enable creation of a status bar?
+	this.statusBar = true;
+
+	// maximum size of the undo queue
+	this.undoSteps = 20;
+
+	// the time interval at which undo samples are taken
+	this.undoTimeout = 500;	// 1/2 sec.
+
+	// the next parameter specifies whether the toolbar should be included
+	// in the size or not.
+	this.sizeIncludesToolbar = true;
+
+	// if true then HTMLArea will retrieve the full HTML, starting with the
+	// <HTML> tag.
+	this.fullPage = false;
+
+	// style included in the iframe document
+	this.pageStyle = "";
+
+	// set to true if you want Word code to be cleaned upon Paste
+	this.killWordOnPaste = false;
+
+	// BaseURL included in the iframe document
+	this.baseURL = document.baseURI || document.URL;
+	if (this.baseURL && this.baseURL.match(/(.*)\/([^\/]+)/))
+		this.baseURL = RegExp.$1 + "/";
+
+	// URL-s
+	this.imgURL = "images/";
+	this.popupURL = "popups/";
+
+	/** CUSTOMIZING THE TOOLBAR
+	 * -------------------------
+	 *
+	 * It is recommended that you customize the toolbar contents in an
+	 * external file (i.e. the one calling HTMLArea) and leave this one
+	 * unchanged.  That's because when we (InteractiveTools.com) release a
+	 * new official version, it's less likely that you will have problems
+	 * upgrading HTMLArea.
+	 */
+	this.toolbar = [
+		[ "fontname", "space",
+		  "fontsize", "space",
+		  "formatblock", "space",
+		  "bold", "italic", "underline", "strikethrough", "separator",
+		  "subscript", "superscript", "separator",
+		  "copy", "cut", "paste", "space", "undo", "redo" ],
+
+		[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
+		  "lefttoright", "righttoleft", "separator",
+		  "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
+		  "forecolor", "hilitecolor", "separator",
+		  "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator",
+		  "popupeditor", "separator", "showhelp", "about" ]
+	];
+
+	this.fontname = {
+		"Arial":	   'arial,helvetica,sans-serif',
+		"Courier New":	   'courier new,courier,monospace',
+		"Georgia":	   'georgia,times new roman,times,serif',
+		"Tahoma":	   'tahoma,arial,helvetica,sans-serif',
+		"Times New Roman": 'times new roman,times,serif',
+		"Verdana":	   'verdana,arial,helvetica,sans-serif',
+		"impact":	   'impact',
+		"WingDings":	   'wingdings'
+	};
+
+	this.fontsize = {
+		"1 (8 pt)":  "1",
+		"2 (10 pt)": "2",
+		"3 (12 pt)": "3",
+		"4 (14 pt)": "4",
+		"5 (18 pt)": "5",
+		"6 (24 pt)": "6",
+		"7 (36 pt)": "7"
+	};
+
+	this.formatblock = {
+		"Heading 1": "h1",
+		"Heading 2": "h2",
+		"Heading 3": "h3",
+		"Heading 4": "h4",
+		"Heading 5": "h5",
+		"Heading 6": "h6",
+		"Normal": "p",
+		"Address": "address",
+		"Formatted": "pre"
+	};
+
+	this.customSelects = {};
+
+	function cut_copy_paste(e, cmd, obj) {
+		e.execCommand(cmd);
+	};
+
+	// ADDING CUSTOM BUTTONS: please read below!
+	// format of the btnList elements is "ID: [ ToolTip, Icon, Enabled in text mode?, ACTION ]"
+	//    - ID: unique ID for the button.  If the button calls document.execCommand
+	//	    it's wise to give it the same name as the called command.
+	//    - ACTION: function that gets called when the button is clicked.
+	//              it has the following prototype:
+	//                 function(editor, buttonName)
+	//              - editor is the HTMLArea object that triggered the call
+	//              - buttonName is the ID of the clicked button
+	//              These 2 parameters makes it possible for you to use the same
+	//              handler for more HTMLArea objects or for more different buttons.
+	//    - ToolTip: default tooltip, for cases when it is not defined in the -lang- file (HTMLArea.I18N)
+	//    - Icon: path to an icon image file for the button (TODO: use one image for all buttons!)
+	//    - Enabled in text mode: if false the button gets disabled for text-only mode; otherwise enabled all the time.
+	this.btnList = {
+		bold: [ "Bold", "ed_format_bold.gif", false, function(e) {e.execCommand("bold");} ],
+		italic: [ "Italic", "ed_format_italic.gif", false, function(e) {e.execCommand("italic");} ],
+		underline: [ "Underline", "ed_format_underline.gif", false, function(e) {e.execCommand("underline");} ],
+		strikethrough: [ "Strikethrough", "ed_format_strike.gif", false, function(e) {e.execCommand("strikethrough");} ],
+		subscript: [ "Subscript", "ed_format_sub.gif", false, function(e) {e.execCommand("subscript");} ],
+		superscript: [ "Superscript", "ed_format_sup.gif", false, function(e) {e.execCommand("superscript");} ],
+		justifyleft: [ "Justify Left", "ed_align_left.gif", false, function(e) {e.execCommand("justifyleft");} ],
+		justifycenter: [ "Justify Center", "ed_align_center.gif", false, function(e) {e.execCommand("justifycenter");} ],
+		justifyright: [ "Justify Right", "ed_align_right.gif", false, function(e) {e.execCommand("justifyright");} ],
+		justifyfull: [ "Justify Full", "ed_align_justify.gif", false, function(e) {e.execCommand("justifyfull");} ],
+		insertorderedlist: [ "Ordered List", "ed_list_num.gif", false, function(e) {e.execCommand("insertorderedlist");} ],
+		insertunorderedlist: [ "Bulleted List", "ed_list_bullet.gif", false, function(e) {e.execCommand("insertunorderedlist");} ],
+		outdent: [ "Decrease Indent", "ed_indent_less.gif", false, function(e) {e.execCommand("outdent");} ],
+		indent: [ "Increase Indent", "ed_indent_more.gif", false, function(e) {e.execCommand("indent");} ],
+		forecolor: [ "Font Color", "ed_color_fg.gif", false, function(e) {e.execCommand("forecolor");} ],
+		hilitecolor: [ "Background Color", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ],
+		inserthorizontalrule: [ "Horizontal Rule", "ed_hr.gif", false, function(e) {e.execCommand("inserthorizontalrule");} ],
+		createlink: [ "Insert Web Link", "ed_link.gif", false, function(e) {e.execCommand("createlink", true);} ],
+		insertimage: [ "Insert/Modify Image", "ed_image.gif", false, function(e) {e.execCommand("insertimage");} ],
+		inserttable: [ "Insert Table", "insert_table.gif", false, function(e) {e.execCommand("inserttable");} ],
+		htmlmode: [ "Toggle HTML Source", "ed_html.gif", true, function(e) {e.execCommand("htmlmode");} ],
+		popupeditor: [ "Enlarge Editor", "fullscreen_maximize.gif", true, function(e) {e.execCommand("popupeditor");} ],
+		about: [ "About this editor", "ed_about.gif", true, function(e) {e.execCommand("about");} ],
+		showhelp: [ "Help using editor", "ed_help.gif", true, function(e) {e.execCommand("showhelp");} ],
+		undo: [ "Undoes your last action", "ed_undo.gif", false, function(e) {e.execCommand("undo");} ],
+		redo: [ "Redoes your last action", "ed_redo.gif", false, function(e) {e.execCommand("redo");} ],
+		cut: [ "Cut selection", "ed_cut.gif", false, cut_copy_paste ],
+		copy: [ "Copy selection", "ed_copy.gif", false, cut_copy_paste ],
+		paste: [ "Paste from clipboard", "ed_paste.gif", false, cut_copy_paste ],
+		lefttoright: [ "Direction left to right", "ed_left_to_right.gif", false, function(e) {e.execCommand("lefttoright");} ],
+		righttoleft: [ "Direction right to left", "ed_right_to_left.gif", false, function(e) {e.execCommand("righttoleft");} ]
+	};
+	/* ADDING CUSTOM BUTTONS
+	 * ---------------------
+	 *
+	 * It is recommended that you add the custom buttons in an external
+	 * file and leave this one unchanged.  That's because when we
+	 * (InteractiveTools.com) release a new official version, it's less
+	 * likely that you will have problems upgrading HTMLArea.
+	 *
+	 * Example on how to add a custom button when you construct the HTMLArea:
+	 *
+	 *   var editor = new HTMLArea("your_text_area_id");
+	 *   var cfg = editor.config; // this is the default configuration
+	 *   cfg.btnList["my-hilite"] =
+	 *	[ function(editor) { editor.surroundHTML('<span style="background:yellow">', '</span>'); }, // action
+	 *	  "Highlight selection", // tooltip
+	 *	  "my_hilite.gif", // image
+	 *	  false // disabled in text mode
+	 *	];
+	 *   cfg.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar
+	 *
+	 * An alternate (also more convenient and recommended) way to
+	 * accomplish this is to use the registerButton function below.
+	 */
+	// initialize tooltips from the I18N module and generate correct image path
+	for (var i in this.btnList) {
+		var btn = this.btnList[i];
+		btn[1] = _editor_url + this.imgURL + btn[1];
+		if (typeof HTMLArea.I18N.tooltips[i] != "undefined") {
+			btn[0] = HTMLArea.I18N.tooltips[i];
+		}
+	}
+};
+
+/** Helper function: register a new button with the configuration.  It can be
+ * called with all 5 arguments, or with only one (first one).  When called with
+ * only one argument it must be an object with the following properties: id,
+ * tooltip, image, textMode, action.  Examples:
+ *
+ * 1. config.registerButton("my-hilite", "Hilite text", "my-hilite.gif", false, function(editor) {...});
+ * 2. config.registerButton({
+ *      id       : "my-hilite",      // the ID of your button
+ *      tooltip  : "Hilite text",    // the tooltip
+ *      image    : "my-hilite.gif",  // image to be displayed in the toolbar
+ *      textMode : false,            // disabled in text mode
+ *      action   : function(editor) { // called when the button is clicked
+ *                   editor.surroundHTML('<span class="hilite">', '</span>');
+ *                 },
+ *      context  : "p"               // will be disabled if outside a <p> element
+ *    });
+ */
+HTMLArea.Config.prototype.registerButton = function(id, tooltip, image, textMode, action, context) {
+	var the_id;
+	if (typeof id == "string") {
+		the_id = id;
+	} else if (typeof id == "object") {
+		the_id = id.id;
+	} else {
+		alert("ERROR [HTMLArea.Config::registerButton]:\ninvalid arguments");
+		return false;
+	}
+	// check for existing id
+	if (typeof this.customSelects[the_id] != "undefined") {
+		// alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");
+	}
+	if (typeof this.btnList[the_id] != "undefined") {
+		// alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");
+	}
+	switch (typeof id) {
+	    case "string": this.btnList[id] = [ tooltip, image, textMode, action, context ]; break;
+	    case "object": this.btnList[id.id] = [ id.tooltip, id.image, id.textMode, id.action, id.context ]; break;
+	}
+};
+
+/** The following helper function registers a dropdown box with the editor
+ * configuration.  You still have to add it to the toolbar, same as with the
+ * buttons.  Call it like this:
+ *
+ * FIXME: add example
+ */
+HTMLArea.Config.prototype.registerDropdown = function(object) {
+	// check for existing id
+	if (typeof this.customSelects[object.id] != "undefined") {
+		// alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");
+	}
+	if (typeof this.btnList[object.id] != "undefined") {
+		// alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");
+	}
+	this.customSelects[object.id] = object;
+};
+
+/** Call this function to remove some buttons/drop-down boxes from the toolbar.
+ * Pass as the only parameter a string containing button/drop-down names
+ * delimited by spaces.  Note that the string should also begin with a space
+ * and end with a space.  Example:
+ *
+ *   config.hideSomeButtons(" fontname fontsize textindicator ");
+ *
+ * It's useful because it's easier to remove stuff from the defaul toolbar than
+ * create a brand new toolbar ;-)
+ */
+HTMLArea.Config.prototype.hideSomeButtons = function(remove) {
+	var toolbar = this.toolbar;
+	for (var i in toolbar) {
+		var line = toolbar[i];
+		for (var j = line.length; --j >= 0; ) {
+			if (remove.indexOf(" " + line[j] + " ") >= 0) {
+				var len = 1;
+				if (/separator|space/.test(line[j + 1])) {
+					len = 2;
+				}
+				line.splice(j, len);
+			}
+		}
+	}
+};
+
+/** Helper function: replace all TEXTAREA-s in the document with HTMLArea-s. */
+HTMLArea.replaceAll = function(config) {
+	var tas = document.getElementsByTagName("textarea");
+	for (var i = tas.length; i > 0; (new HTMLArea(tas[--i], config)).generate());
+};
+
+/** Helper function: replaces the TEXTAREA with the given ID with HTMLArea. */
+HTMLArea.replace = function(id, config) {
+	var ta = HTMLArea.getElementById("textarea", id);
+	return ta ? (new HTMLArea(ta, config)).generate() : null;
+};
+
+// Creates the toolbar and appends it to the _htmlarea
+HTMLArea.prototype._createToolbar = function () {
+	var editor = this;	// to access this in nested functions
+
+	var toolbar = document.createElement("div");
+	this._toolbar = toolbar;
+	toolbar.className = "toolbar";
+	toolbar.unselectable = "1";
+	var tb_row = null;
+	var tb_objects = new Object();
+	this._toolbarObjects = tb_objects;
+
+	// creates a new line in the toolbar
+	function newLine() {
+		var table = document.createElement("table");
+		table.border = "0px";
+		table.cellSpacing = "0px";
+		table.cellPadding = "0px";
+		toolbar.appendChild(table);
+		// TBODY is required for IE, otherwise you don't see anything
+		// in the TABLE.
+		var tb_body = document.createElement("tbody");
+		table.appendChild(tb_body);
+		tb_row = document.createElement("tr");
+		tb_body.appendChild(tb_row);
+	}; // END of function: newLine
+	// init first line
+	newLine();
+
+	// updates the state of a toolbar element.  This function is member of
+	// a toolbar element object (unnamed objects created by createButton or
+	// createSelect functions below).
+	function setButtonStatus(id, newval) {
+		var oldval = this[id];
+		var el = this.element;
+		if (oldval != newval) {
+			switch (id) {
+			    case "enabled":
+				if (newval) {
+					HTMLArea._removeClass(el, "buttonDisabled");
+					el.disabled = false;
+				} else {
+					HTMLArea._addClass(el, "buttonDisabled");
+					el.disabled = true;
+				}
+				break;
+			    case "active":
+				if (newval) {
+					HTMLArea._addClass(el, "buttonPressed");
+				} else {
+					HTMLArea._removeClass(el, "buttonPressed");
+				}
+				break;
+			}
+			this[id] = newval;
+		}
+	}; // END of function: setButtonStatus
+
+	// this function will handle creation of combo boxes.  Receives as
+	// parameter the name of a button as defined in the toolBar config.
+	// This function is called from createButton, above, if the given "txt"
+	// doesn't match a button.
+	function createSelect(txt) {
+		var options = null;
+		var el = null;
+		var cmd = null;
+		var customSelects = editor.config.customSelects;
+		var context = null;
+		switch (txt) {
+		    case "fontsize":
+		    case "fontname":
+		    case "formatblock":
+			// the following line retrieves the correct
+			// configuration option because the variable name
+			// inside the Config object is named the same as the
+			// button/select in the toolbar.  For instance, if txt
+			// == "formatblock" we retrieve config.formatblock (or
+			// a different way to write it in JS is
+			// config["formatblock"].
+			options = editor.config[txt];
+			cmd = txt;
+			break;
+		    default:
+			// try to fetch it from the list of registered selects
+			cmd = txt;
+			var dropdown = customSelects[cmd];
+			if (typeof dropdown != "undefined") {
+				options = dropdown.options;
+				context = dropdown.context;
+			} else {
+				alert("ERROR [createSelect]:\nCan't find the requested dropdown definition");
+			}
+			break;
+		}
+		if (options) {
+			el = document.createElement("select");
+			var obj = {
+				name	: txt, // field name
+				element : el,	// the UI element (SELECT)
+				enabled : true, // is it enabled?
+				text	: false, // enabled in text mode?
+				cmd	: cmd, // command ID
+				state	: setButtonStatus, // for changing state
+				context : context
+			};
+			tb_objects[txt] = obj;
+			for (var i in options) {
+				var op = document.createElement("option");
+				op.appendChild(document.createTextNode(i));
+				op.value = options[i];
+				el.appendChild(op);
+			}
+			HTMLArea._addEvent(el, "change", function () {
+				editor._comboSelected(el, txt);
+			});
+		}
+		return el;
+	}; // END of function: createSelect
+
+	// appends a new button to toolbar
+	function createButton(txt) {
+		// the element that will be created
+		var el = null;
+		var btn = null;
+		switch (txt) {
+		    case "separator":
+			el = document.createElement("div");
+			el.className = "separator";
+			break;
+		    case "space":
+			el = document.createElement("div");
+			el.className = "space";
+			break;
+		    case "linebreak":
+			newLine();
+			return false;
+		    case "textindicator":
+			el = document.createElement("div");
+			el.appendChild(document.createTextNode("A"));
+			el.className = "indicator";
+			el.title = HTMLArea.I18N.tooltips.textindicator;
+			var obj = {
+				name	: txt, // the button name (i.e. 'bold')
+				element : el, // the UI element (DIV)
+				enabled : true, // is it enabled?
+				active	: false, // is it pressed?
+				text	: false, // enabled in text mode?
+				cmd	: "textindicator", // the command ID
+				state	: setButtonStatus // for changing state
+			};
+			tb_objects[txt] = obj;
+			break;
+		    default:
+			btn = editor.config.btnList[txt];
+		}
+		if (!el && btn) {
+			el = document.createElement("div");
+			el.title = btn[0];
+			el.className = "button";
+			// let's just pretend we have a button object, and
+			// assign all the needed information to it.
+			var obj = {
+				name	: txt, // the button name (i.e. 'bold')
+				element : el, // the UI element (DIV)
+				enabled : true, // is it enabled?
+				active	: false, // is it pressed?
+				text	: btn[2], // enabled in text mode?
+				cmd	: btn[3], // the command ID
+				state	: setButtonStatus, // for changing state
+				context : btn[4] || null // enabled in a certain context?
+			};
+			tb_objects[txt] = obj;
+			// handlers to emulate nice flat toolbar buttons
+			HTMLArea._addEvent(el, "mouseover", function () {
+				if (obj.enabled) {
+					HTMLArea._addClass(el, "buttonHover");
+				}
+			});
+			HTMLArea._addEvent(el, "mouseout", function () {
+				if (obj.enabled) with (HTMLArea) {
+					_removeClass(el, "buttonHover");
+					_removeClass(el, "buttonActive");
+					(obj.active) && _addClass(el, "buttonPressed");
+				}
+			});
+			HTMLArea._addEvent(el, "mousedown", function (ev) {
+				if (obj.enabled) with (HTMLArea) {
+					_addClass(el, "buttonActive");
+					_removeClass(el, "buttonPressed");
+					_stopEvent(is_ie ? window.event : ev);
+				}
+			});
+			// when clicked, do the following:
+			HTMLArea._addEvent(el, "click", function (ev) {
+				if (obj.enabled) with (HTMLArea) {
+					_removeClass(el, "buttonActive");
+					_removeClass(el, "buttonHover");
+					obj.cmd(editor, obj.name, obj);
+					_stopEvent(is_ie ? window.event : ev);
+				}
+			});
+			var img = document.createElement("img");
+			img.src = btn[1];
+			img.style.width = "18px";
+			img.style.height = "18px";
+			el.appendChild(img);
+		} else if (!el) {
+			el = createSelect(txt);
+		}
+		if (el) {
+			var tb_cell = document.createElement("td");
+			tb_row.appendChild(tb_cell);
+			tb_cell.appendChild(el);
+		} else {
+			alert("FIXME: Unknown toolbar item: " + txt);
+		}
+		return el;
+	};
+
+	var first = true;
+	for (var i in this.config.toolbar) {
+		if (!first) {
+			createButton("linebreak");
+		} else {
+			first = false;
+		}
+		var group = this.config.toolbar[i];
+		for (var j in group) {
+			var code = group[j];
+			if (/^([IT])\[(.*?)\]/.test(code)) {
+				// special case, create text label
+				var l7ed = RegExp.$1 == "I"; // localized?
+				var label = RegExp.$2;
+				if (l7ed) {
+					label = HTMLArea.I18N.custom[label];
+				}
+				var tb_cell = document.createElement("td");
+				tb_row.appendChild(tb_cell);
+				tb_cell.className = "label";
+				tb_cell.innerHTML = label;
+			} else {
+				createButton(code);
+			}
+		}
+	}
+
+	this._htmlArea.appendChild(toolbar);
+};
+
+HTMLArea.prototype._createStatusBar = function() {
+	var statusbar = document.createElement("div");
+	statusbar.className = "statusBar";
+	this._htmlArea.appendChild(statusbar);
+	this._statusBar = statusbar;
+	// statusbar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
+	// creates a holder for the path view
+	div = document.createElement("span");
+	div.className = "statusBarTree";
+	div.innerHTML = HTMLArea.I18N.msg["Path"] + ": ";
+	this._statusBarTree = div;
+	this._statusBar.appendChild(div);
+	if (!this.config.statusBar) {
+		// disable it...
+		statusbar.style.display = "none";
+	}
+};
+
+// Creates the HTMLArea object and replaces the textarea with it.
+HTMLArea.prototype.generate = function () {
+	var editor = this;	// we'll need "this" in some nested functions
+	// get the textarea
+	var textarea = this._textArea;
+	if (typeof textarea == "string") {
+		// it's not element but ID
+		this._textArea = textarea = HTMLArea.getElementById("textarea", textarea);
+	}
+	this._ta_size = {
+		w: textarea.offsetWidth,
+		h: textarea.offsetHeight
+	};
+	textarea.style.display = "none";
+
+	// create the editor framework
+	var htmlarea = document.createElement("div");
+	htmlarea.className = "htmlarea";
+	this._htmlArea = htmlarea;
+
+	// insert the editor before the textarea.
+	textarea.parentNode.insertBefore(htmlarea, textarea);
+
+	if (textarea.form) {
+		// we have a form, on submit get the HTMLArea content and
+		// update original textarea.
+		var f = textarea.form;
+		if (typeof f.onsubmit == "function") {
+			var funcref = f.onsubmit;
+			if (typeof f.__msh_prevOnSubmit == "undefined") {
+				f.__msh_prevOnSubmit = [];
+			}
+			f.__msh_prevOnSubmit.push(funcref);
+		}
+		f.onsubmit = function() {
+			editor._textArea.value = editor.getHTML();
+			var a = this.__msh_prevOnSubmit;
+			// call previous submit methods if they were there.
+			if (typeof a != "undefined") {
+				for (var i in a) {
+					a[i]();
+				}
+			}
+		};
+	}
+
+	// add a handler for the "back/forward" case -- on body.unload we save
+	// the HTML content into the original textarea.
+	window.onunload = function() {
+		editor._textArea.value = editor.getHTML();
+	};
+
+	// creates & appends the toolbar
+	this._createToolbar();
+
+	// create the IFRAME
+	var iframe = document.createElement("iframe");
+	htmlarea.appendChild(iframe);
+
+	this._iframe = iframe;
+
+	// creates & appends the status bar, if the case
+	this._createStatusBar();
+
+	// remove the default border as it keeps us from computing correctly
+	// the sizes.  (somebody tell me why doesn't this work in IE)
+
+	if (!HTMLArea.is_ie) {
+		iframe.style.borderWidth = "1px";
+	// iframe.frameBorder = "1";
+	// iframe.marginHeight = "0";
+	// iframe.marginWidth = "0";
+	}
+
+	// size the IFRAME according to user's prefs or initial textarea
+	var height = (this.config.height == "auto" ? (this._ta_size.h + "px") : this.config.height);
+	height = parseInt(height);
+	var width = (this.config.width == "auto" ? (this._ta_size.w + "px") : this.config.width);
+	width = parseInt(width);
+
+	if (!HTMLArea.is_ie) {
+		height -= 2;
+		width -= 2;
+	}
+
+	iframe.style.width = width + "px";
+	if (this.config.sizeIncludesToolbar) {
+		// substract toolbar height
+		height -= this._toolbar.offsetHeight;
+		height -= this._statusBar.offsetHeight;
+	}
+	if (height < 0) {
+		height = 0;
+	}
+	iframe.style.height = height + "px";
+
+	// the editor including the toolbar now have the same size as the
+	// original textarea.. which means that we need to reduce that a bit.
+	textarea.style.width = iframe.style.width;
+ 	textarea.style.height = iframe.style.height;
+
+	// IMPORTANT: we have to allow Mozilla a short time to recognize the
+	// new frame.  Otherwise we get a stupid exception.
+	function initIframe() {
+		var doc = editor._iframe.contentWindow.document;
+		if (!doc) {
+			// Try again..
+			// FIXME: don't know what else to do here.  Normally
+			// we'll never reach this point.
+			if (HTMLArea.is_gecko) {
+				setTimeout(initIframe, 100);
+				return false;
+			} else {
+				alert("ERROR: IFRAME can't be initialized.");
+			}
+		}
+		if (HTMLArea.is_gecko) {
+			// enable editable mode for Mozilla
+			doc.designMode = "on";
+		}
+		editor._doc = doc;
+		if (!editor.config.fullPage) {
+			doc.open();
+			var html = "<html>\n";
+			html += "<head>\n";
+			if (editor.config.baseURL)
+				html += '<base href="' + editor.config.baseURL + '" />';
+			html += "<style> html,body { border: 0px; } " +
+				editor.config.pageStyle + "</style>\n";
+			html += "</head>\n";
+			html += "<body>\n";
+			html += editor._textArea.value;
+			html += "</body>\n";
+			html += "</html>";
+			doc.write(html);
+			doc.close();
+		} else {
+			var html = editor._textArea.value;
+			if (html.match(HTMLArea.RE_doctype)) {
+				editor.setDoctype(RegExp.$1);
+				html = html.replace(HTMLArea.RE_doctype, "");
+			}
+			doc.open();
+			doc.write(html);
+			doc.close();
+		}
+
+		if (HTMLArea.is_ie) {
+			// enable editable mode for IE.	 For some reason this
+			// doesn't work if done in the same place as for Gecko
+			// (above).
+			doc.body.contentEditable = true;
+		}
+
+		editor.focusEditor();
+		// intercept some events; for updating the toolbar & keyboard handlers
+		HTMLArea._addEvents
+			(doc, ["keydown", "keypress", "mousedown", "mouseup", "drag"],
+			 function (event) {
+				 return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event);
+			 });
+
+		// check if any plugins have registered refresh handlers
+		for (var i in editor.plugins) {
+			var plugin = editor.plugins[i].instance;
+			if (typeof plugin.onGenerate == "function")
+				plugin.onGenerate();
+		}
+
+		setTimeout(function() {
+			editor.updateToolbar();
+		}, 250);
+
+		if (typeof editor.onGenerate == "function")
+			editor.onGenerate();
+	};
+	setTimeout(initIframe, 100);
+};
+
+// Switches editor mode; parameter can be "textmode" or "wysiwyg".  If no
+// parameter was passed this function toggles between modes.
+HTMLArea.prototype.setMode = function(mode) {
+	if (typeof mode == "undefined") {
+		mode = ((this._editMode == "textmode") ? "wysiwyg" : "textmode");
+	}
+	switch (mode) {
+	    case "textmode":
+		this._textArea.value = this.getHTML();
+		this._iframe.style.display = "none";
+		this._textArea.style.display = "block";
+		if (this.config.statusBar) {
+			this._statusBar.innerHTML = HTMLArea.I18N.msg["TEXT_MODE"];
+		}
+		break;
+	    case "wysiwyg":
+		if (HTMLArea.is_gecko) {
+			// disable design mode before changing innerHTML
+			try {
+				this._doc.designMode = "off";
+			} catch(e) {};
+		}
+		if (!this.config.fullPage)
+			this._doc.body.innerHTML = this.getHTML();
+		else
+			this.setFullHTML(this.getHTML());
+		this._iframe.style.display = "block";
+		this._textArea.style.display = "none";
+		if (HTMLArea.is_gecko) {
+			// we need to refresh that info for Moz-1.3a
+			try {
+				this._doc.designMode = "on";
+			} catch(e) {};
+		}
+		if (this.config.statusBar) {
+			this._statusBar.innerHTML = '';
+			this._statusBar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
+			this._statusBar.appendChild(this._statusBarTree);
+		}
+		break;
+	    default:
+		alert("Mode <" + mode + "> not defined!");
+		return false;
+	}
+	this._editMode = mode;
+	this.focusEditor();
+};
+
+HTMLArea.prototype.setFullHTML = function(html) {
+	var save_multiline = RegExp.multiline;
+	RegExp.multiline = true;
+	if (html.match(HTMLArea.RE_doctype)) {
+		this.setDoctype(RegExp.$1);
+		html = html.replace(HTMLArea.RE_doctype, "");
+	}
+	RegExp.multiline = save_multiline;
+	if (!HTMLArea.is_ie) {
+		if (html.match(HTMLArea.RE_head))
+			this._doc.getElementsByTagName("head")[0].innerHTML = RegExp.$1;
+		if (html.match(HTMLArea.RE_body))
+			this._doc.getElementsByTagName("body")[0].innerHTML = RegExp.$1;
+	} else {
+		var html_re = /<html>((.|\n)*?)<\/html>/i;
+		html = html.replace(html_re, "$1");
+		this._doc.open();
+		this._doc.write(html);
+		this._doc.close();
+		this._doc.body.contentEditable = true;
+		return true;
+	}
+};
+
+/***************************************************
+ *  Category: PLUGINS
+ ***************************************************/
+
+// this is the variant of the function above where the plugin arguments are
+// already packed in an array.  Externally, it should be only used in the
+// full-screen editor code, in order to initialize plugins with the same
+// parameters as in the opener window.
+HTMLArea.prototype.registerPlugin2 = function(plugin, args) {
+	if (typeof plugin == "string")
+		plugin = eval(plugin);
+	var obj = new plugin(this, args);
+	if (obj) {
+		var clone = {};
+		var info = plugin._pluginInfo;
+		for (var i in info)
+			clone[i] = info[i];
+		clone.instance = obj;
+		clone.args = args;
+		this.plugins[plugin._pluginInfo.name] = clone;
+	} else
+		alert("Can't register plugin " + plugin.toString() + ".");
+};
+
+// Create the specified plugin and register it with this HTMLArea
+HTMLArea.prototype.registerPlugin = function() {
+	var plugin = arguments[0];
+	var args = [];
+	for (var i = 1; i < arguments.length; ++i)
+		args.push(arguments[i]);
+	this.registerPlugin2(plugin, args);
+};
+
+// static function that loads the required plugin and lang file, based on the
+// language loaded already for HTMLArea.  You better make sure that the plugin
+// _has_ that language, otherwise shit might happen ;-)
+HTMLArea.loadPlugin = function(pluginName) {
+	var dir = _editor_url + "plugins/" + pluginName;
+	var plugin = pluginName.replace(/([a-z])([A-Z])([a-z])/g,
+					function (str, l1, l2, l3) {
+						return l1 + "-" + l2.toLowerCase() + l3;
+					}).toLowerCase() + ".js";
+	var plugin_file = dir + "/" + plugin;
+	var plugin_lang = dir + "/lang/" + HTMLArea.I18N.lang + ".js";
+	HTMLArea._scripts.push(plugin_file, plugin_lang);
+	document.write("<script type='text/javascript' src='" + plugin_file + "'></script>");
+	document.write("<script type='text/javascript' src='" + plugin_lang + "'></script>");
+};
+
+HTMLArea.loadStyle = function(style, plugin) {
+	var url = _editor_url || '';
+	if (typeof plugin != "undefined") {
+		url += "plugins/" + plugin + "/";
+	}
+	url += style;
+	document.write("<style type='text/css'>@import url(" + url + ");</style>");
+};
+HTMLArea.loadStyle("htmlarea.css");
+
+/***************************************************
+ *  Category: EDITOR UTILITIES
+ ***************************************************/
+
+// The following function is a slight variation of the word cleaner code posted
+// by Weeezl (user @ InteractiveTools forums).
+HTMLArea.prototype._wordClean = function() {
+	var D = this.getInnerHTML();
+	if (D.indexOf('class=Mso') >= 0) {
+
+		// make one line
+		D = D.replace(/\r\n/g, ' ').
+			replace(/\n/g, ' ').
+			replace(/\r/g, ' ').
+			replace(/\&nbsp\;/g,' ');
+
+		// keep tags, strip attributes
+		D = D.replace(/ class=[^\s|>]*/gi,'').
+			//replace(/<p [^>]*TEXT-ALIGN: justify[^>]*>/gi,'<p align="justify">').
+			replace(/ style=\"[^>]*\"/gi,'').
+			replace(/ align=[^\s|>]*/gi,'');
+
+		//clean up tags
+		D = D.replace(/<b [^>]*>/gi,'<b>').
+			replace(/<i [^>]*>/gi,'<i>').
+			replace(/<li [^>]*>/gi,'<li>').
+			replace(/<ul [^>]*>/gi,'<ul>');
+
+		// replace outdated tags
+		D = D.replace(/<b>/gi,'<strong>').
+			replace(/<\/b>/gi,'</strong>');
+
+		// mozilla doesn't like <em> tags
+		D = D.replace(/<em>/gi,'<i>').
+			replace(/<\/em>/gi,'</i>');
+
+		// kill unwanted tags
+		D = D.replace(/<\?xml:[^>]*>/g, '').       // Word xml
+			replace(/<\/?st1:[^>]*>/g,'').     // Word SmartTags
+			replace(/<\/?[a-z]\:[^>]*>/g,'').  // All other funny Word non-HTML stuff
+			replace(/<\/?font[^>]*>/gi,'').    // Disable if you want to keep font formatting
+			replace(/<\/?span[^>]*>/gi,' ').
+			replace(/<\/?div[^>]*>/gi,' ').
+			replace(/<\/?pre[^>]*>/gi,' ').
+			replace(/<\/?h[1-6][^>]*>/gi,' ');
+
+		//remove empty tags
+		//D = D.replace(/<strong><\/strong>/gi,'').
+		//replace(/<i><\/i>/gi,'').
+		//replace(/<P[^>]*><\/P>/gi,'');
+
+		// nuke double tags
+		oldlen = D.length + 1;
+		while(oldlen > D.length) {
+			oldlen = D.length;
+			// join us now and free the tags, we'll be free hackers, we'll be free... ;-)
+			D = D.replace(/<([a-z][a-z]*)> *<\/\1>/gi,' ').
+				replace(/<([a-z][a-z]*)> *<([a-z][^>]*)> *<\/\1>/gi,'<$2>');
+		}
+		D = D.replace(/<([a-z][a-z]*)><\1>/gi,'<$1>').
+			replace(/<\/([a-z][a-z]*)><\/\1>/gi,'<\/$1>');
+
+		// nuke double spaces
+		D = D.replace(/  */gi,' ');
+
+		this.setHTML(D);
+		this.updateToolbar();
+	}
+};
+
+HTMLArea.prototype.forceRedraw = function() {
+	this._doc.body.style.visibility = "hidden";
+	this._doc.body.style.visibility = "visible";
+	// this._doc.body.innerHTML = this.getInnerHTML();
+};
+
+// focuses the iframe window.  returns a reference to the editor document.
+HTMLArea.prototype.focusEditor = function() {
+	switch (this._editMode) {
+	    case "wysiwyg" : this._iframe.contentWindow.focus(); break;
+	    case "textmode": this._textArea.focus(); break;
+	    default	   : alert("ERROR: mode " + this._editMode + " is not defined");
+	}
+	return this._doc;
+};
+
+// takes a snapshot of the current text (for undo)
+HTMLArea.prototype._undoTakeSnapshot = function() {
+	++this._undoPos;
+	if (this._undoPos >= this.config.undoSteps) {
+		// remove the first element
+		this._undoQueue.shift();
+		--this._undoPos;
+	}
+	// use the fasted method (getInnerHTML);
+	var take = true;
+	var txt = this.getInnerHTML();
+	if (this._undoPos > 0)
+		take = (this._undoQueue[this._undoPos - 1] != txt);
+	if (take) {
+		this._undoQueue[this._undoPos] = txt;
+	} else {
+		this._undoPos--;
+	}
+};
+
+HTMLArea.prototype.undo = function() {
+	if (this._undoPos > 0) {
+		var txt = this._undoQueue[--this._undoPos];
+		if (txt) this.setHTML(txt);
+		else ++this._undoPos;
+	}
+};
+
+HTMLArea.prototype.redo = function() {
+	if (this._undoPos < this._undoQueue.length - 1) {
+		var txt = this._undoQueue[++this._undoPos];
+		if (txt) this.setHTML(txt);
+		else --this._undoPos;
+	}
+};
+
+// updates enabled/disable/active state of the toolbar elements
+HTMLArea.prototype.updateToolbar = function(noStatus) {
+	var doc = this._doc;
+	var text = (this._editMode == "textmode");
+	var ancestors = null;
+	if (!text) {
+		ancestors = this.getAllAncestors();
+		if (this.config.statusBar && !noStatus) {
+			this._statusBarTree.innerHTML = HTMLArea.I18N.msg["Path"] + ": "; // clear
+			for (var i = ancestors.length; --i >= 0;) {
+				var el = ancestors[i];
+				if (!el) {
+					// hell knows why we get here; this
+					// could be a classic example of why
+					// it's good to check for conditions
+					// that are impossible to happen ;-)
+					continue;
+				}
+				var a = document.createElement("a");
+				a.href = "#";
+				a.el = el;
+				a.editor = this;
+				a.onclick = function() {
+					this.blur();
+					this.editor.selectNodeContents(this.el);
+					this.editor.updateToolbar(true);
+					return false;
+				};
+				a.oncontextmenu = function() {
+					// TODO: add context menu here
+					this.blur();
+					var info = "Inline style:\n\n";
+					info += this.el.style.cssText.split(/;\s*/).join(";\n");
+					alert(info);
+					return false;
+				};
+				var txt = el.tagName.toLowerCase();
+				a.title = el.style.cssText;
+				if (el.id) {
+					txt += "#" + el.id;
+				}
+				if (el.className) {
+					txt += "." + el.className;
+				}
+				a.appendChild(document.createTextNode(txt));
+				this._statusBarTree.appendChild(a);
+				if (i != 0) {
+					this._statusBarTree.appendChild(document.createTextNode(String.fromCharCode(0xbb)));
+				}
+			}
+		}
+	}
+	for (var i in this._toolbarObjects) {
+		var btn = this._toolbarObjects[i];
+		var cmd = i;
+		var inContext = true;
+		if (btn.context && !text) {
+			inContext = false;
+			var context = btn.context;
+			var attrs = [];
+			if (/(.*)\[(.*?)\]/.test(context)) {
+				context = RegExp.$1;
+				attrs = RegExp.$2.split(",");
+			}
+			context = context.toLowerCase();
+			var match = (context == "*");
+			for (var k in ancestors) {
+				if (!ancestors[k]) {
+					// the impossible really happens.
+					continue;
+				}
+				if (match || (ancestors[k].tagName.toLowerCase() == context)) {
+					inContext = true;
+					for (var ka in attrs) {
+						if (!eval("ancestors[k]." + attrs[ka])) {
+							inContext = false;
+							break;
+						}
+					}
+					if (inContext) {
+						break;
+					}
+				}
+			}
+		}
+		btn.state("enabled", (!text || btn.text) && inContext);
+		if (typeof cmd == "function") {
+			continue;
+		}
+		// look-it-up in the custom dropdown boxes
+		var dropdown = this.config.customSelects[cmd];
+		if ((!text || btn.text) && (typeof dropdown != "undefined")) {
+			dropdown.refresh(this);
+			continue;
+		}
+		switch (cmd) {
+		    case "fontname":
+		    case "fontsize":
+		    case "formatblock":
+			if (!text) try {
+				var value = ("" + doc.queryCommandValue(cmd)).toLowerCase();
+				if (!value) {
+					// FIXME: what do we do here?
+					break;
+				}
+				// HACK -- retrieve the config option for this
+				// combo box.  We rely on the fact that the
+				// variable in config has the same name as
+				// button name in the toolbar.
+				var options = this.config[cmd];
+				var k = 0;
+				// btn.element.selectedIndex = 0;
+				for (var j in options) {
+					// FIXME: the following line is scary.
+					if ((j.toLowerCase() == value) ||
+					    (options[j].substr(0, value.length).toLowerCase() == value)) {
+						btn.element.selectedIndex = k;
+						break;
+					}
+					++k;
+				}
+			} catch(e) {};
+			break;
+		    case "textindicator":
+			if (!text) {
+				try {with (btn.element.style) {
+					backgroundColor = HTMLArea._makeColor(
+						doc.queryCommandValue(HTMLArea.is_ie ? "backcolor" : "hilitecolor"));
+					if (/transparent/i.test(backgroundColor)) {
+						// Mozilla
+						backgroundColor = HTMLArea._makeColor(doc.queryCommandValue("backcolor"));
+					}
+					color = HTMLArea._makeColor(doc.queryCommandValue("forecolor"));
+					fontFamily = doc.queryCommandValue("fontname");
+					fontWeight = doc.queryCommandState("bold") ? "bold" : "normal";
+					fontStyle = doc.queryCommandState("italic") ? "italic" : "normal";
+				}} catch (e) {
+					// alert(e + "\n\n" + cmd);
+				}
+			}
+			break;
+		    case "htmlmode": btn.state("active", text); break;
+		    case "lefttoright":
+		    case "righttoleft":
+			var el = this.getParentElement();
+			while (el && !HTMLArea.isBlockElement(el))
+				el = el.parentNode;
+			if (el)
+				btn.state("active", (el.style.direction == ((cmd == "righttoleft") ? "rtl" : "ltr")));
+			break;
+		    default:
+			try {
+				btn.state("active", (!text && doc.queryCommandState(cmd)));
+			} catch (e) {}
+		}
+	}
+	// take undo snapshots
+	if (this._customUndo && !this._timerUndo) {
+		this._undoTakeSnapshot();
+		var editor = this;
+		this._timerUndo = setTimeout(function() {
+			editor._timerUndo = null;
+		}, this.config.undoTimeout);
+	}
+	// check if any plugins have registered refresh handlers
+	for (var i in this.plugins) {
+		var plugin = this.plugins[i].instance;
+		if (typeof plugin.onUpdateToolbar == "function")
+			plugin.onUpdateToolbar();
+	}
+};
+
+/** Returns a node after which we can insert other nodes, in the current
+ * selection.  The selection is removed.  It splits a text node, if needed.
+ */
+HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) {
+	if (!HTMLArea.is_ie) {
+		var sel = this._getSelection();
+		var range = this._createRange(sel);
+		// remove the current selection
+		sel.removeAllRanges();
+		range.deleteContents();
+		var node = range.startContainer;
+		var pos = range.startOffset;
+		switch (node.nodeType) {
+		    case 3: // Node.TEXT_NODE
+			// we have to split it at the caret position.
+			if (toBeInserted.nodeType == 3) {
+				// do optimized insertion
+				node.insertData(pos, toBeInserted.data);
+				range = this._createRange();
+				range.setEnd(node, pos + toBeInserted.length);
+				range.setStart(node, pos + toBeInserted.length);
+				sel.addRange(range);
+			} else {
+				node = node.splitText(pos);
+				var selnode = toBeInserted;
+				if (toBeInserted.nodeType == 11 /* Node.DOCUMENT_FRAGMENT_NODE */) {
+					selnode = selnode.firstChild;
+				}
+				node.parentNode.insertBefore(toBeInserted, node);
+				this.selectNodeContents(selnode);
+				this.updateToolbar();
+			}
+			break;
+		    case 1: // Node.ELEMENT_NODE
+			var selnode = toBeInserted;
+			if (toBeInserted.nodeType == 11 /* Node.DOCUMENT_FRAGMENT_NODE */) {
+				selnode = selnode.firstChild;
+			}
+			node.insertBefore(toBeInserted, node.childNodes[pos]);
+			this.selectNodeContents(selnode);
+			this.updateToolbar();
+			break;
+		}
+	} else {
+		return null;	// this function not yet used for IE <FIXME>
+	}
+};
+
+// Returns the deepest node that contains both endpoints of the selection.
+HTMLArea.prototype.getParentElement = function() {
+	var sel = this._getSelection();
+	var range = this._createRange(sel);
+	if (HTMLArea.is_ie) {
+		switch (sel.type) {
+		    case "Text":
+		    case "None":
+			// It seems that even for selection of type "None",
+			// there _is_ a parent element and it's value is not
+			// only correct, but very important to us.  MSIE is
+			// certainly the buggiest browser in the world and I
+			// wonder, God, how can Earth stand it?
+			return range.parentElement();
+		    case "Control":
+			return range.item(0);
+		    default:
+			return this._doc.body;
+		}
+	} else try {
+		var p = range.commonAncestorContainer;
+		if (!range.collapsed && range.startContainer == range.endContainer &&
+		    range.startOffset - range.endOffset <= 1 && range.startContainer.hasChildNodes())
+			p = range.startContainer.childNodes[range.startOffset];
+		/*
+		alert(range.startContainer + ":" + range.startOffset + "\n" +
+		      range.endContainer + ":" + range.endOffset);
+		*/
+		while (p.nodeType == 3) {
+			p = p.parentNode;
+		}
+		return p;
+	} catch (e) {
+		return null;
+	}
+};
+
+// Returns an array with all the ancestor nodes of the selection.
+HTMLArea.prototype.getAllAncestors = function() {
+	var p = this.getParentElement();
+	var a = [];
+	while (p && (p.nodeType == 1) && (p.tagName.toLowerCase() != 'body')) {
+		a.push(p);
+		p = p.parentNode;
+	}
+	a.push(this._doc.body);
+	return a;
+};
+
+// Selects the contents inside the given node
+HTMLArea.prototype.selectNodeContents = function(node, pos) {
+	this.focusEditor();
+	this.forceRedraw();
+	var range;
+	var collapsed = (typeof pos != "undefined");
+	if (HTMLArea.is_ie) {
+		range = this._doc.body.createTextRange();
+		range.moveToElementText(node);
+		(collapsed) && range.collapse(pos);
+		range.select();
+	} else {
+		var sel = this._getSelection();
+		range = this._doc.createRange();
+		range.selectNodeContents(node);
+		(collapsed) && range.collapse(pos);
+		sel.removeAllRanges();
+		sel.addRange(range);
+	}
+};
+
+/** Call this function to insert HTML code at the current position.  It deletes
+ * the selection, if any.
+ */
+HTMLArea.prototype.insertHTML = function(html) {
+	var sel = this._getSelection();
+	var range = this._createRange(sel);
+	if (HTMLArea.is_ie) {
+		range.pasteHTML(html);
+	} else {
+		// construct a new document fragment with the given HTML
+		var fragment = this._doc.createDocumentFragment();
+		var div = this._doc.createElement("div");
+		div.innerHTML = html;
+		while (div.firstChild) {
+			// the following call also removes the node from div
+			fragment.appendChild(div.firstChild);
+		}
+		// this also removes the selection
+		var node = this.insertNodeAtSelection(fragment);
+	}
+};
+
+/**
+ *  Call this function to surround the existing HTML code in the selection with
+ *  your tags.  FIXME: buggy!  This function will be deprecated "soon".
+ */
+HTMLArea.prototype.surroundHTML = function(startTag, endTag) {
+	var html = this.getSelectedHTML();
+	// the following also deletes the selection
+	this.insertHTML(startTag + html + endTag);
+};
+
+/// Retrieve the selected block
+HTMLArea.prototype.getSelectedHTML = function() {
+	var sel = this._getSelection();
+	var range = this._createRange(sel);
+	var existing = null;
+	if (HTMLArea.is_ie) {
+		existing = range.htmlText;
+	} else {
+		existing = HTMLArea.getHTML(range.cloneContents(), false, this);
+	}
+	return existing;
+};
+
+/// Return true if we have some selection
+HTMLArea.prototype.hasSelectedText = function() {
+	// FIXME: come _on_ mishoo, you can do better than this ;-)
+	return this.getSelectedHTML() != '';
+};
+
+HTMLArea.prototype._createLink = function(link) {
+	var editor = this;
+	var outparam = null;
+	if (typeof link == "undefined") {
+		link = this.getParentElement();
+		if (link && !/^a$/i.test(link.tagName))
+			link = null;
+	}
+	if (link) outparam = {
+		f_href   : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"),
+		f_title  : link.title,
+		f_target : link.target
+	};
+	this._popupDialog("link.html", function(param) {
+		if (!param)
+			return false;
+		var a = link;
+		if (!a) {
+			editor._doc.execCommand("createlink", false, param.f_href);
+			a = editor.getParentElement();
+			var sel = editor._getSelection();
+			var range = editor._createRange(sel);
+			if (!HTMLArea.is_ie) {
+				a = range.startContainer;
+				if (!/^a$/i.test(a.tagName))
+					a = a.nextSibling;
+			}
+		} else a.href = param.f_href.trim();
+		if (!/^a$/i.test(a.tagName))
+			return false;
+		a.target = param.f_target.trim();
+		a.title = param.f_title.trim();
+		editor.selectNodeContents(a);
+		editor.updateToolbar();
+	}, outparam);
+};
+
+// Called when the user clicks on "InsertImage" button.  If an image is already
+// there, it will just modify it's properties.
+HTMLArea.prototype._insertImage = function(image) {
+	var editor = this;	// for nested functions
+	var outparam = null;
+	if (typeof image == "undefined") {
+		image = this.getParentElement();
+		if (image && !/^img$/i.test(image.tagName))
+			image = null;
+	}
+	if (image) outparam = {
+		f_url    : HTMLArea.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"),
+		f_alt    : image.alt,
+		f_border : image.border,
+		f_align  : image.align,
+		f_vert   : image.vspace,
+		f_horiz  : image.hspace
+	};
+	this._popupDialog("insert_image.html", function(param) {
+		if (!param) {	// user must have pressed Cancel
+			return false;
+		}
+		var img = image;
+		if (!img) {
+			var sel = editor._getSelection();
+			var range = editor._createRange(sel);
+			editor._doc.execCommand("insertimage", false, param.f_url);
+			if (HTMLArea.is_ie) {
+				img = range.parentElement();
+				// wonder if this works...
+				if (img.tagName.toLowerCase() != "img") {
+					img = img.previousSibling;
+				}
+			} else {
+				img = range.startContainer.previousSibling;
+			}
+		} else {
+			img.src = param.f_url;
+		}
+		for (field in param) {
+			var value = param[field];
+			switch (field) {
+			    case "f_alt"    : img.alt	 = value; break;
+			    case "f_border" : img.border = parseInt(value || "0"); break;
+			    case "f_align"  : img.align	 = value; break;
+			    case "f_vert"   : img.vspace = parseInt(value || "0"); break;
+			    case "f_horiz"  : img.hspace = parseInt(value || "0"); break;
+			}
+		}
+	}, outparam);
+};
+
+// Called when the user clicks the Insert Table button
+HTMLArea.prototype._insertTable = function() {
+	var sel = this._getSelection();
+	var range = this._createRange(sel);
+	var editor = this;	// for nested functions
+	this._popupDialog("insert_table.html", function(param) {
+		if (!param) {	// user must have pressed Cancel
+			return false;
+		}
+		var doc = editor._doc;
+		// create the table element
+		var table = doc.createElement("table");
+		// assign the given arguments
+		for (var field in param) {
+			var value = param[field];
+			if (!value) {
+				continue;
+			}
+			switch (field) {
+			    case "f_width"   : table.style.width = value + param["f_unit"]; break;
+			    case "f_align"   : table.align	 = value; break;
+			    case "f_border"  : table.border	 = parseInt(value); break;
+			    case "f_spacing" : table.cellspacing = parseInt(value); break;
+			    case "f_padding" : table.cellpadding = parseInt(value); break;
+			}
+		}
+		var tbody = doc.createElement("tbody");
+		table.appendChild(tbody);
+		for (var i = 0; i < param["f_rows"]; ++i) {
+			var tr = doc.createElement("tr");
+			tbody.appendChild(tr);
+			for (var j = 0; j < param["f_cols"]; ++j) {
+				var td = doc.createElement("td");
+				tr.appendChild(td);
+				// Mozilla likes to see something inside the cell.
+				(HTMLArea.is_gecko) && td.appendChild(doc.createElement("br"));
+			}
+		}
+		if (HTMLArea.is_ie) {
+			range.pasteHTML(table.outerHTML);
+		} else {
+			// insert the table
+			editor.insertNodeAtSelection(table);
+		}
+		return true;
+	}, null);
+};
+
+/***************************************************
+ *  Category: EVENT HANDLERS
+ ***************************************************/
+
+// el is reference to the SELECT object
+// txt is the name of the select field, as in config.toolbar
+HTMLArea.prototype._comboSelected = function(el, txt) {
+	this.focusEditor();
+	var value = el.options[el.selectedIndex].value;
+	switch (txt) {
+	    case "fontname":
+	    case "fontsize": this.execCommand(txt, false, value); break;
+	    case "formatblock":
+		(HTMLArea.is_ie) && (value = "<" + value + ">");
+		this.execCommand(txt, false, value);
+		break;
+	    default:
+		// try to look it up in the registered dropdowns
+		var dropdown = this.config.customSelects[txt];
+		if (typeof dropdown != "undefined") {
+			dropdown.action(this);
+		} else {
+			alert("FIXME: combo box " + txt + " not implemented");
+		}
+	}
+};
+
+// the execCommand function (intercepts some commands and replaces them with
+// our own implementation)
+HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
+	var editor = this;	// for nested functions
+	this.focusEditor();
+	cmdID = cmdID.toLowerCase();
+	switch (cmdID) {
+	    case "htmlmode" : this.setMode(); break;
+	    case "hilitecolor":
+		(HTMLArea.is_ie) && (cmdID = "backcolor");
+	    case "forecolor":
+		this._popupDialog("select_color.html", function(color) {
+			if (color) { // selection not canceled
+				editor._doc.execCommand(cmdID, false, "#" + color);
+			}
+		}, HTMLArea._colorToRgb(this._doc.queryCommandValue(cmdID)));
+		break;
+	    case "createlink":
+		this._createLink();
+		break;
+	    case "popupeditor":
+		// this object will be passed to the newly opened window
+		HTMLArea._object = this;
+		if (HTMLArea.is_ie) {
+			//if (confirm(HTMLArea.I18N.msg["IE-sucks-full-screen"]))
+			{
+				window.open(this.popupURL("fullscreen.html"), "ha_fullscreen",
+					    "toolbar=no,location=no,directories=no,status=no,menubar=no," +
+					    "scrollbars=no,resizable=yes,width=640,height=480");
+			}
+		} else {
+			window.open(this.popupURL("fullscreen.html"), "ha_fullscreen",
+				    "toolbar=no,menubar=no,personalbar=no,width=640,height=480," +
+				    "scrollbars=no,resizable=yes");
+		}
+		break;
+	    case "undo":
+	    case "redo":
+		if (this._customUndo)
+			this[cmdID]();
+		else
+			this._doc.execCommand(cmdID, UI, param);
+		break;
+	    case "inserttable": this._insertTable(); break;
+	    case "insertimage": this._insertImage(); break;
+	    case "about"    : this._popupDialog("about.html", null, this); break;
+	    case "showhelp" : window.open(_editor_url + "reference.html", "ha_help"); break;
+
+	    case "killword": this._wordClean(); break;
+
+	    case "cut":
+	    case "copy":
+	    case "paste":
+		try {
+			if (this.config.killWordOnPaste)
+				this._wordClean();
+			this._doc.execCommand(cmdID, UI, param);
+		} catch (e) {
+			if (HTMLArea.is_gecko) {
+				if (confirm("Unprivileged scripts cannot access Cut/Copy/Paste programatically " +
+					    "for security reasons.  Click OK to see a technical note at mozilla.org " +
+					    "which shows you how to allow a script to access the clipboard."))
+					window.open("http://mozilla.org/editor/midasdemo/securityprefs.html");
+			}
+		}
+		break;
+	    case "lefttoright":
+	    case "righttoleft":
+		var dir = (cmdID == "righttoleft") ? "rtl" : "ltr";
+		var el = this.getParentElement();
+		while (el && !HTMLArea.isBlockElement(el))
+			el = el.parentNode;
+		if (el) {
+			if (el.style.direction == dir)
+				el.style.direction = "";
+			else
+				el.style.direction = dir;
+		}
+		break;
+	    default: this._doc.execCommand(cmdID, UI, param);
+	}
+	this.updateToolbar();
+	return false;
+};
+
+/** A generic event handler for things that happen in the IFRAME's document.
+ * This function also handles key bindings. */
+HTMLArea.prototype._editorEvent = function(ev) {
+	var editor = this;
+	var keyEvent = (HTMLArea.is_ie && ev.type == "keydown") || (ev.type == "keypress");
+	if (keyEvent) {
+		for (var i in editor.plugins) {
+			var plugin = editor.plugins[i].instance;
+			if (typeof plugin.onKeyPress == "function") plugin.onKeyPress(ev);
+		}
+	}
+	if (keyEvent && ev.ctrlKey) {
+		var sel = null;
+		var range = null;
+		var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase();
+		var cmd = null;
+		var value = null;
+		switch (key) {
+		    case 'a':
+			if (!HTMLArea.is_ie) {
+				// KEY select all
+				sel = this._getSelection();
+				sel.removeAllRanges();
+				range = this._createRange();
+				range.selectNodeContents(this._doc.body);
+				sel.addRange(range);
+				HTMLArea._stopEvent(ev);
+			}
+			break;
+
+			// simple key commands follow
+
+		    case 'b': cmd = "bold"; break;
+		    case 'i': cmd = "italic"; break;
+		    case 'u': cmd = "underline"; break;
+		    case 's': cmd = "strikethrough"; break;
+		    case 'l': cmd = "justifyleft"; break;
+		    case 'e': cmd = "justifycenter"; break;
+		    case 'r': cmd = "justifyright"; break;
+		    case 'j': cmd = "justifyfull"; break;
+		    case 'z': cmd = "undo"; break;
+		    case 'y': cmd = "redo"; break;
+		    case 'v': cmd = "paste"; break;
+
+		    case '0': cmd = "killword"; break;
+
+			// headings
+		    case '1':
+		    case '2':
+		    case '3':
+		    case '4':
+		    case '5':
+		    case '6':
+			cmd = "formatblock";
+			value = "h" + key;
+			if (HTMLArea.is_ie) {
+				value = "<" + value + ">";
+			}
+			break;
+		}
+		if (cmd) {
+			// execute simple command
+			this.execCommand(cmd, false, value);
+			HTMLArea._stopEvent(ev);
+		}
+	}
+	/*
+	else if (keyEvent) {
+		// other keys here
+		switch (ev.keyCode) {
+		    case 13: // KEY enter
+			// if (HTMLArea.is_ie) {
+			this.insertHTML("<br />");
+			HTMLArea._stopEvent(ev);
+			// }
+			break;
+		}
+	}
+	*/
+	// update the toolbar state after some time
+	if (editor._timerToolbar) {
+		clearTimeout(editor._timerToolbar);
+	}
+	editor._timerToolbar = setTimeout(function() {
+		editor.updateToolbar();
+		editor._timerToolbar = null;
+	}, 50);
+};
+
+// retrieve the HTML
+HTMLArea.prototype.getHTML = function() {
+	switch (this._editMode) {
+	    case "wysiwyg"  :
+		if (!this.config.fullPage) {
+			return HTMLArea.getHTML(this._doc.body, false, this);
+		} else
+			return this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true, this);
+	    case "textmode" : return this._textArea.value;
+	    default	    : alert("Mode <" + mode + "> not defined!");
+	}
+	return false;
+};
+
+// retrieve the HTML (fastest version, but uses innerHTML)
+HTMLArea.prototype.getInnerHTML = function() {
+	switch (this._editMode) {
+	    case "wysiwyg"  :
+		if (!this.config.fullPage)
+			return this._doc.body.innerHTML;
+		else
+			return this.doctype + "\n" + this._doc.documentElement.innerHTML;
+	    case "textmode" : return this._textArea.value;
+	    default	    : alert("Mode <" + mode + "> not defined!");
+	}
+	return false;
+};
+
+// completely change the HTML inside
+HTMLArea.prototype.setHTML = function(html) {
+	switch (this._editMode) {
+	    case "wysiwyg"  :
+		if (!this.config.fullPage)
+			this._doc.body.innerHTML = html;
+		else
+			// this._doc.documentElement.innerHTML = html;
+			this._doc.body.innerHTML = html;
+		break;
+	    case "textmode" : this._textArea.value = html; break;
+	    default	    : alert("Mode <" + mode + "> not defined!");
+	}
+	return false;
+};
+
+// sets the given doctype (useful when config.fullPage is true)
+HTMLArea.prototype.setDoctype = function(doctype) {
+	this.doctype = doctype;
+};
+
+/***************************************************
+ *  Category: UTILITY FUNCTIONS
+ ***************************************************/
+
+// browser identification
+
+HTMLArea.agt = navigator.userAgent.toLowerCase();
+HTMLArea.is_ie	   = ((HTMLArea.agt.indexOf("msie") != -1) && (HTMLArea.agt.indexOf("opera") == -1));
+HTMLArea.is_opera  = (HTMLArea.agt.indexOf("opera") != -1);
+HTMLArea.is_mac	   = (HTMLArea.agt.indexOf("mac") != -1);
+HTMLArea.is_mac_ie = (HTMLArea.is_ie && HTMLArea.is_mac);
+HTMLArea.is_win_ie = (HTMLArea.is_ie && !HTMLArea.is_mac);
+HTMLArea.is_gecko  = (navigator.product == "Gecko");
+
+// variable used to pass the object to the popup editor window.
+HTMLArea._object = null;
+
+// function that returns a clone of the given object
+HTMLArea.cloneObject = function(obj) {
+	var newObj = new Object;
+
+	// check for array objects
+	if (obj.constructor.toString().indexOf("function Array(") == 1) {
+		newObj = obj.constructor();
+	}
+
+	// check for function objects (as usual, IE is fucked up)
+	if (obj.constructor.toString().indexOf("function Function(") == 1) {
+		newObj = obj; // just copy reference to it
+	} else for (var n in obj) {
+		var node = obj[n];
+		if (typeof node == 'object') { newObj[n] = HTMLArea.cloneObject(node); }
+		else                         { newObj[n] = node; }
+	}
+
+	return newObj;
+};
+
+// FIXME!!! this should return false for IE < 5.5
+HTMLArea.checkSupportedBrowser = function() {
+	if (HTMLArea.is_gecko) {
+		if (navigator.productSub < 20021201) {
+			alert("You need at least Mozilla-1.3 Alpha.\n" +
+			      "Sorry, your Gecko is not supported.");
+			return false;
+		}
+		if (navigator.productSub < 20030210) {
+			alert("Mozilla < 1.3 Beta is not supported!\n" +
+			      "I'll try, though, but it might not work.");
+		}
+	}
+	return HTMLArea.is_gecko || HTMLArea.is_ie;
+};
+
+// selection & ranges
+
+// returns the current selection object
+HTMLArea.prototype._getSelection = function() {
+	if (HTMLArea.is_ie) {
+		return this._doc.selection;
+	} else {
+		return this._iframe.contentWindow.getSelection();
+	}
+};
+
+// returns a range for the current selection
+HTMLArea.prototype._createRange = function(sel) {
+	if (HTMLArea.is_ie) {
+		return sel.createRange();
+	} else {
+		this.focusEditor();
+		if (typeof sel != "undefined") {
+			try {
+				return sel.getRangeAt(0);
+			} catch(e) {
+				return this._doc.createRange();
+			}
+		} else {
+			return this._doc.createRange();
+		}
+	}
+};
+
+// event handling
+
+HTMLArea._addEvent = function(el, evname, func) {
+	if (HTMLArea.is_ie) {
+		el.attachEvent("on" + evname, func);
+	} else {
+		el.addEventListener(evname, func, true);
+	}
+};
+
+HTMLArea._addEvents = function(el, evs, func) {
+	for (var i in evs) {
+		HTMLArea._addEvent(el, evs[i], func);
+	}
+};
+
+HTMLArea._removeEvent = function(el, evname, func) {
+	if (HTMLArea.is_ie) {
+		el.detachEvent("on" + evname, func);
+	} else {
+		el.removeEventListener(evname, func, true);
+	}
+};
+
+HTMLArea._removeEvents = function(el, evs, func) {
+	for (var i in evs) {
+		HTMLArea._removeEvent(el, evs[i], func);
+	}
+};
+
+HTMLArea._stopEvent = function(ev) {
+	if (HTMLArea.is_ie) {
+		ev.cancelBubble = true;
+		ev.returnValue = false;
+	} else {
+		ev.preventDefault();
+		ev.stopPropagation();
+	}
+};
+
+HTMLArea._removeClass = function(el, className) {
+	if (!(el && el.className)) {
+		return;
+	}
+	var cls = el.className.split(" ");
+	var ar = new Array();
+	for (var i = cls.length; i > 0;) {
+		if (cls[--i] != className) {
+			ar[ar.length] = cls[i];
+		}
+	}
+	el.className = ar.join(" ");
+};
+
+HTMLArea._addClass = function(el, className) {
+	// remove the class first, if already there
+	HTMLArea._removeClass(el, className);
+	el.className += " " + className;
+};
+
+HTMLArea._hasClass = function(el, className) {
+	if (!(el && el.className)) {
+		return false;
+	}
+	var cls = el.className.split(" ");
+	for (var i = cls.length; i > 0;) {
+		if (cls[--i] == className) {
+			return true;
+		}
+	}
+	return false;
+};
+
+HTMLArea.isBlockElement = function(el) {
+	var blockTags = " body form textarea fieldset ul ol dl li div " +
+		"p h1 h2 h3 h4 h5 h6 quote pre table thead " +
+		"tbody tfoot tr td iframe address ";
+	return (blockTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1);
+};
+
+HTMLArea.needsClosingTag = function(el) {
+	var closingTags = " head script style div span tr td tbody table em strong font a title ";
+	return (closingTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1);
+};
+
+// performs HTML encoding of some given string
+HTMLArea.htmlEncode = function(str) {
+	// we don't need regexp for that, but.. so be it for now.
+	str = str.replace(/&/ig, "&amp;");
+	str = str.replace(/</ig, "&lt;");
+	str = str.replace(/>/ig, "&gt;");
+	str = str.replace(/\x22/ig, "&quot;");
+	// \x22 means '"' -- we use hex reprezentation so that we don't disturb
+	// JS compressors (well, at least mine fails.. ;)
+	return str;
+};
+
+// Retrieves the HTML code from the given node.	 This is a replacement for
+// getting innerHTML, using standard DOM calls.
+HTMLArea.getHTML = function(root, outputRoot, editor) {
+	var html = "";
+	switch (root.nodeType) {
+	    case 1: // Node.ELEMENT_NODE
+	    case 11: // Node.DOCUMENT_FRAGMENT_NODE
+		var closed;
+		var i;
+		var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : '';
+		if (HTMLArea.is_ie && root_tag == "head") {
+			if (outputRoot)
+				html += "<head>";
+			// lowercasize
+			var save_multiline = RegExp.multiline;
+			RegExp.multiline = true;
+			var txt = root.innerHTML.replace(HTMLArea.RE_tagName, function(str, p1, p2) {
+				return p1 + p2.toLowerCase();
+			});
+			RegExp.multiline = save_multiline;
+			html += txt;
+			if (outputRoot)
+				html += "</head>";
+			break;
+		} else if (outputRoot) {
+			closed = (!(root.hasChildNodes() || HTMLArea.needsClosingTag(root)));
+			html = "<" + root.tagName.toLowerCase();
+			var attrs = root.attributes;
+			for (i = 0; i < attrs.length; ++i) {
+				var a = attrs.item(i);
+				if (!a.specified) {
+					continue;
+				}
+				var name = a.nodeName.toLowerCase();
+				if (/_moz|contenteditable|_msh/.test(name)) {
+					// avoid certain attributes
+					continue;
+				}
+				var value;
+				if (name != "style") {
+					// IE5.5 reports 25 when cellSpacing is
+					// 1; other values might be doomed too.
+					// For this reason we extract the
+					// values directly from the root node.
+					// I'm starting to HATE JavaScript
+					// development.  Browser differences
+					// suck.
+					//
+					// Using Gecko the values of href and src are converted to absolute links
+					// unless we get them using nodeValue()
+					if (typeof root[a.nodeName] != "undefined" && name != "href" && name != "src") {
+						value = root[a.nodeName];
+					} else {
+						value = a.nodeValue;
+						// IE seems not willing to return the original values - it converts to absolute
+						// links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href")
+						// So we have to strip the baseurl manually -/
+						if (HTMLArea.is_ie && (name == "href" || name == "src")) {
+							value = editor.stripBaseURL(value);
+						}
+					}
+				} else { // IE fails to put style in attributes list
+					// FIXME: cssText reported by IE is UPPERCASE
+					value = root.style.cssText;
+				}
+				if (/(_moz|^$)/.test(value)) {
+					// Mozilla reports some special tags
+					// here; we don't need them.
+					continue;
+				}
+				html += " " + name + '="' + value + '"';
+			}
+			html += closed ? " />" : ">";
+		}
+		for (i = root.firstChild; i; i = i.nextSibling) {
+			html += HTMLArea.getHTML(i, true, editor);
+		}
+		if (outputRoot && !closed) {
+			html += "</" + root.tagName.toLowerCase() + ">";
+		}
+		break;
+	    case 3: // Node.TEXT_NODE
+		// If a text node is alone in an element and all spaces, replace it with an non breaking one
+		// This partially undoes the damage done by moz, which translates '&nbsp;'s into spaces in the data element
+		if ( !root.previousSibling && !root.nextSibling && root.data.match(/^\s*$/i) ) html = '&nbsp;';
+		else html = HTMLArea.htmlEncode(root.data);
+		break;
+	    case 8: // Node.COMMENT_NODE
+		html = "<!--" + root.data + "-->";
+		break;		// skip comments, for now.
+	}
+	return html;
+};
+
+HTMLArea.prototype.stripBaseURL = function(string) {
+	var baseurl = this.config.baseURL;
+
+	// strip to last directory in case baseurl points to a file
+	baseurl = baseurl.replace(/[^\/]+$/, '');
+	var basere = new RegExp(baseurl);
+	string = string.replace(basere, "");
+
+	// strip host-part of URL which is added by MSIE to links relative to server root
+	baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1');
+	basere = new RegExp(baseurl);
+	return string.replace(basere, "");
+};
+
+String.prototype.trim = function() {
+	a = this.replace(/^\s+/, '');
+	return a.replace(/\s+$/, '');
+};
+
+// creates a rgb-style color from a number
+HTMLArea._makeColor = function(v) {
+	if (typeof v != "number") {
+		// already in rgb (hopefully); IE doesn't get here.
+		return v;
+	}
+	// IE sends number; convert to rgb.
+	var r = v & 0xFF;
+	var g = (v >> 8) & 0xFF;
+	var b = (v >> 16) & 0xFF;
+	return "rgb(" + r + "," + g + "," + b + ")";
+};
+
+// returns hexadecimal color representation from a number or a rgb-style color.
+HTMLArea._colorToRgb = function(v) {
+	if (!v)
+		return '';
+
+	// returns the hex representation of one byte (2 digits)
+	function hex(d) {
+		return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
+	};
+
+	if (typeof v == "number") {
+		// we're talking to IE here
+		var r = v & 0xFF;
+		var g = (v >> 8) & 0xFF;
+		var b = (v >> 16) & 0xFF;
+		return "#" + hex(r) + hex(g) + hex(b);
+	}
+
+	if (v.substr(0, 3) == "rgb") {
+		// in rgb(...) form -- Mozilla
+		var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
+		if (v.match(re)) {
+			var r = parseInt(RegExp.$1);
+			var g = parseInt(RegExp.$2);
+			var b = parseInt(RegExp.$3);
+			return "#" + hex(r) + hex(g) + hex(b);
+		}
+		// doesn't match RE?!  maybe uses percentages or float numbers
+		// -- FIXME: not yet implemented.
+		return null;
+	}
+
+	if (v.substr(0, 1) == "#") {
+		// already hex rgb (hopefully :D )
+		return v;
+	}
+
+	// if everything else fails ;)
+	return null;
+};
+
+// modal dialogs for Mozilla (for IE we're using the showModalDialog() call).
+
+// receives an URL to the popup dialog and a function that receives one value;
+// this function will get called after the dialog is closed, with the return
+// value of the dialog.
+HTMLArea.prototype._popupDialog = function(url, action, init) {
+	Dialog(this.popupURL(url), action, init);
+};
+
+// paths
+
+HTMLArea.prototype.imgURL = function(file, plugin) {
+	if (typeof plugin == "undefined")
+		return _editor_url + file;
+	else
+		return _editor_url + "plugins/" + plugin + "/img/" + file;
+};
+
+HTMLArea.prototype.popupURL = function(file) {
+	var url = "";
+	if (file.match(/^plugin:\/\/(.*?)\/(.*)/)) {
+		var plugin = RegExp.$1;
+		var popup = RegExp.$2;
+		if (!/\.html$/.test(popup))
+			popup += ".html";
+		url = _editor_url + "plugins/" + plugin + "/popups/" + popup;
+	} else
+		url = _editor_url + this.config.popupURL + file;
+	return url;
+};
+
+/**
+ * FIX: Internet Explorer returns an item having the _name_ equal to the given
+ * id, even if it's not having any id.  This way it can return a different form
+ * field even if it's not a textarea.  This workarounds the problem by
+ * specifically looking to search only elements having a certain tag name.
+ */
+HTMLArea.getElementById = function(tag, id) {
+	var el, i, objs = document.getElementsByTagName(tag);
+	for (i = objs.length; --i >= 0 && (el = objs[i]);)
+		if (el.id == id)
+			return el;
+	return null;
+};
+
+
+
+// EOF
+// Local variables: //
+// c-basic-offset:8 //
+// indent-tabs-mode:t //
+// End: //
Index: /temp/trunk/html/test/nakatest/HTMLArea/release-notes.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/release-notes.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/release-notes.html	(revision 1328)
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>HTMLArea-3.0-rc1 release notes</title>
+    <style>
+      .fixme { color: red; }
+    </style>
+  </head>
+
+  <body>
+
+    <h1>HTMLArea-3.0-rc1 release notes</h1>
+
+    <p>This release was compiled on Mar  1, 2004 [19:37] GMT.</p>
+
+    <h2>3.0-rc1</h2>
+
+    <p>Changes since 3.0-Beta:</p>
+
+    <ul>
+      <li>
+        <b>New plugins</b>
+        <ul>
+          <li>
+            ContextMenu plugin (provides a nice context menu with common
+            operations, including table ops, link ops, etc.)
+          </li>
+          <li>
+            CSS plugin (provides an easy way to insert/change CSS classes)
+          </li>
+          <li>
+            FullPage plugin (allows HTMLArea to edit a whole HTML file,
+            not only the content within &lt;body&gt;.)
+          </li>
+        </ul>
+      </li>
+      <li>
+        <b>Changes in the SpellChecker plugin</b>
+        <ul>
+          <li>
+            Many bugfixes: now it works ;-)  Fully Unicode-safe.
+          </li>
+          <li>
+            Speed and bandwidth optimization: reports the list of
+            suggestions only once for each mispelled word; this helps
+            in cases where you have, for instance, the word “HTMLArea”
+            in 10 places all over the document; the list of
+            suggestions for it--which is kind of huge--will only be
+            included <em>once</em>.
+          </li>
+          <li>
+            User interface improvements: the highlighted word will
+            remain in view; in cases where it's normally outside, the
+            window will be scrolled to it.
+          </li>
+          <li>
+            Added a "Revert" button for those that change their minds ;-)
+          </li>
+          <li>
+            Added a "Info" button which reports information about the
+            document, retrieved by the server-side spell checker:
+            total number of words, total number of mispelled words,
+            number of suggestions made, spell check time, etc.  More
+            can be easily added.  <span class="fixme">FIXME: this part
+            is not yet internationalized.</span>
+          </li>
+          <li>
+            The server-side spell checker now uses XML::DOM instead of
+            HTML::Parser, which means that it will be unable to parse
+            “tag-soup” HTML.  It needs valid code.  Usually HTMLArea
+            generates valid code, but on rare occasions it might fail
+            and the spell checker will report a gross error message.
+            This gonna have to be fixed, but instead of making the
+            spell checker accept invalid HTML I prefer to make
+            HTMLArea generate valid code, so changes are to be done in
+            other places ;-)
+          </li>
+        </ul>
+      </li>
+      <li>
+        <b>Changes in the core editor</b>
+        <ul>
+          <li>
+            Easier to setup: you only need to load
+            <tt>htmlarea.js</tt>; other scripts will be loaded
+            automatically.  <a href="reference.html">Documentation</a>
+            and <a href="examples/">examples</a> updated.
+          </li>
+          <li>
+            Better plugin support (they register information about
+            themselves with the editor; can register event handlers for
+            the editor, etc.)
+          </li>
+          <li>
+            New about box; check it out, it's cool ;-)
+          </li>
+          <li>
+            Word cleaner (can be enabled to automatically kill Word crap
+            on paste (see Config.killWordOnPaste); otherwise accessible by
+            pressing CTRL-0 in the editor; a toolbar button will come up
+            soon)
+          </li>
+          <li>
+            Image preview in "insert image" dialog.  Also allows
+            modification of current image, if selected.
+          </li>
+          <li>
+            New "insert link" dialog, allows target and title
+            specification, allows editing links.
+          </li>
+          <li>
+            Implemented support for text direction (left-to-right or
+            right-to-left).
+          </li>
+          <li>
+            Lots of bug fixes!  ... and more, I guess ;-) an
+            automatically generated <a href="ChangeLog">change log</a>
+            is now available.
+          </li>
+        </ul>
+      </li>
+    </ul>
+
+    <p>I don't have the power to go through the <a
+href="http://sourceforge.net/tracker/?atid=525656&group_id=69750&func=browse">bug
+system</a> at SourceForge
+    now.  Some of the bugs reported there may be fixed; I'll update
+    their status, some other time.  If you reported bugs there and now
+    find them to be fixed, please let me know.</p>
+
+    <h2>3.0-Beta</h2>
+
+    <p>Changes since 3.0-Alpha:</p>
+
+    <ul>
+
+      <li>Performance improvements.</li>
+
+      <li>Many bugs fixed.</li>
+
+      <li>Plugin infrastructure.</li>
+
+      <li>TableOperations plugin.</li>
+
+      <li>SpellChecker plugin.</li>
+
+      <li>Status bar.</li>
+
+      <li>API for registering custom buttons and drop-down boxes in the
+        toolbar.</li>
+
+      <li>Toolbar can contain text labels.</li>
+
+      <li>Cut, copy, paste, undo, redo buttons.</li>
+
+    </ul>
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Sun Aug  3 16:55:08 EEST 2003 -->
+<!-- hhmts start --> Last modified: Sun Feb  1 13:16:10 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
+
+
Index: /temp/trunk/html/test/nakatest/HTMLArea/dialog.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/dialog.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/dialog.js	(revision 1328)
@@ -0,0 +1,72 @@
+// htmlArea v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc.
+// This copyright notice MUST stay intact for use (see license.txt).
+//
+// Portions (c) dynarch.com, 2003-2004
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon.
+//   http://dynarch.com/mishoo
+//
+// $Id$
+
+// Though "Dialog" looks like an object, it isn't really an object.  Instead
+// it's just namespace for protecting global symbols.
+
+function Dialog(url, action, init) {
+	if (typeof init == "undefined") {
+		init = window;	// pass this window object by default
+	}
+	Dialog._geckoOpenModal(url, action, init);
+};
+
+Dialog._parentEvent = function(ev) {
+	if (Dialog._modal && !Dialog._modal.closed) {
+		Dialog._modal.focus();
+		HTMLArea._stopEvent(ev);
+	}
+};
+
+// should be a function, the return handler of the currently opened dialog.
+Dialog._return = null;
+
+// constant, the currently opened dialog
+Dialog._modal = null;
+
+// the dialog will read it's args from this variable
+Dialog._arguments = null;
+
+Dialog._geckoOpenModal = function(url, action, init) {
+	var dlg = window.open(url, "hadialog",
+			      "toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
+			      "scrollbars=no,resizable=yes");
+	Dialog._modal = dlg;
+	Dialog._arguments = init;
+
+	// capture some window's events
+	function capwin(w) {
+		HTMLArea._addEvent(w, "click", Dialog._parentEvent);
+		HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent);
+		HTMLArea._addEvent(w, "focus", Dialog._parentEvent);
+	};
+	// release the captured events
+	function relwin(w) {
+		HTMLArea._removeEvent(w, "click", Dialog._parentEvent);
+		HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent);
+		HTMLArea._removeEvent(w, "focus", Dialog._parentEvent);
+	};
+	capwin(window);
+	// capture other frames
+	for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
+	// make up a function to be called when the Dialog ends.
+	Dialog._return = function (val) {
+		if (val && action) {
+			action(val);
+		}
+		relwin(window);
+		// capture other frames
+		for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
+		Dialog._modal = null;
+	};
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/index.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/index.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/index.html	(revision 1328)
@@ -0,0 +1,199 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
+<html>
+  <head>
+    <title>HTMLArea -- the free, customizable online editor</title>
+
+    <style type="text/css">
+      html, body { font-family: georgia,"times new roman",serif; background-color: #fff; color: #000; }
+      .label { text-align: right; padding-right: 0.3em; }
+      .bline { border-bottom: 1px solid #aaa; }
+    </style>
+  </head>
+
+  <body>
+    <div style="float: right; border: 1px solid #aaa; background-color: #eee; padding: 3px; margin-left: 10px; margin-bottom: 10px;">
+      <table cellspacing="0" cellpadding="0" border="0">
+        <tr>
+          <td class="label">Version:</td><td>3.0</td>
+        </tr>
+        <tr>
+          <td class="label">Release:</td><td>rc1 (<a href="release-notes.html">release notes</a>)</td>
+        </tr>
+        <tr>
+          <td class="label bline">Compiled at:</td><td class="bline">Mar  1, 2004 [19:37] GMT</td>
+        </tr>
+        <tr>
+          <td class="label">SourceForge page:</td><td><a href="http://sf.net/projects/itools-htmlarea/">http://sf.net/projects/itools-htmlarea/</a></td>
+      </table>
+    </div>
+    <h1>HTMLArea -- the free<br/>customizable online editor</h1>
+
+    <p>
+      HTMLArea is a free, customizable online editor.  It works inside your
+      browser.  It uses a non-standard feature implemented in Internet
+      Explorer 5.5 or better for Windows and Mozilla 1.3 or better (any
+      platform), therefore it will only work in one of these browsers.
+    </p>
+
+    <p>
+      HTMLArea is copyright <a
+      href="http://interactivetools.com">InteractiveTools.com</a> and <a
+      href="http://dynarch.com">Dynarch.com</a> and it is
+      released under a BSD-style license.  HTMLArea is created and developed
+      upto version 2.03 by InteractiveTools.com.  Version 3.0 developed by
+      <a href="http://dynarch.com/mishoo/">Mihai Bazon</a> for
+      InteractiveTools.  It contains code sponsored by third-party companies as well.
+      Please see our About Box for details about who sponsored what plugins.
+    </p>
+
+    <h2>Online demos</h2>
+
+    <ul>
+
+      <li><a href="examples/core.html">HTMLArea standard</a> -- contains the core
+        editor.</li>
+
+      <li><a href="examples/table-operations.html">HTMLArea + tables</a> --
+        loads the <tt>TableOperations</tt> plugin which provides some extra
+        editing features for tables.</li>
+
+      <li><a href="examples/spell-checker.html">HTMLArea + spell checher</a>
+        -- loads the <tt>SpellChecker</tt> plugin which provides what its
+        name says: a spell checker.  This one requires additional support on
+        the server-side.</li>
+
+      <li><a href="examples/full-page.html">HTMLArea Full HTML Editor</a> --
+        loads the <tt>FullPage</tt> plugin which allows you to edit a full
+        HTML page, including &lt;title&gt;, &lt;!DOCTYPE...&gt; and some
+        other options.</li>
+
+      <li><a href="examples/context-menu.html">HTMLArea with Context
+          Menu</a> -- this plugin provides a nice and useful context menu.</li>
+
+      <li><a href="examples/fully-loaded.html">HTMLArea fully loaded</a> --
+        all of the above. ;-)</li>
+
+    </ul>
+
+    <h2>Installation</h2>
+
+    <p>
+      Installation is (or should be) easy.  You need to unpack the ZIP file
+      in a directory accessible through your webserver.  Supposing you
+      unpack in your <tt>DocumentRoot</tt> and your <tt>DocumentRoot</tt> is
+      <tt>/var/www/html</tt> as in a standard RedHat installation, you need
+      to acomplish the following steps: (the example is for a Unix-like
+      operating system)
+    </p>
+
+    <pre style="margin-left: 2em"
+>
+cd /var/www/html
+unzip /path/to/archive/HTMLArea-3.0-rc1.zip
+mv HTMLArea-3.0-rc1 htmlarea
+find htmlarea/ -type f -exec chmod 644 {} \;
+find htmlarea/ -type d -exec chmod 755 {} \;
+find htmlarea/ -name "*.cgi" -exec chmod 755 {} \;</pre>
+
+    <p>
+      <strong>Notes.</strong> You may chose to symlink "htmlarea" to "HTMLArea-3.0-rc1", in which case your server needs to be configured to
+      "<tt>FollowSymLinks</tt>".  You need to make sure that *.cgi files are
+      interpreted as CGI scripts.  If you want to use the SpellChecker
+      plugin you need to have a recent version of Perl installed (I
+      recommend 5.8.0) on the server, and the module Text::Aspell, available
+      from CPAN.  More info in "<a
+      href="plugins/SpellChecker/readme-tech.html">plugins/SpellChecker/readme-tech.html</a>".
+    </p>
+
+    <p>About how to setup your pages to use the editor, please read the
+      [outdated yet generally valid] <a
+        href="reference.html">documentation</a>.</p>
+
+    <h2>Status and links</h2>
+
+    <p>HTMLArea has reached version 3.0.  As of this version, it
+      supports:</p>
+
+    <ul>
+
+      <li>Customizable toolbar</li>
+
+      <li>Easy internationalization</li>
+
+      <li>Plugin-based infrastructure</li>
+
+      <li>Delivers W3-compliant HTML (with few exceptions)</li>
+
+      <li>Has a subset of Microsoft Word's keyboard shortcuts</li>
+
+      <li>Full-screen editor</li>
+
+      <li>Advanced table operations (by external plugin
+        "TableOperations")</li>
+
+      <li>Spell checker (by external plugin "SpellChecker")</li>
+
+      <li>probably more... ;-)</li>
+
+    </ul>
+
+    <p>We have a <a
+    href="http://sourceforge.net/projects/itools-htmlarea/">project page</a>
+    at <a href="http://sourceforge.net">SourceForge.net</a>.  There you can
+    also find out <a href="http://sourceforge.net/cvs/?group_id=69750">how
+    to retrieve the code from CVS</a>, or you can <a
+    href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/itools-htmlarea">browse
+    the CVS online</a>.  We also have a <a
+    href="http://sourceforge.net/tracker/?atid=525656&group_id=69750&func=browse">bug
+    system</a>, a <a
+    href="http://sourceforge.net/tracker/?atid=525658&group_id=69750&func=browse">patch
+    tracking system</a> and a <a
+    href="http://sourceforge.net/tracker/?atid=525659&group_id=69750&func=browse">feature
+    request page</a>.</p>
+
+    <p>We invite you to say everything you want about HTMLArea <a
+    href="http://www.interactivetools.com/forum/gforum.cgi?forum=14;">on the
+    forums</a> at InteractiveTools.com.  There you should also find the
+    latest news.</p>
+
+    <p>Sometimes I post news about the latest developments on <a
+    href="http://dynarch.com/mishoo/">my personal homepage</a>.</p>
+
+    <h2>"It doesn't work, what's wrong?"</h2>
+
+    <p>If it doesn't work, you have several options:</p>
+
+    <ul>
+
+      <li>Post a message to the forum.  Describe your problem in as much
+      detail as possible.  Include errors you might find in the JavaScript
+      console (if you are a Mozilla user), or errors displayed by IE (though
+      they're most of the times useless).</li>
+
+      <li>If you're positive that you discovered a bug in HTMLArea then feel
+      free to fill a bug report in our bug system.  If you have the time you
+      should check to see if a similar bug was reported or not; it might be
+      fixed already in the CVS ;-) If you're positive that a similar bug was
+      not yet reported, do fill a bug report and please include as much
+      detail as possible, such as your browser, OS, errors from JavaScript
+      console, etc.</li>
+
+      <li>If you want a new feature to be implemented, post it on the
+      features request and someone will hopefully take care of it.</li>
+
+    </ul>
+
+    <p>You can <a href="mailto:mishoo@infoiasi.ro">contact me directly</a>
+    <em>only</em> if you want to pay me for implementing custom features to
+    HTMLArea.  If you want to sponsor these features (that is, allow them to
+    get back into the public HTMLArea distribution) I'll be cheaper. ;-)</p>
+
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Sun Aug  3 14:11:26 EEST 2003 -->
+<!-- hhmts start --> Last modified: Wed Jan 28 11:54:47 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
+
+
Index: /temp/trunk/html/test/nakatest/HTMLArea/popupwin.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popupwin.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popupwin.js	(revision 1328)
@@ -0,0 +1,139 @@
+// (c) dynarch.com 2003-2004
+// Distributed under the same terms as HTMLArea itself.
+
+function PopupWin(editor, title, handler, initFunction) {
+	this.editor = editor;
+	this.handler = handler;
+	var dlg = window.open("", "__ha_dialog",
+			      "toolbar=no,menubar=no,personalbar=no,width=600,height=600,left=20,top=40" +
+			      "scrollbars=no,resizable=no");
+	this.window = dlg;
+	var doc = dlg.document;
+	this.doc = doc;
+	var self = this;
+
+	var base = document.baseURI || document.URL;
+	if (base && base.match(/(.*)\/([^\/]+)/)) {
+		base = RegExp.$1 + "/";
+	}
+	if (typeof _editor_url != "undefined" && !/^\//.test(_editor_url)) {
+		// _editor_url doesn't start with '/' which means it's relative
+		// FIXME: there's a problem here, it could be http:// which
+		// doesn't start with slash but it's not relative either.
+		base += _editor_url;
+	} else
+		base = _editor_url;
+	if (!/\/$/.test(base)) {
+		// base does not end in slash, add it now
+		base += '/';
+	}
+	this.baseURL = base;
+
+	doc.open();
+	var html = "<html><head><title>" + title + "</title>\n";
+	// html += "<base href='" + base + "htmlarea.js' />\n";
+	html += "<style type='text/css'>@import url(" + base + "htmlarea.css);</style></head>\n";
+	html += "<body class='dialog popupwin' id='--HA-body'></body></html>";
+	doc.write(html);
+	doc.close();
+
+	// sometimes I Hate Mozilla... ;-(
+	function init2() {
+		var body = doc.body;
+		if (!body) {
+			setTimeout(init2, 25);
+			return false;
+		}
+		dlg.title = title;
+		doc.documentElement.style.padding = "0px";
+		doc.documentElement.style.margin = "0px";
+		var content = doc.createElement("div");
+		content.className = "content";
+		self.content = content;
+		body.appendChild(content);
+		self.element = body;
+		initFunction(self);
+		dlg.focus();
+	};
+	init2();
+};
+
+PopupWin.prototype.callHandler = function() {
+	var tags = ["input", "textarea", "select"];
+	var params = new Object();
+	for (var ti in tags) {
+		var tag = tags[ti];
+		var els = this.content.getElementsByTagName(tag);
+		for (var j = 0; j < els.length; ++j) {
+			var el = els[j];
+			var val = el.value;
+			if (el.tagName.toLowerCase() == "input") {
+				if (el.type == "checkbox") {
+					val = el.checked;
+				}
+			}
+			params[el.name] = val;
+		}
+	}
+	this.handler(this, params);
+	return false;
+};
+
+PopupWin.prototype.close = function() {
+	this.window.close();
+};
+
+PopupWin.prototype.addButtons = function() {
+	var self = this;
+	var div = this.doc.createElement("div");
+	this.content.appendChild(div);
+	div.className = "buttons";
+	for (var i = 0; i < arguments.length; ++i) {
+		var btn = arguments[i];
+		var button = this.doc.createElement("button");
+		div.appendChild(button);
+		button.innerHTML = HTMLArea.I18N.buttons[btn];
+		switch (btn) {
+		    case "ok":
+			button.onclick = function() {
+				self.callHandler();
+				self.close();
+				return false;
+			};
+			break;
+		    case "cancel":
+			button.onclick = function() {
+				self.close();
+				return false;
+			};
+			break;
+		}
+	}
+};
+
+PopupWin.prototype.showAtElement = function() {
+	var self = this;
+	// Mozilla needs some time to realize what's goin' on..
+	setTimeout(function() {
+		var w = self.content.offsetWidth + 4;
+		var h = self.content.offsetHeight + 4;
+		// size to content -- that's fuckin' buggy in all fuckin' browsers!!!
+		// so that we set a larger size for the dialog window and then center
+		// the element inside... phuck!
+
+		// center...
+		var el = self.content;
+		var s = el.style;
+		// s.width = el.offsetWidth + "px";
+		// s.height = el.offsetHeight + "px";
+		s.position = "absolute";
+		s.left = (w - el.offsetWidth) / 2 + "px";
+		s.top = (h - el.offsetHeight) / 2 + "px";
+		if (HTMLArea.is_gecko) {
+			self.window.innerWidth = w;
+			self.window.innerHeight = h;
+		} else {
+			self.window.resizeTo(w + 8, h + 35);
+		}
+	}, 25);
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/context-menu.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/context-menu.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/context-menu.html	(revision 1328)
@@ -0,0 +1,95 @@
+<html>
+  <head>
+    <title>Test of ContextMenu plugin</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <script type="text/javascript">
+      _editor_url = "../";
+      _editor_lang = "en";
+    </script>
+
+    <!-- load the main HTMLArea file -->
+    <script type="text/javascript" src="../htmlarea.js"></script>
+
+    <script type="text/javascript">
+      HTMLArea.loadPlugin("ContextMenu");
+      HTMLArea.loadPlugin("TableOperations");
+
+      function initDocument() {
+        var editor = new HTMLArea("editor");
+        editor.registerPlugin(ContextMenu);
+        editor.registerPlugin(TableOperations);
+        editor.generate();
+      }
+    </script>
+
+  </head>
+
+  <body onload="initDocument()">
+    <h1>Test of ContextMenu plugin</h1>
+
+
+<textarea id="editor" style="height: 30em; width: 100%;">
+&lt;table border="1" style="border: 1px dotted rgb(0, 102, 255); width:
+100%; background-color: rgb(255, 204, 51); background-image: none; float:
+none; text-align: left; vertical-align: top; border-collapse: collapse;"
+summary="" cellspacing="" cellpadding="" frame="box"
+rules="all"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="border: 1px solid
+rgb(255, 0, 0); background-color: rgb(0, 51, 51); background-image: none;
+text-align: left; vertical-align: top;"&gt;&lt;a
+href="http://dynarch.com/mishoo/articles.epl?art_id=430"&gt;&lt;img
+src="http://127.0.0.1/~mishoo/htmlarea/examples/pieng.png" alt="" align=""
+border="0" hspace="0" vspace="0" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td
+style="border: 1px solid rgb(255, 0, 0); background-color: rgb(255, 255, 0);
+background-image: none; text-align: left; vertical-align: top;"&gt;The
+article linked on the left image presents a script that allows Internet
+Explorer to use PNG images.  We hope to be able to implement IE PNG support
+in HTMLArea soon.&lt;br /&gt; &lt;br /&gt; Go on, right-click everywhere and
+test our new context menus.  And be thankful to &lt;a
+href="http://www.americanbible.org/"&gt;American Bible Society&lt;/a&gt; who
+sponsored the development, &lt;a
+href="http://dynarch.com/mishoo/"&gt;mishoo&lt;/a&gt; who made it happen and
+God, Who keeps mishoo alife. ;-)&lt;br /&gt; &lt;br /&gt;&lt;span
+style="font-style: italic;"&gt;P.S.&lt;/span&gt; No animals were harmed
+while producing this movie.&lt;br /&gt;
+&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-style: none;
+background-color: rgb(255, 255, 51); background-image: none; text-align:
+left; vertical-align: top;"&gt;Welcome to HTMLArea, the best online
+editor.&lt;br /&gt;&lt;/td&gt;&lt;td&gt;HTMLArea is a project initiated by
+&lt;a href="http://interactivetools.com/"&gt;InteractiveTools.com&lt;/a&gt;.
+Other companies contributed largely by sponsoring the development of
+additional extensions.  Many thanks to:&lt;br /&gt; &lt;br
+style="font-family: courier new,courier,monospace;" /&gt; &lt;div
+style="margin-left: 40px;"&gt;&lt;a href="http://www.zapatec.com/"
+style="font-family: courier
+new,courier,monospace;"&gt;http://www.zapatec.com&lt;/a&gt;&lt;br
+style="font-family: courier new,courier,monospace;" /&gt; &lt;a
+href="http://www.americanbible.org/" style="font-family: courier
+new,courier,monospace;"&gt;http://www.americanbible.org&lt;/a&gt;&lt;br
+style="font-family: courier new,courier,monospace;" /&gt; &lt;a
+href="http://www.neomedia.ro/" style="font-family: courier
+new,courier,monospace;"&gt;http://www.neomedia.ro&lt;/a&gt;&lt;br
+style="font-family: courier new,courier,monospace;" /&gt; &lt;a
+href="http://www.os3.it/" style="font-family: courier
+new,courier,monospace;"&gt;http://www.os3.it&lt;/a&gt;&lt;br
+style="font-family: courier new,courier,monospace;" /&gt; &lt;a
+href="http://www.miro.com.au/" style="font-family: courier
+new,courier,monospace;"&gt;http://www.miro.com.au&lt;/a&gt;&lt;br
+style="font-family: courier new,courier,monospace;" /&gt; &lt;a
+href="http://www.thycotic.com/" style="font-family: courier
+new,courier,monospace;"&gt;http://www.thycotic.com&lt;/a&gt;&lt;br /&gt;
+&lt;/div&gt; &lt;br /&gt; and to all the posters at <a
+href="http://www.interactivetools.com/iforum/Open_Source_C3/htmlArea_v3.0_-_Alpha_Release_F14/
+">InteractiveTools</a> HTMLArea forums, whose feedback is continually
+useful in polishing HTMLArea.&lt;br /&gt; &lt;br /&gt;&lt;div
+style="text-align: right;"&gt;-- developers and maintainers of version 3,
+&lt;a href="http://dynarch.com/"&gt;dynarch.com&lt;/a&gt;.&lt;br
+/&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
+    </textarea>
+
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Wed Oct  1 19:55:37 EEST 2003 -->
+<!-- hhmts start --> Last modified: Wed Jan 28 11:10:29 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/index.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/index.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/index.html	(revision 1328)
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html> <head>
+<title>HTMLArea examples index</title>
+</head>
+
+<body>
+<h1>HTMLArea: auto-generated examples index</h1>
+
+<ul>
+  <li>
+    <a href="2-areas.html">2-areas.html</a>
+  </li>
+  <li>
+    <a href="context-menu.html">context-menu.html</a>
+  </li>
+  <li>
+    <a href="core.html">core.html</a>
+  </li>
+  <li>
+    <a href="css.html">css.html</a>
+  </li>
+  <li>
+    <a href="full-page.html">full-page.html</a>
+  </li>
+  <li>
+    <a href="fully-loaded.html">fully-loaded.html</a>
+  </li>
+  <li>
+    <a href="spell-checker.html">spell-checker.html</a>
+  </li>
+  <li>
+    <a href="table-operations.html">table-operations.html</a>
+  </li>
+</ul>
+
+<hr />
+<address>mishoo@infoiasi.ro</address>
+<!-- hhmts start --> Last modified: Sun Feb  1 13:30:39 EET 2004 <!-- hhmts end -->
+</body> </html>
+
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/core.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/core.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/core.html	(revision 1328)
@@ -0,0 +1,184 @@
+<html>
+<head>
+<title>Example of HTMLArea 3.0</title>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!-- Configure the path to the editor.  We make it relative now, so that the
+    example ZIP file will work anywhere, but please NOTE THAT it's better to
+    have it an absolute path, such as '/htmlarea/'. -->
+<script type="text/javascript">
+  _editor_url = "../";
+  _editor_lang = "en";
+</script>
+<script type="text/javascript" src="../htmlarea.js"></script>
+
+<style type="text/css">
+html, body {
+  font-family: Verdana,sans-serif;
+  background-color: #fea;
+  color: #000;
+}
+a:link, a:visited { color: #00f; }
+a:hover { color: #048; }
+a:active { color: #f00; }
+
+textarea { background-color: #fff; border: 1px solid 00f; }
+</style>
+
+<script type="text/javascript">
+var editor = null;
+function initEditor() {
+  editor = new HTMLArea("ta");
+
+  // comment the following two lines to see how customization works
+  editor.generate();
+  return false;
+
+  var cfg = editor.config; // this is the default configuration
+  cfg.registerButton({
+    id        : "my-hilite",
+    tooltip   : "Highlight text",
+    image     : "ed_custom.gif",
+    textMode  : false,
+    action    : function(editor) {
+                  editor.surroundHTML("<span class=\"hilite\">", "</span>");
+                },
+    context   : 'table'
+  });
+
+  cfg.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar
+
+  // BEGIN: code that adds a custom button
+  // uncomment it to test
+  var cfg = editor.config; // this is the default configuration
+  /*
+  cfg.registerButton({
+    id        : "my-hilite",
+    tooltip   : "Highlight text",
+    image     : "ed_custom.gif",
+    textMode  : false,
+    action    : function(editor) {
+                  editor.surroundHTML("<span class=\"hilite\">", "</span>");
+                }
+  });
+  */
+
+function clickHandler(editor, buttonId) {
+  switch (buttonId) {
+    case "my-toc":
+      editor.insertHTML("<h1>Table Of Contents</h1>");
+      break;
+    case "my-date":
+      editor.insertHTML((new Date()).toString());
+      break;
+    case "my-bold":
+      editor.execCommand("bold");
+      editor.execCommand("italic");
+      break;
+    case "my-hilite":
+      editor.surroundHTML("<span class=\"hilite\">", "</span>");
+      break;
+  }
+};
+cfg.registerButton("my-toc",  "Insert TOC", "ed_custom.gif", false, clickHandler);
+cfg.registerButton("my-date", "Insert date/time", "ed_custom.gif", false, clickHandler);
+cfg.registerButton("my-bold", "Toggle bold/italic", "ed_custom.gif", false, clickHandler);
+cfg.registerButton("my-hilite", "Hilite selection", "ed_custom.gif", false, clickHandler);
+
+cfg.registerButton("my-sample", "Class: sample", "ed_custom.gif", false,
+  function(editor) {
+    if (HTMLArea.is_ie) {
+      editor.insertHTML("<span class=\"sample\">&nbsp;&nbsp;</span>");
+      var r = editor._doc.selection.createRange();
+      r.move("character", -2);
+      r.moveEnd("character", 2);
+      r.select();
+    } else { // Gecko/W3C compliant
+      var n = editor._doc.createElement("span");
+      n.className = "sample";
+      editor.insertNodeAtSelection(n);
+      var sel = editor._iframe.contentWindow.getSelection();
+      sel.removeAllRanges();
+      var r = editor._doc.createRange();
+      r.setStart(n, 0);
+      r.setEnd(n, 0);
+      sel.addRange(r);
+    }
+  }
+);
+
+
+  /*
+  cfg.registerButton("my-hilite", "Highlight text", "ed_custom.gif", false,
+    function(editor) {
+      editor.surroundHTML('<span class="hilite">', '</span>');
+    }
+  );
+  */
+  cfg.pageStyle = "body { background-color: #efd; } .hilite { background-color: yellow; } "+
+                  ".sample { color: green; font-family: monospace; }";
+  cfg.toolbar.push(["linebreak", "my-toc", "my-date", "my-bold", "my-hilite", "my-sample"]); // add the new button to the toolbar
+  // END: code that adds a custom button
+
+  editor.generate();
+}
+function insertHTML() {
+  var html = prompt("Enter some HTML code here");
+  if (html) {
+    editor.insertHTML(html);
+  }
+}
+function highlight() {
+  editor.surroundHTML('<span style="background-color: yellow">', '</span>');
+}
+</script>
+
+</head>
+
+<!-- use <body onload="HTMLArea.replaceAll()" if you don't care about
+     customizing the editor.  It's the easiest way! :) -->
+<body onload="initEditor()">
+
+<h1>HTMLArea 3.0</h1>
+
+<p>A replacement for <code>TEXTAREA</code> elements.  &copy; <a
+href="http://interactivetools.com">InteractiveTools.com</a>, 2003-2004.</p>
+
+<form action="test.cgi" method="post" id="edit" name="edit">
+
+<textarea id="ta" name="ta" style="width:100%" rows="20" cols="80">
+  &lt;p&gt;Here is some sample text: &lt;b&gt;bold&lt;/b&gt;, &lt;i&gt;italic&lt;/i&gt;, &lt;u&gt;underline&lt;/u&gt;. &lt;/p&gt;
+  &lt;p align=center&gt;Different fonts, sizes and colors (all in bold):&lt;/p&gt;
+  &lt;p&gt;&lt;b&gt;
+   &lt;font face="arial"           size="7" color="#000066"&gt;arial&lt;/font&gt;,
+   &lt;font face="courier new"     size="6" color="#006600"&gt;courier new&lt;/font&gt;,
+   &lt;font face="georgia"         size="5" color="#006666"&gt;georgia&lt;/font&gt;,
+   &lt;font face="tahoma"          size="4" color="#660000"&gt;tahoma&lt;/font&gt;,
+   &lt;font face="times new roman" size="3" color="#660066"&gt;times new roman&lt;/font&gt;,
+   &lt;font face="verdana"         size="2" color="#666600"&gt;verdana&lt;/font&gt;,
+   &lt;font face="tahoma"          size="1" color="#666666"&gt;tahoma&lt;/font&gt;
+  &lt;/b&gt;&lt;/p&gt;
+  &lt;p&gt;Click on &lt;a href="http://www.interactivetools.com/"&gt;this link&lt;/a&gt; and then on the link button to the details ... OR ... select some text and click link to create a &lt;b&gt;new&lt;/b&gt; link.&lt;/p&gt;
+</textarea>
+
+<p />
+
+<input type="submit" name="ok" value="  submit  " />
+<input type="button" name="ins" value="  insert html  " onclick="return insertHTML();" />
+<input type="button" name="hil" value="  highlight text  " onclick="return highlight();" />
+
+<a href="javascript:mySubmit()">submit</a>
+
+<script type="text/javascript">
+function mySubmit() {
+// document.edit.save.value = "yes";
+document.edit.onsubmit(); // workaround browser bugs.
+document.edit.submit();
+};
+</script>
+
+</form>
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/css.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/css.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/css.html	(revision 1328)
@@ -0,0 +1,88 @@
+<html>
+  <head>
+    <title>Test of CSS plugin</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <script type="text/javascript">
+      _editor_url = "../";
+      _editor_lang = "en";
+    </script>
+
+    <!-- load the main HTMLArea files -->
+    <script type="text/javascript" src="../htmlarea.js"></script>
+
+    <script type="text/javascript">
+      HTMLArea.loadPlugin("CSS");
+
+      function initDocument() {
+        var editor = new HTMLArea("editor");
+        editor.config.pageStyle = "@import url(custom.css);";
+        editor.registerPlugin(CSS, {
+          combos : [
+            { label: "Syntax",
+                         // menu text       // CSS class
+              options: { "None"           : "",
+                         "Code" : "code",
+                         "String" : "string",
+                         "Comment" : "comment",
+                         "Variable name" : "variable-name",
+                         "Type" : "type",
+                         "Reference" : "reference",
+                         "Preprocessor" : "preprocessor",
+                         "Keyword" : "keyword",
+                         "Function name" : "function-name",
+                         "Html tag" : "html-tag",
+                         "Html italic" : "html-helper-italic",
+                         "Warning" : "warning",
+                         "Html bold" : "html-helper-bold"
+                       },
+              context: "pre"
+            },
+            { label: "Info",
+              options: { "None"           : "",
+                         "Quote"          : "quote",
+                         "Highlight"      : "highlight",
+                         "Deprecated"     : "deprecated"
+                       }
+            }
+          ]
+        });
+        editor.generate();
+      }
+    </script>
+
+  </head>
+
+  <body onload="initDocument()">
+    <h1>Test of FullPage plugin</h1>
+
+    <textarea id="editor" style="height: 30em; width: 100%;"
+>&lt;h1&gt;&lt;tt&gt;registerDropdown&lt;/tt&gt;&lt;/h1&gt;
+
+&lt;p&gt;Here's some sample code that adds a dropdown to the toolbar.  Go on, do
+        syntax highlighting on it ;-)&lt;/p&gt;
+
+&lt;pre&gt;var the_options = {
+	"Keyword"          : "keyword",
+	"Function name"    : "function-name",
+	"String"           : "string",
+	"Numeric"          : "integer",
+	"Variable name"    : "variable"
+};
+var css_class = {
+	id                 : "CSS-class",
+	tooltip            : i18n["tooltip"],
+	options            : the_options,
+	action             : function(editor) { self.onSelect(editor, this); }
+};
+cfg.registerDropdown(css_class);
+toolbar[0].unshift(["CSS-class"]);&lt;/pre&gt;
+
+&lt;p&gt;Easy, eh? ;-)&lt;/p&gt;</textarea>
+
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Wed Oct  1 19:55:37 EEST 2003 -->
+<!-- hhmts start --> Last modified: Wed Jan 28 11:10:16 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/table-operations.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/table-operations.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/table-operations.html	(revision 1328)
@@ -0,0 +1,116 @@
+<html>
+<head>
+<title>Example of HTMLArea 3.0</title>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!-- Configure the path to the editor.  We make it relative now, so that the
+    example ZIP file will work anywhere, but please NOTE THAT it's better to
+    have it an absolute path, such as '/htmlarea/'. -->
+<script type="text/javascript">
+  _editor_lang = "en";
+  _editor_url = "../";
+</script>
+<!-- load the main HTMLArea files -->
+<script type="text/javascript" src="../htmlarea.js"></script>
+
+<style type="text/css">
+html, body {
+  font-family: Verdana,sans-serif;
+  background-color: #fea;
+  color: #000;
+}
+a:link, a:visited { color: #00f; }
+a:hover { color: #048; }
+a:active { color: #f00; }
+
+textarea { background-color: #fff; border: 1px solid 00f; }
+</style>
+
+<script type="text/javascript">
+// load the plugin files
+HTMLArea.loadPlugin("TableOperations");
+
+var editor = null;
+function initEditor() {
+  // create an editor for the "ta" textbox
+  editor = new HTMLArea("ta");
+
+  // register the TableOperations plugin with our editor
+  editor.registerPlugin(TableOperations);
+
+  editor.generate();
+  return false;
+}
+
+function insertHTML() {
+  var html = prompt("Enter some HTML code here");
+  if (html) {
+    editor.insertHTML(html);
+  }
+}
+function highlight() {
+  editor.surroundHTML('<span style="background-color: yellow">', '</span>');
+}
+</script>
+
+</head>
+
+<!-- use <body onload="HTMLArea.replaceAll()" if you don't care about
+     customizing the editor.  It's the easiest way! :) -->
+<body onload="initEditor()">
+
+<h1>HTMLArea 3.0</h1>
+
+<p>A replacement for <code>TEXTAREA</code> elements.  &copy; <a
+href="http://interactivetools.com">InteractiveTools.com</a>, 2003-2004.</p>
+
+<p>Page that demonstrates the additional features of the
+<tt>TableOperations</tt> plugin (sponsored by <a
+href="http://www.bloki.com">Zapatec Inc.</a>).</p>
+
+<form action="test.cgi" method="post" id="edit" name="edit">
+
+<textarea id="ta" name="ta" style="width:100%" rows="24" cols="80">
+
+<h1>Plugin: <tt>TableOperations</tt></h1>
+
+<p>This page exemplifies the table operations toolbar, provided by the
+TableOperations plugin.</p>
+
+<p>Following there is a table.</p>
+
+<table border="1" style="border: 2px solid rgb(255, 0, 0); width: 80%; background-image: none; border-collapse: collapse; color: rgb(153, 102, 0); background-color: rgb(255, 255, 51);" align="center" cellspacing="2" cellpadding="1" summary="">
+  <caption>This <span style="font-weight: bold;">is</span> a table</caption>
+  <tbody>
+  <tr style="border-style: none; background-image: none; background-color: rgb(255, 255, 153);" char="." align="left" valign="middle"> <td>1.1</td> <td>1.2</td> <td>1.3</td> <td>1.4</td> </tr>
+  <tr> <td>2.1</td> <td style="border: 1px solid rgb(51, 51, 255); background-image: none; background-color: rgb(102, 255, 255); color: rgb(0, 0, 51);" char="." align="left" valign="middle">2.2</td> <td>2.3</td> <td>2.4</td> </tr>
+  <tr> <td>3.1</td> <td>3.2</td> <td style="border: 2px dashed rgb(51, 204, 102); background-image: none; background-color: rgb(102, 255, 153); color: rgb(0, 51, 0);" char="." align="left" valign="middle">3.3</td> <td>3.4</td> </tr>
+  <tr> <td style="background-color: rgb(255, 204, 51);">4.1</td> <td style="background-color: rgb(255, 204, 51);">4.2</td> <td style="background-color: rgb(255, 204, 51);">4.3</td> <td style="background-color: rgb(255, 204, 51);">4.4</td> </tr>
+  </tbody>
+</table>
+
+<p>Text after the table</p>
+
+</textarea>
+
+<p />
+
+<input type="submit" name="ok" value="  submit  " />
+<input type="button" name="ins" value="  insert html  " onclick="return insertHTML();" />
+<input type="button" name="hil" value="  highlight text  " onclick="return highlight();" />
+
+<a href="javascript:mySubmit()">submit</a>
+
+<script type="text/javascript">
+function mySubmit() {
+// document.edit.save.value = "yes";
+document.edit.onsubmit(); // workaround browser bugs.
+document.edit.submit();
+};
+</script>
+
+</form>
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/2-areas.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/2-areas.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/2-areas.html	(revision 1328)
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Example with 2 HTMLAreas in the same form</title>
+    <script type="text/javascript">
+      // the _editor_url is REQUIRED!  don't forget to set it.
+      _editor_url = "../";
+      // implicit language will be "en", but let's set it for brevity
+      _editor_lang = "en";
+    </script>
+    <script type="text/javascript" src="../htmlarea.js"></script>
+    <script type="text/javascript">
+      // load the plugins that we will use
+      // loading is necessary ONLY ONCE, regardless on how many editors you create
+      // basically calling the following functions will load the plugin files as if
+      // we would have wrote script src="..." but with easier and cleaner code
+      HTMLArea.loadPlugin("TableOperations");
+      HTMLArea.loadPlugin("SpellChecker");
+      HTMLArea.loadPlugin("CSS");
+
+      // this function will get called at body.onload
+      function initDocument() {
+        // cache these values as we need to pass it for both editors
+        var css_plugin_args = {
+          combos : [
+            { label: "Syntax",
+                         // menu text       // CSS class
+              options: { "None"           : "",
+                         "Code" : "code",
+                         "String" : "string",
+                         "Comment" : "comment",
+                         "Variable name" : "variable-name",
+                         "Type" : "type",
+                         "Reference" : "reference",
+                         "Preprocessor" : "preprocessor",
+                         "Keyword" : "keyword",
+                         "Function name" : "function-name",
+                         "Html tag" : "html-tag",
+                         "Html italic" : "html-helper-italic",
+                         "Warning" : "warning",
+                         "Html bold" : "html-helper-bold"
+                       },
+              context: "pre"
+            },
+            { label: "Info",
+              options: { "None"           : "",
+                         "Quote"          : "quote",
+                         "Highlight"      : "highlight",
+                         "Deprecated"     : "deprecated"
+                       }
+            }
+          ]
+        };
+
+        //---------------------------------------------------------------------
+        // GENERAL PATTERN
+        //
+	//  1. Instantitate an editor object.
+	//  2. Register plugins (note, it's required to have them loaded).
+	//  3. Configure any other items in editor.config.
+	//  4. generate() the editor
+	//
+	// The above are steps that you use to create one editor.  Nothing new
+	// so far.  In order to create more than one editor, you just have to
+	// repeat those steps for each of one.  Of course, you can register any
+	// plugins you want (no need to register the same plugins for all
+	// editors, and to demonstrate that we'll skip the TableOperations
+	// plugin for the second editor).  Just be careful to pass different
+	// ID-s in the constructor (you don't want to _even try_ to create more
+	// editors for the same TEXTAREA element ;-)).
+	//
+	// So much for the noise, see the action below.
+	//---------------------------------------------------------------------
+
+
+        //---------------------------------------------------------------------
+        // CREATE FIRST EDITOR
+        //
+        var editor1 = new HTMLArea("text-area-1");
+
+        // plugins must be registered _per editor_.  Therefore, we register
+        // plugins for the first editor here, and we will also do this for the
+        // second editor.
+        editor1.registerPlugin(TableOperations);
+        editor1.registerPlugin(SpellChecker);
+        editor1.registerPlugin(CSS, css_plugin_args);
+
+        // custom config must be done per editor.  Here we're importing the
+        // stylesheet used by the CSS plugin.
+        editor1.config.pageStyle = "@import url(custom.css);";
+
+        // generate first editor
+        editor1.generate();
+        //---------------------------------------------------------------------
+
+
+        //---------------------------------------------------------------------
+        // CREATE SECOND EDITOR
+        //
+        var editor2 = new HTMLArea("text-area-2");
+
+        // we are using the same plugins
+        editor2.registerPlugin(TableOperations);
+        editor2.registerPlugin(SpellChecker);
+        editor2.registerPlugin(CSS, css_plugin_args);
+
+        // import the CSS plugin styles
+        editor2.config.pageStyle = "@import url(custom.css);";
+
+        // generate the second editor
+        // IMPORTANT: if we don't give it a timeout, the first editor will
+        // not function in Mozilla.  Soon I'll think about starting to
+        // implement some kind of event that will fire when the editor
+        // finished creating, then we'll be able to chain the generate()
+        // calls in an elegant way.  But right now there's no other solution
+        // than the following.
+        setTimeout(function() {
+          editor2.generate();
+        }, 500);
+        //---------------------------------------------------------------------
+      };
+    </script>
+  </head>
+
+  <body onload="initDocument()">
+    <h1>Example with 2 HTMLAreas in the same form</h1>
+
+    <form action="2-areas.cgi" method="post" target="_blank">
+
+      <input type="submit" value=" Submit " />
+      <br />
+
+      <textarea id="text-area-1" name="text1" style="width: 100%; height: 12em">
+        &lt;h3&gt;HTMLArea #1&lt;/h3&gt;
+        &lt;p&gt;This will submit a field named &lt;em&gt;text1&lt;/em&gt;.&lt;/p&gt;
+      </textarea>
+
+      <br />
+
+      <textarea id="text-area-2" name="text2" style="width: 100%; height: 12em">
+        &lt;h3&gt;Second HTMLArea&lt;/h3&gt; &lt;p&gt;&lt;em&gt;text2&lt;/em&gt; submission.  Both are
+        located in the same FORM element and the script action is
+        2-areas.cgi (see it in the examples directory)&lt;/p&gt;
+      </textarea>
+
+      <br />
+      <input type="submit" value=" Submit " />
+
+    </form>
+
+    <hr>
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Fri Oct 31 09:37:10 EET 2003 -->
+<!-- hhmts start --> Last modified: Wed Jan 28 11:10:40 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/full-page.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/full-page.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/full-page.html	(revision 1328)
@@ -0,0 +1,75 @@
+<html>
+  <head>
+    <title>Test of FullPage plugin</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <script type="text/javascript">
+      _editor_url = "../";
+      _editor_lang = "en";
+    </script>
+
+    <!-- load the main HTMLArea files -->
+    <script type="text/javascript" src="../htmlarea.js"></script>
+
+    <script type="text/javascript">
+      HTMLArea.loadPlugin("FullPage");
+
+      function initDocument() {
+        var editor = new HTMLArea("editor");
+        editor.registerPlugin(FullPage);
+        editor.generate();
+      }
+    </script>
+
+  </head>
+
+  <body onload="initDocument()">
+    <h1>Test of FullPage plugin</h1>
+
+    <textarea id="editor" style="height: 30em; width: 100%;">
+      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
+      &lt;html&gt;
+        &lt;head&gt;
+          &lt;title&gt;FullPage plugin for HTMLArea&lt;/title&gt;
+          &lt;link rel="alternate stylesheet" href="http://dynarch.com/mishoo/css/dark.css" /&gt;
+          &lt;link rel="stylesheet" href="http://dynarch.com/mishoo/css/cool-light.css" /&gt;
+        &lt;/head&gt;
+        &lt;body style="background-color: #ddddee; color: #000077;"&gt;
+          &lt;table style="width:60%; height: 90%; margin: 2% auto 1% auto;" align="center" border="0" cellpadding="0" cellspacing="0"&gt;
+            &lt;tr&gt;
+              &lt;td style="background-color: #ddeedd; border: 2px solid #002; height: 1.5em; padding: 2px; font: bold 24px Verdana;"&gt;
+                FullPage plugin
+              &lt;/td&gt;
+            &lt;/tr&gt;
+            &lt;tr&gt;
+              &lt;td style="background-color: #fff; border: 1px solid #aab; padding: 1em 3em; font: 12px Verdana;"&gt;
+                &lt;p&gt;
+                  This plugin enables one to edit a full HTML file in &lt;a
+                    href="http://dynarch.com/htmlarea/"&gt;HTMLArea&lt;/a&gt;.  This is not
+                  normally possible with just the core editor since it only
+                  retrieves the HTML inside the &lt;code&gt;body&lt;/code&gt; tag.
+                &lt;/p&gt;
+                &lt;p&gt;
+                  It provides the ability to change the &lt;code&gt;DOCTYPE&lt;/code&gt; of
+                  the document, &lt;code&gt;body&lt;/code&gt; &lt;code&gt;bgcolor&lt;/code&gt; and
+                  &lt;code&gt;fgcolor&lt;/code&gt; attributes as well as to add additional
+                  &lt;code&gt;link&lt;/code&gt;-ed stylesheets.  Cool, eh?
+                &lt;/p&gt;
+                &lt;p&gt;
+                  The development of this plugin was initiated and sponsored by
+                  &lt;a href="http://thycotic.com"&gt;Thycotic Software Ltd.&lt;/a&gt;.
+                  That's also cool, isn't it? ;-)
+                &lt;/p&gt;
+              &lt;/td&gt;
+            &lt;/tr&gt;
+          &lt;/table&gt;
+        &lt;/body&gt;
+      &lt;/html&gt;
+    </textarea>
+
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Wed Oct  1 19:55:37 EEST 2003 -->
+<!-- hhmts start --> Last modified: Wed Jan 28 11:10:07 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/fully-loaded.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/fully-loaded.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/fully-loaded.html	(revision 1328)
@@ -0,0 +1,248 @@
+<html>
+<head>
+<title>Example of HTMLArea 3.0</title>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!-- Configure the path to the editor.  We make it relative now, so that the
+    example ZIP file will work anywhere, but please NOTE THAT it's better to
+    have it an absolute path, such as '/htmlarea/'. -->
+<script type="text/javascript">
+  _editor_url = "../";
+  _editor_lang = "en";
+</script>
+
+<!-- load the main HTMLArea file, this will take care of loading the CSS and
+    other required core scripts. -->
+<script type="text/javascript" src="../htmlarea.js"></script>
+
+<!-- load the plugins -->
+<script type="text/javascript">
+      // WARNING: using this interface to load plugin
+      // will _NOT_ work if plugins do not have the language
+      // loaded by HTMLArea.
+
+      // In other words, this function generates SCRIPT tags
+      // that load the plugin and the language file, based on the
+      // global variable HTMLArea.I18N.lang (defined in the lang file,
+      // in our case "lang/en.js" loaded above).
+
+      // If this lang file is not found the plugin will fail to
+      // load correctly and nothing will work.
+
+      HTMLArea.loadPlugin("TableOperations");
+      HTMLArea.loadPlugin("SpellChecker");
+      HTMLArea.loadPlugin("FullPage");
+      HTMLArea.loadPlugin("CSS");
+      HTMLArea.loadPlugin("ContextMenu");
+</script>
+
+<style type="text/css">
+html, body {
+  font-family: Verdana,sans-serif;
+  background-color: #fea;
+  color: #000;
+}
+a:link, a:visited { color: #00f; }
+a:hover { color: #048; }
+a:active { color: #f00; }
+
+textarea { background-color: #fff; border: 1px solid 00f; }
+</style>
+
+<script type="text/javascript">
+var editor = null;
+function initEditor() {
+
+  // create an editor for the "ta" textbox
+  editor = new HTMLArea("ta");
+
+  // register the FullPage plugin
+  editor.registerPlugin(FullPage);
+
+  // register the SpellChecker plugin
+  editor.registerPlugin(TableOperations);
+
+  // register the SpellChecker plugin
+  editor.registerPlugin(SpellChecker);
+
+  // register the CSS plugin
+  editor.registerPlugin(CSS, {
+    combos : [
+      { label: "Syntax:",
+                   // menu text       // CSS class
+        options: { "None"           : "",
+                   "Code" : "code",
+                   "String" : "string",
+                   "Comment" : "comment",
+                   "Variable name" : "variable-name",
+                   "Type" : "type",
+                   "Reference" : "reference",
+                   "Preprocessor" : "preprocessor",
+                   "Keyword" : "keyword",
+                   "Function name" : "function-name",
+                   "Html tag" : "html-tag",
+                   "Html italic" : "html-helper-italic",
+                   "Warning" : "warning",
+                   "Html bold" : "html-helper-bold"
+                 },
+        context: "pre"
+      },
+      { label: "Info:",
+        options: { "None"           : "",
+                   "Quote"          : "quote",
+                   "Highlight"      : "highlight",
+                   "Deprecated"     : "deprecated"
+                 }
+      }
+    ]
+  });
+
+  // add a contextual menu
+  editor.registerPlugin("ContextMenu");
+
+  // load the stylesheet used by our CSS plugin configuration
+  editor.config.pageStyle = "@import url(custom.css);";
+
+  setTimeout(function() {
+    editor.generate();
+  }, 500);
+  return false;
+}
+
+function insertHTML() {
+  var html = prompt("Enter some HTML code here");
+  if (html) {
+    editor.insertHTML(html);
+  }
+}
+function highlight() {
+  editor.surroundHTML('<span style="background-color: yellow">', '</span>');
+}
+</script>
+
+</head>
+
+<!-- use <body onload="HTMLArea.replaceAll()" if you don't care about
+     customizing the editor.  It's the easiest way! :) -->
+<body onload="initEditor()">
+
+<h1>HTMLArea 3.0</h1>
+
+<p>A replacement for <code>TEXTAREA</code> elements.  &copy; <a
+href="http://interactivetools.com">InteractiveTools.com</a>, 2003-2004.</p>
+
+<form action="test.cgi" method="post" id="edit" name="edit">
+
+<textarea id="ta" name="ta" style="width:100%" rows="24" cols="80">
+&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"&gt;
+&lt;html&gt;
+
+&lt;head&gt;
+&lt;title&gt;Passing parameters to JavaScript code&lt;/title&gt;
+&lt;link rel="stylesheet" href="custom.css" /&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+&lt;h1&gt;Passing parameters to JavaScript code&lt;/h1&gt;
+
+&lt;p&gt;Sometimes we need to pass parameters to some JavaScript function that we
+wrote ourselves.  But sometimes it's simply more convenient to include the
+parameter not in the function call, but in the affected HTML elements.
+Usually, all JavaScript calls affect some element, right? ;-)&lt;/p&gt;
+
+&lt;p&gt;Well, here's an original way to do it.  Or at least, I think it's
+original.&lt;/p&gt;
+
+&lt;h2&gt;But first...&lt;/h2&gt;
+
+&lt;p&gt;... an example.  Why would I need such thing?  I have a JS function that
+is called on &lt;code&gt;BODY&lt;/code&gt; &lt;code&gt;onload&lt;/code&gt; handler.  This function
+tries to retrieve the element with the ID "conttoc" and, if present, it will
+&lt;a href="toc.epl" title="Automatic TOC generation"&gt;generate an index&lt;/a&gt;.
+The problem is, this function exists in some external JavaScript library
+that it's loaded in page.  I only needed to pass the parameter from
+&lt;em&gt;one&lt;/em&gt; page.  Thus, it makes sense to pass the parameter from the HTML
+code on &lt;em&gt;that&lt;/em&gt; page, not to affect the others.&lt;/p&gt;
+
+&lt;p&gt;The first idea that came to me was to use some attribute, like "id" or
+"class".  But "id" was locked already, it &lt;em&gt;had&lt;/em&gt; to be "conttoc".  Use
+"class"?  It's not elegant.. what if I really wanted to give it a class, at
+some point?&lt;/p&gt;
+
+&lt;h2&gt;The idea&lt;/h2&gt;
+
+&lt;p&gt;So I thought: what are the HTML elements that do not affect the page
+rendering in any way?  Well, comments.  I mean, &lt;em&gt;comments&lt;/em&gt;, HTML
+comments.  You know, like &lt;code&gt;&amp;lt;!-- this is a comment --&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Though comments do not normally affect the way browser renders the page,
+they are still parsed and are part of the DOM, as well as any other node.
+But this mean that we can access comments from JavaScript code, just like we
+access any other element, right?  Which means that they &lt;em&gt;can&lt;/em&gt; affect
+the way that page finally appears ;-)&lt;/p&gt;
+
+&lt;h2&gt;The code&lt;/h2&gt;
+
+&lt;p&gt;The main part was the idea.  The code is simple ;-)  Suppose we have the
+following HTML code:&lt;/p&gt;
+
+&lt;pre class="code"&gt;&lt;span class="function-name"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html-tag"&gt;div&lt;/span&gt; &lt;span class="variable-name"&gt;id=&lt;/span&gt;&lt;span class="string"&gt;&amp;quot;conttoc&amp;quot;&lt;/span&gt;&lt;span class="paren-face-match"&gt;&amp;gt;&lt;/span&gt;&lt;span class="function-name"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html-tag"&gt;/div&lt;/span&gt;&lt;span class="function-name"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
+
+&lt;p&gt;and our function checks for the presence an element having the ID
+"conttoc", and generates a table of contents into it.  Our code will also
+check if the "conttoc" element's first child is a comment node, and if so
+will parse additional parameters from there, for instance, a desired prefix
+for the links that are to be generated into it.  Why did I need it?  Because
+if the page uses a &lt;code&gt;&amp;lt;base&amp;gt;&lt;/code&gt; element to specify the default
+link prefix, then links like "#gen1" generated by the &lt;a href="toc.epl"&gt;toc
+generator&lt;/a&gt; will not point to that same page as they should, but to the
+page reffered from &lt;code&gt;&amp;lt;base&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;So the HTML would now look like this:&lt;/p&gt;
+
+&lt;pre class="code"&gt;&lt;span class="function-name"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html-tag"&gt;div&lt;/span&gt; &lt;span class="variable-name"&gt;id=&lt;/span&gt;&lt;span class="string"&gt;&amp;quot;conttoc&amp;quot;&lt;/span&gt;&lt;span class="function-name"&gt;&amp;gt;&lt;/span&gt;&lt;span class="comment"&gt;&amp;lt;!-- base:link/prefix.html --&amp;gt;&lt;/span&gt;&lt;span class="paren-face-match"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html-tag"&gt;/div&lt;/span&gt;&lt;span class="paren-face-match"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
+
+&lt;p&gt;And our TOC generation function does something like this:&lt;/p&gt;
+
+&lt;pre class="code"&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; &lt;span class="variable-name"&gt;element&lt;/span&gt; = getElementById(&amp;quot;&lt;span class="string"&gt;conttoc&lt;/span&gt;&amp;quot;);
+&lt;span class="keyword"&gt;if&lt;/span&gt; (element.firstChild &amp;amp;&amp;amp; element.firstChild.nodeType == 8) {
+  &lt;span class="comment"&gt;// 8 means Node.COMMENT_NODE.  We're using numeric values
+&lt;/span&gt;  &lt;span class="comment"&gt;// because IE6 does not support constant names.
+&lt;/span&gt;  &lt;span class="keyword"&gt;var&lt;/span&gt; &lt;span class="variable-name"&gt;parameters&lt;/span&gt; = element.firstChild.data;
+  &lt;span class="comment"&gt;// at this point &amp;quot;parameters&amp;quot; contains base:link/prefix.html
+&lt;/span&gt;  &lt;span class="comment"&gt;// ...
+&lt;/span&gt;}&lt;/pre&gt;
+
+&lt;p&gt;So we retrieved the value passed to the script from the HTML code.  This
+was the goal of this article.&lt;/p&gt;
+
+&lt;hr /&gt;
+&lt;address&gt;&lt;a href="http://students.infoiasi.ro/~mishoo/"&gt;Mihai Bazon&lt;/a&gt;&lt;/address&gt;
+&lt;!-- hhmts start --&gt; Last modified on Thu Apr  3 20:34:17 2003
+&lt;!-- hhmts end --&gt;
+&lt;!-- doc-lang: English --&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</textarea>
+
+<p />
+
+<input type="submit" name="ok" value="  submit  " />
+<input type="button" name="ins" value="  insert html  " onclick="return insertHTML();" />
+<input type="button" name="hil" value="  highlight text  " onclick="return highlight();" />
+
+<a href="javascript:mySubmit()">submit</a>
+
+<script type="text/javascript">
+function mySubmit() {
+// document.edit.save.value = "yes";
+document.edit.onsubmit(); // workaround browser bugs.
+document.edit.submit();
+};
+</script>
+
+</form>
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/examples/spell-checker.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/examples/spell-checker.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/examples/spell-checker.html	(revision 1328)
@@ -0,0 +1,132 @@
+<html>
+<head>
+<title>Example of HTMLArea 3.0</title>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!-- Configure the path to the editor.  We make it relative now, so that the
+    example ZIP file will work anywhere, but please NOTE THAT it's better to
+    have it an absolute path, such as '/htmlarea/'. -->
+<script type="text/javascript">
+  _editor_lang = "en";
+  _editor_url = "../";
+</script>
+<!-- load the main HTMLArea files -->
+<script type="text/javascript" src="../htmlarea.js"></script>
+
+<style type="text/css">
+html, body {
+  font-family: Verdana,sans-serif;
+  background-color: #fea;
+  color: #000;
+}
+a:link, a:visited { color: #00f; }
+a:hover { color: #048; }
+a:active { color: #f00; }
+
+textarea { background-color: #fff; border: 1px solid 00f; }
+</style>
+
+<script type="text/javascript">
+HTMLArea.loadPlugin("SpellChecker");
+var editor = null;
+function initEditor() {
+  // create an editor for the "ta" textbox
+  editor = new HTMLArea("ta");
+
+  // register the SpellChecker plugin
+  editor.registerPlugin(SpellChecker);
+
+  editor.generate();
+  return false;
+}
+
+function insertHTML() {
+  var html = prompt("Enter some HTML code here");
+  if (html) {
+    editor.insertHTML(html);
+  }
+}
+function highlight() {
+  editor.surroundHTML('<span style="background-color: yellow">', '</span>');
+}
+</script>
+
+</head>
+
+<!-- use <body onload="HTMLArea.replaceAll()" if you don't care about
+     customizing the editor.  It's the easiest way! :) -->
+<body onload="initEditor()">
+
+<h1>HTMLArea 3.0</h1>
+
+<p>A replacement for <code>TEXTAREA</code> elements.  &copy; <a
+href="http://interactivetools.com">InteractiveTools.com</a>, 2003-2004.</p>
+
+<p>Plugins:
+      <tt>SpellChecker</tt> (sponsored by <a
+        href="http://americanbible.org">American Bible Society</a>).
+</p>
+
+<form action="test.cgi" method="post" id="edit" name="edit">
+
+<textarea id="ta" name="ta" style="width:100%" rows="24" cols="80">
+
+<h1>The <tt>SpellChecker</tt> plugin</h1>
+
+      <p>This file deminstrates the <tt>SpellChecker</tt> plugin of
+      HTMLArea.  To inwoke the spell checkert you need to press the
+      <em>spell-check</em> buton in the toolbar.</p>
+
+      <p>The spell-checker uses a serverside script written in Perl.  The
+        Perl script calls <a href="http://aspell.net">aspell</a> for any
+        word in the text and reports wordz that aren't found in the
+        dyctionari.</p>
+
+      <p>The document that yu are reading now <b>intentionaly</b> containes
+        some errorz, so that you have something to corect ;-)</p>
+
+      <p>Credits for the <tt>SpellChecker</tt> plugin go to:</p>
+
+      <ul>
+
+        <li><a href="http://aspell.net">Aspell</a> -- spell
+          checker</li>
+
+        <li>The <a href="http://perl.org">Perl</a> programming language</li>
+
+        <li><tt><a
+              href="http://cpan.org/modules/by-module/Text/Text-Aspell-0.02.readme">Text::Aspell</a></tt>
+          -- Perl interface to Aspell</li>
+
+        <li><a href="http://americanbible.org">American Bible Society</a> --
+          for sponsoring the <tt>SpellChecker</tt> plugin for
+          <tt>HTMLArea</tt></li>
+
+        <li><a href="http://dynarch.com/mishoo/">Your humble servant</a> for
+          implementing it ;-)</li>
+
+      </ul>
+
+</textarea>
+
+<p />
+
+<input type="submit" name="ok" value="  submit  " />
+<input type="button" name="ins" value="  insert html  " onclick="return insertHTML();" />
+<input type="button" name="hil" value="  highlight text  " onclick="return highlight();" />
+
+<a href="javascript:mySubmit()">submit</a>
+
+<script type="text/javascript">
+function mySubmit() {
+// document.edit.save.value = "yes";
+document.edit.onsubmit(); // workaround browser bugs.
+document.edit.submit();
+};
+</script>
+
+</form>
+
+</body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/license.txt
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/license.txt	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/license.txt	(revision 1328)
@@ -0,0 +1,30 @@
+htmlArea License (based on BSD license)
+Copyright (c) 2002-2004, interactivetools.com, inc.
+Copyright (c) 2003-2004 dynarch.com
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+3) Neither the name of interactivetools.com, inc. nor the names of its
+   contributors may be used to endorse or promote products derived from this
+   software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/se.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/se.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/se.js	(revision 1328)
@@ -0,0 +1,38 @@
+// Swedish version for htmlArea v3.0 - Alpha Release
+// - translated by pat<pat@engvall.nu>
+// term´s and licenses are equal to htmlarea!
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "se",
+
+	tooltips: {
+		bold:           "Fet",
+		italic:         "Kursiv",
+		underline:      "Understruken",
+		strikethrough:  "Genomstruken",
+		subscript:      "Nedsänkt",
+		superscript:    "Upphöjd",
+		justifyleft:    "Vänsterjustera",
+		justifycenter:  "Centrera",
+		justifyright:   "Högerjustera",
+		justifyfull:    "Marginaljustera",
+		orderedlist:    "Numrerad lista",
+		unorderedlist:  "Punktlista",
+		outdent:        "Minska indrag",
+		indent:         "Öka indrag",
+		forecolor:      "Textfärg",
+		backcolor:      "Bakgrundsfärg",
+		horizontalrule: "Vågrät linje",
+		createlink:     "Infoga länk",
+		insertimage:    "Infoga bild",
+		inserttable:    "Infoga tabell",
+		htmlmode:       "Visa källkod",
+		popupeditor:    "Visa i eget fönster",
+		about:          "Om denna editor",
+		help:           "Hjälp",
+		textindicator:  "Nuvarande stil"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/es.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/es.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/es.js	(revision 1328)
@@ -0,0 +1,51 @@
+// I18N constants
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "es",
+
+	tooltips: {
+		bold:           "Negrita",
+		italic:         "Cursiva",
+		underline:      "Subrayado",
+		strikethrough:  "Tachado",
+		subscript:      "Subíndice",
+		superscript:    "Superíndice",
+		justifyleft:    "Alinear a la Izquierda",
+		justifycenter:  "Centrar",
+		justifyright:   "Alinear a la Derecha",
+		justifyfull:    "Justificar",
+		insertorderedlist:    "Lista Ordenada",
+		insertunorderedlist:  "Lista No Ordenada",
+		outdent:        "Aumentar Sangría",
+		indent:         "Disminuir Sangría",
+		forecolor:      "Color del Texto",
+		hilitecolor:    "Color del Fondo",
+		inserthorizontalrule: "Línea Horizontal",
+		createlink:     "Insertar Enlace",
+		insertimage:    "Insertar Imagen",
+		inserttable:    "Insertar Tabla",
+		htmlmode:       "Ver Documento en HTML",
+		popupeditor:    "Ampliar Editor",
+		about:          "Acerca del Editor",
+		showhelp:       "Ayuda",
+		textindicator:  "Estilo Actual",
+		undo:           "Deshacer",
+		redo:           "Rehacer",
+		cut:            "Cortar selección",
+		copy:           "Copiar selección",
+		paste:          "Pegar desde el portapapeles"
+	},
+
+	buttons: {
+		"ok":           "Aceptar",
+		"cancel":       "Cancelar"
+	},
+
+	msg: {
+		"Path":         "Ruta",
+		"TEXT_MODE":    "Esta en modo TEXTO. Use el boton [<>] para cambiar a WYSIWIG",
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/fr.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/fr.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/fr.js	(revision 1328)
@@ -0,0 +1,61 @@
+// I18N constants
+// Author: Jonathan Ernst, <Jonathan.Ernst@NetOxygen.ch>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "fr",
+
+	tooltips: {
+		bold:           "Gras",
+		italic:         "Italique",
+		underline:      "Souligné",
+		strikethrough:  "Barré",
+		subscript:      "Subscript",
+		superscript:    "Superscript",
+		justifyleft:    "Aligné à gauche",
+		justifycenter:  "Centré",
+		justifyright:   "Aligné à droite",
+		justifyfull:    "Justifié",
+		orderedlist:    "Numérotation",
+		unorderedlist:  "Puces",
+		outdent:        "Augmenter le retrait",
+		indent:         "Diminuer le retrait",
+		forecolor:      "Couleur du texte",
+		hilitecolor:    "Couleur du fond",
+		horizontalrule: "Ligne horizontale",
+		createlink:     "Insérer un lien",
+		insertimage:    "Insérer une image",
+		inserttable:    "Insérer un tableau",
+		htmlmode:       "Passer au code source HTML",
+		popupeditor:    "Agrandir l'éditeur",
+		about:          "A propos de cet éditeur",
+		showhelp:       "Aide sur l'éditeur",
+		textindicator:  "Style courant",
+		undo:           "Annule la dernière action",
+		redo:           "Refait la dernière action",
+		cut:            "Coupe la sélection",
+		copy:           "Copie la sélection",
+		paste:          "Colle depuis le presse papiers"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Annuler"
+	},
+
+	msg: {
+		"Path":         "Chemin",
+		"TEXT_MODE":    "Vous êtes en mode texte.  Utilisez le bouton [<>] pour revenir au mode WYSIWIG."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/nl.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/nl.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/nl.js	(revision 1328)
@@ -0,0 +1,90 @@
+// I18N constants
+
+// LANG: "nl", ENCODING: UTF-8 | ISO-8859-1
+// Author: Michel Weegeerink (info@mmc-shop.nl), http://mmc-shop.nl
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "nl",
+
+	tooltips: {
+		bold:					"Vet",
+		italic:					"Cursief",
+		underline:				"Onderstrepen",
+		strikethrough:			"Doorhalen",
+		subscript:				"Subscript",
+		superscript:			"Superscript",
+		justifyleft:			"Links uitlijnen",
+		justifycenter:			"Centreren",
+		justifyright:			"Rechts uitlijnen",
+		justifyfull:			"Uitvullen",
+		insertorderedlist:		"Nummering",
+		insertunorderedlist:	"Opsommingstekens",
+		outdent:				"Inspringing verkleinen",
+		indent:					"Inspringing vergroten",
+		forecolor:				"Tekstkleur",
+		hilitecolor:			"Achtergrondkleur",
+		inserthorizontalrule:	"Horizontale lijn",
+		createlink:				"Hyperlink invoegen/aanpassen",
+		insertimage:			"Afbeelding invoegen/aanpassen",
+		inserttable:			"Tabel invoegen",
+		htmlmode:				"HTML broncode",
+		popupeditor:			"Vergroot Editor",
+		about:					"Over deze editor",
+		showhelp:				"HTMLArea help",
+		textindicator:			"Huidige stijl",
+		undo:					"Ongedaan maken",
+		redo:					"Herhalen",
+		cut:					"Knippen",
+		copy:					"Kopiëren",
+		paste:					"Plakken",
+		lefttoright:			"Tekstrichting links naar rechts",
+		righttoleft:			"Tekstrichting rechts naar links"
+	},
+
+	buttons: {
+		"ok":					"OK",
+		"cancel":				"Annuleren"
+	},
+
+	msg: {
+		"Path":					"Pad",
+		"TEXT_MODE":			"Je bent in TEKST-mode. Gebruik de [<>] knop om terug te keren naar WYSIWYG-mode.",
+      
+		"IE-sucks-full-screen" :
+		// translate here
+		"Fullscreen-mode veroorzaakt problemen met Internet Explorer door bugs in de webbrowser " +
+		"die we niet kunnen omzeilen. Hierdoor kunnen de volgende effecten optreden: verknoeide teksten, " +
+		"een verlies aan editor-functionaliteit en/of willekeurig vastlopen van de webbrowser. " +
+		"Als u Windows 95 of 98 gebruikt, is het zeer waarschijnlijk dat u een algemene beschermingsfout " +
+		"('General Protection Fault') krijgt en de computer opnieuw zal moeten opstarten.\n\n" +
+		"U bent gewaarschuwd. Druk OK als u toch nog de Fullscreen-editor wil gebruiken."
+	},
+
+	dialogs: {
+		"Cancel"                                            : "Annuleren",
+		"Insert/Modify Link"                                : "Hyperlink invoegen/aanpassen",
+		"New window (_blank)"                               : "Nieuw venster (_blank)",
+		"None (use implicit)"                               : "Geen",
+		"OK"                                                : "OK",
+		"Other"                                             : "Ander",
+		"Same frame (_self)"                                : "Zelfde frame (_self)",
+		"Target:"                                           : "Doel:",
+		"Title (tooltip):"                                  : "Titel (tooltip):",
+		"Top frame (_top)"                                  : "Bovenste frame (_top)",
+		"URL:"                                              : "URL:",
+		"You must enter the URL where this link points to"  : "Geef de URL in waar de link naar verwijst"
+	}
+};
+
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/si.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/si.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/si.js	(revision 1328)
@@ -0,0 +1,63 @@
+// I18N constants
+
+// LANG: "si", ENCODING: ISO-8859-2
+// Author: Tomaz Kregar, x_tomo_x@email.si
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "si",
+
+	tooltips: {
+		bold:           "Krepko",
+		italic:         "Le¾eèe",
+		underline:      "Podèrtano",
+		strikethrough:  "Preèrtano",
+		subscript:      "Podpisano",
+		superscript:    "Nadpisano",
+		justifyleft:    "Poravnaj levo",
+		justifycenter:  "Na sredino",
+		justifyright:   "Poravnaj desno",
+		justifyfull:    "Porazdeli vsebino",
+		orderedlist:    "O¹tevilèevanje",
+		unorderedlist:  "Oznaèevanje",
+		outdent:        "Zmanj¹aj zamik",
+		indent:         "Poveèaj zamik",
+		forecolor:      "Barva pisave",
+		hilitecolor:    "Barva ozadja",
+		horizontalrule: "Vodoravna èrta",
+		createlink:     "Vstavi hiperpovezavo",
+		insertimage:    "Vstavi sliko",
+		inserttable:    "Vstavi tabelo",
+		htmlmode:       "Preklopi na HTML kodo",
+		popupeditor:    "Poveèaj urejevalnik",
+		about:          "Vizitka za urejevalnik",
+		showhelp:       "Pomoè za urejevalnik",
+		textindicator:  "Trenutni slog",
+		undo:           "Razveljavi zadnjo akcijo",
+		redo:           "Uveljavi zadnjo akcijo",
+		cut:            "Izre¾i",
+		copy:           "Kopiraj",
+		paste:          "Prilepi"
+	},
+
+	buttons: {
+		"ok":           "V redu",
+		"cancel":       "Preklièi"
+	},
+
+	msg: {
+		"Path":         "Pot",
+		"TEXT_MODE":    "Si v tekstovnem naèinu.  Uporabi [<>] gumb za prklop nazaj na WYSIWYG."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/pl.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/pl.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/pl.js	(revision 1328)
@@ -0,0 +1,36 @@
+// I18N constants
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "pl",
+
+	tooltips: {
+		bold:           "Pogrubienie",
+		italic:         "Pochylenie",
+		underline:      "Podkrelenie",
+		strikethrough:  "Przekrelenie",
+		subscript:      "Indeks dolny",
+		superscript:    "Indeks górny",
+		justifyleft:    "Wyrównaj do lewej",
+		justifycenter:  "Wyrodkuj",
+		justifyright:   "Wyrównaj do prawej",
+		justifyfull:    "Wyjustuj",
+		orderedlist:    "Numerowanie",
+		unorderedlist:  "Wypunktowanie",
+		outdent:        "Zmniejsz wciêcie",
+		indent:         "Zwiêksz wciêcie",
+		forecolor:      "Kolor czcionki",
+		backcolor:      "Kolor t³a",
+		horizontalrule: "Linia pozioma",
+		createlink:     "Wstaw adres sieci Web",
+		insertimage:    "Wstaw obraz",
+		inserttable:    "Wstaw tabelê",
+		htmlmode:       "Edycja WYSIWYG/w ródle strony",
+		popupeditor:    "Pe³ny ekran",
+		about:          "Informacje o tym edytorze",
+		help:           "Pomoc",
+		textindicator:  "Obecny styl"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/hu.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/hu.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/hu.js	(revision 1328)
@@ -0,0 +1,63 @@
+// I18N constants
+
+// LANG: "hu", ENCODING: UTF-8
+// Author: Miklós Somogyi, <somogyine@vnet.hu>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "hu",
+
+	tooltips: {
+		bold:           "Félkövér",
+		italic:         "Dőlt",
+		underline:      "Aláhúzott",
+		strikethrough:  "Áthúzott",
+		subscript:      "Alsó index",
+		superscript:    "Felső index",
+		justifyleft:    "Balra zárt",
+		justifycenter:  "Középre zárt",
+		justifyright:   "Jobbra zárt",
+		justifyfull:    "Sorkizárt",
+		orderedlist:    "Számozott lista",
+		unorderedlist:  "Számozatlan lista",
+		outdent:        "Behúzás csökkentése",
+		indent:         "Behúzás növelése",
+		forecolor:      "Karakterszín",
+		hilitecolor:    "Háttérszín",
+		horizontalrule: "Elválasztó vonal",
+		createlink:     "Hiperhivatkozás beszúrása",
+		insertimage:    "Kép beszúrása",
+		inserttable:    "Táblázat beszúrása",
+		htmlmode:       "HTML forrás be/ki",
+		popupeditor:    "Szerkesztő külön ablakban",
+		about:          "Névjegy",
+		showhelp:       "Súgó",
+		textindicator:  "Aktuális stílus",
+		undo:           "Visszavonás",
+		redo:           "Újra végrehajtás",
+		cut:            "Kivágás",
+		copy:           "Másolás",
+		paste:          "Beillesztés"
+	},
+
+	buttons: {
+		"ok":           "Rendben",
+		"cancel":       "Mégsem"
+	},
+
+	msg: {
+		"Path":         "Hierarchia",
+		"TEXT_MODE":    "Forrás mód. Visszaváltás [<>] gomb"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/it.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/it.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/it.js	(revision 1328)
@@ -0,0 +1,54 @@
+// I18N constants
+
+// LANG: "it", ENCODING: UTF-8 | ISO-8859-1
+// Author: Fabio Rotondo <fabio@rotondo.it>
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "it",
+
+	tooltips: {
+		bold:           "Grassetto",
+		italic:         "Italico",
+		underline:      "Sottolineato",
+		strikethrough:  "Barrato",
+		subscript:      "Pedice",
+		superscript:    "Apice",
+		justifyleft:    "Giustifica a Sinistra",
+		justifycenter:  "Giustifica in Centro",
+		justifyright:   "Giustifica a Destra",
+		justifyfull:    "Giustifica Completamente",
+		orderedlist:    "Lista Ordinata",
+		unorderedlist:  "Lista Puntata",
+		outdent:        "Decrementa Indentazione",
+		indent:         "Incrementa Indentazione",
+		forecolor:      "Colore del Carattere",
+		hilitecolor:    "Colore di Sfondo",
+		horizontalrule: "Linea Orizzontale",
+		createlink:     "Inserisci un Link",
+		insertimage:    "Inserisci un'Immagine",
+		inserttable:    "Inserisci una Tabella",
+		htmlmode:       "Attiva il codice HTML",
+		popupeditor:    "Allarga l'editor",
+		about:          "Info sull'editor",
+		showhelp:       "Aiuto sull'editor",
+		textindicator:  "Stile Attuale",
+		undo:           "Elimina l'ultima modifica",
+		redo:           "Ripristina l'ultima modifica",
+		cut:            "Taglia l'area selezionata",
+		copy:           "Copia l'area selezionata",
+		paste:          "Incolla dalla memoria"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Annulla"
+	},
+
+	msg: {
+		"Path":         "Percorso",
+		"TEXT_MODE":    "Sei in MODALITA' TESTO. Usa il bottone [<>] per tornare alla modalità WYSIWYG."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/cz.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/cz.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/cz.js	(revision 1328)
@@ -0,0 +1,63 @@
+﻿// I18N constants
+
+// LANG: "cz", ENCODING: UTF-8 | ISO-8859-2
+// Author: Jiri Löw, <jirilow@jirilow.com>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "cz",
+
+	tooltips: {
+		bold:           "Tučně",
+		italic:         "Kurzíva",
+		underline:      "Podtržení",
+		strikethrough:  "Přeškrtnutí",
+		subscript:      "Dolní index",
+		superscript:    "Horní index",
+		justifyleft:    "Zarovnat doleva",
+		justifycenter:  "Na střed",
+		justifyright:   "Zarovnat doprava",
+		justifyfull:    "Zarovnat do stran",
+		orderedlist:    "Seznam",
+		unorderedlist:  "Odrážky",
+		outdent:        "Předsadit",
+		indent:         "Odsadit",
+		forecolor:      "Barva písma",
+		hilitecolor:    "Barva pozadí",
+		horizontalrule: "Vodorovná čára",
+		createlink:     "Vložit odkaz",
+		insertimage:    "Vložit obrázek",
+		inserttable:    "Vložit tabulku",
+		htmlmode:       "Přepnout HTML",
+		popupeditor:    "Nové okno editoru",
+		about:          "O této aplikaci",
+		showhelp:       "Nápověda aplikace",
+		textindicator:  "Zvolený styl",
+		undo:           "Vrátí poslední akci",
+		redo:           "Opakuje poslední akci",
+		cut:            "Vyjmout",
+		copy:           "Kopírovat",
+		paste:          "Vložit"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Zrušit"
+	},
+
+	msg: {
+		"Path":         "Cesta",
+		"TEXT_MODE":    "Jste v TEXTOVÉM REŽIMU.  Použijte tlačítko [<>] pro přepnutí do WYSIWIG."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/no.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/no.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/no.js	(revision 1328)
@@ -0,0 +1,79 @@
+// Norwegian version for htmlArea v3.0 - pre1
+// - translated by ses<ses@online.no>
+// Additional translations by Håvard Wigtil <havardw@extend.no>
+// term´s and licenses are equal to htmlarea!
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "no",
+
+	tooltips: {
+		bold:                 "Fet",
+		italic:               "Kursiv",
+		underline:            "Understreket",
+		strikethrough:        "Gjennomstreket",
+		subscript:            "Nedsenket",
+		superscript:          "Opphøyet",
+		justifyleft:          "Venstrejuster",
+		justifycenter:        "Midtjuster",
+		justifyright:         "Høyrejuster",
+		justifyfull:          "Blokkjuster",
+		insertorderedlist:    "Nummerert liste",
+		insertunorderedlist:  "Punktliste",
+		outdent:              "Reduser innrykk",
+		indent:               "Øke innrykk",
+		forecolor:            "Tekstfarge",
+		hilitecolor:          "Bakgrundsfarge",
+		inserthorizontalrule: "Vannrett linje",
+		createlink:           "Lag lenke",
+		insertimage:          "Sett inn bilde",
+		inserttable:          "Sett inn tabell",
+		htmlmode:             "Vis kildekode",
+		popupeditor:          "Vis i eget vindu",
+		about:                "Om denne editor",
+		showhelp:             "Hjelp",
+		textindicator:        "Nåværende stil",
+                undo:                 "Angrer siste redigering",
+		redo:                 "Gjør om siste angring",
+		cut:                  "Klipp ut område",
+		copy:                 "Kopier område",
+		paste:                "Lim inn",
+		lefttoright:          "Fra venstre mot høyre",
+		righttoleft:          "Fra høyre mot venstre"
+	},
+    
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Avbryt"
+	},
+
+	msg: {
+		"Path":         "Tekstvelger",
+		"TEXT_MODE":    "Du er i tekstmodus  Klikk på [<>] for å gå tilbake til WYSIWIG.",
+                "IE-sucks-full-screen" :
+		// translate here
+                "Visning i eget vindu har kjente problemer med Internet Explorer, " + 
+                "på grunn av problemer med denne nettleseren. Mulige problemer er et uryddig " + 
+                "skjermbilde, manglende editorfunksjoner og/eller at nettleseren crasher. Hvis du bruker Windows 95 eller Windows 98 " +
+                "er det også muligheter for at Windows will crashe.\n\n" +
+                "Trykk 'OK' hvis du vil bruke visning i eget vindu på tross av denne advarselen."
+	},
+
+	dialogs: {
+		"Cancel"                                            : "Avbryt",
+		"Insert/Modify Link"                                : "Rediger lenke",
+		"New window (_blank)"                               : "Eget vindu (_blank)",
+		"None (use implicit)"                               : "Ingen (bruk standardinnstilling)",
+		"OK"                                                : "OK",
+		"Other"                                             : "Annen",
+		"Same frame (_self)"                                : "Samme ramme (_self)",
+		"Target:"                                           : "Mål:",
+		"Title (tooltip):"                                  : "Tittel (tooltip):",
+		"Top frame (_top)"                                  : "Toppramme (_top)",
+		"URL:"                                              : "Adresse:",
+		"You must enter the URL where this link points to"  : "Du må skrive inn en adresse som denne lenken skal peke til"
+	}
+};
+
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-jis.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-jis.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-jis.js	(revision 1328)
@@ -0,0 +1,37 @@
+// I18N constants -- Japanese JIS
+// by Manabu Onoue -- tmocsys@tmocsys.com
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ja-jis",
+
+	tooltips: {
+		bold:           "$BB@;z(B",
+		italic:         "$B<PBN(B",
+		underline:      "$B2<@~(B",
+		strikethrough:  "$BBG$A>C$7@~(B",
+		subscript:      "$B2<IU$-E:$(;z(B",
+		superscript:    "$B>eIU$-E:$(;z(B",
+		justifyleft:    "$B:84s$;(B",
+		justifycenter:  "$BCf1{4s$;(B",
+		justifyright:   "$B1&4s$;(B",
+		justifyfull:    "$B6QEy3dIU(B",
+		orderedlist:    "$BHV9fIU$-2U>r=q$-(B",
+		unorderedlist:  "$B5-9fIU$-2U>r=q$-(B",
+		outdent:        "$B%$%s%G%s%H2r=|(B",
+		indent:         "$B%$%s%G%s%H@_Dj(B",
+		forecolor:      "$BJ8;z?'(B",
+		backcolor:      "$BGX7J?'(B",
+		horizontalrule: "$B?eJ?@~(B",
+		createlink:     "$B%j%s%/:n@.(B",
+		insertimage:    "$B2hA|A^F~(B",
+		inserttable:    "$B%F!<%V%kA^F~(B",
+		htmlmode:       "HTML$BI=<(@ZBX(B",
+		popupeditor:    "$B%(%G%#%?3HBg(B",
+		about:          "$B%P!<%8%g%s>pJs(B",
+		help:           "$B%X%k%W(B",
+		textindicator:  "$B8=:_$N%9%?%$%k(B"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-utf8.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-utf8.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-utf8.js	(revision 1328)
@@ -0,0 +1,37 @@
+﻿// I18N constants -- Japanese UTF-8
+// by Manabu Onoue -- tmocsys@tmocsys.com
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ja-utf8",
+
+	tooltips: {
+		bold:           "太字",
+		italic:         "斜体",
+		underline:      "下線",
+		strikethrough:  "打ち消し線",
+		subscript:      "下付き添え字",
+		superscript:    "上付き添え字",
+		justifyleft:    "左寄せ",
+		justifycenter:  "中央寄せ",
+		justifyright:   "右寄せ",
+		justifyfull:    "均等割付",
+		orderedlist:    "番号付き箇条書き",
+		unorderedlist:  "記号付き箇条書き",
+		outdent:        "インデント解除",
+		indent:         "インデント設定",
+		forecolor:      "文字色",
+		backcolor:      "背景色",
+		horizontalrule: "水平線",
+		createlink:     "リンク作成",
+		insertimage:    "画像挿入",
+		inserttable:    "テーブル挿入",
+		htmlmode:       "HTML表示切替",
+		popupeditor:    "エディタ拡大",
+		about:          "バージョン情報",
+		help:           "ヘルプ",
+		textindicator:  "現在のスタイル"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/lt.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/lt.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/lt.js	(revision 1328)
@@ -0,0 +1,55 @@
+// I18N constants
+
+// LANG: "lt", ENCODING: UTF-8
+// Author: Jaroslav Šatkevič, <jaro@akl.lt>
+
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "lt",
+
+	tooltips: {
+		bold:           "Paryškinti",
+		italic:         "Kursyvas",
+		underline:      "Pabraukti",
+		strikethrough:  "Perbraukti",
+		subscript:      "Apatinis indeksas",
+		superscript:    "Viršutinis indeksas",
+		justifyleft:    "Lygiavimas pagal kairę",
+		justifycenter:  "Lygiavimas pagal centrą",
+		justifyright:   "Lygiavimas pagal dešinę",
+		justifyfull:    "Lygiuoti pastraipą",
+		orderedlist:    "Numeruotas sąrašas",
+		unorderedlist:  "Suženklintas sąrašas",
+		outdent:        "Sumažinti paraštę",
+		indent:         "Padidinti paraštę",
+		forecolor:      "Šrifto spalva",
+		hilitecolor:    "Fono spalva",
+		horizontalrule: "Horizontali linija",
+		createlink:     "Įterpti nuorodą",
+		insertimage:    "Įterpti paveiksliuką",
+		inserttable:    "Įterpti lentelę",
+		htmlmode:       "Perjungti į HTML/WYSIWYG",
+		popupeditor:    "Išplėstas redagavimo ekranas/Enlarge Editor",
+		about:          "Apie redaktorių",
+		showhelp:       "Pagalba naudojant redaktorių",
+		textindicator:  "Dabartinis stilius",
+		undo:           "Atšaukia paskutini jūsų veiksmą",
+		redo:           "Pakartoja paskutinį atšauktą jūsų veiksmą",
+		cut:            "Iškirpti",
+		copy:           "Kopijuoti",
+		paste:          "Įterpti"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Atšaukti"
+	},
+
+	msg: {
+		"Path":         "Kelias",
+		"TEXT_MODE":    "Jūs esete teksto režime.  Naudokite [<>] mygtuką grįžimui į WYSIWYG."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ro.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ro.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ro.js	(revision 1328)
@@ -0,0 +1,80 @@
+// I18N constants
+
+// LANG: "ro", ENCODING: UTF-8
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ro",
+
+	tooltips: {
+		bold:           "Îngroşat",
+		italic:         "Italic",
+		underline:      "Subliniat",
+		strikethrough:  "Tăiat",
+		subscript:      "Indice jos",
+		superscript:    "Indice sus",
+		justifyleft:    "Aliniere la stânga",
+		justifycenter:  "Aliniere pe centru",
+		justifyright:   "Aliniere la dreapta",
+		justifyfull:    "Aliniere în ambele părţi",
+		orderedlist:    "Listă ordonată",
+		unorderedlist:  "Listă marcată",
+		outdent:        "Micşorează alineatul",
+		indent:         "Măreşte alineatul",
+		forecolor:      "Culoarea textului",
+		hilitecolor:    "Culoare de fundal",
+		horizontalrule: "Linie orizontală",
+		createlink:     "Inserează/modifică link",
+		insertimage:    "Inserează/modifică imagine",
+		inserttable:    "Inserează un tabel",
+		htmlmode:       "Sursa HTML / WYSIWYG",
+		popupeditor:    "Maximizează editorul",
+		about:          "Despre editor",
+		showhelp:       "Documentaţie (devel)",
+		textindicator:  "Stilul curent",
+		undo:           "Anulează ultima acţiune",
+		redo:           "Reface ultima acţiune anulată",
+		cut:            "Taie în clipboard",
+		copy:           "Copie în clipboard",
+		paste:          "Aduce din clipboard",
+		lefttoright:    "Direcţia de scriere: stânga - dreapta",
+		righttoleft:    "Direcţia de scriere: dreapta - stânga"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Anulează"
+	},
+
+	msg: {
+		"Path":         "Calea",
+		"TEXT_MODE":    "Eşti în modul TEXT.  Apasă butonul [<>] pentru a te întoarce în modul WYSIWYG."
+	},
+
+	dialogs: {
+		"Cancel"                                            : "Renunţă",
+		"Insert/Modify Link"                                : "Inserează/modifcă link",
+		"New window (_blank)"                               : "Fereastră nouă (_blank)",
+		"None (use implicit)"                               : "Nimic (foloseşte ce-i implicit)",
+		"OK"                                                : "Acceptă",
+		"Other"                                             : "Alt target",
+		"Same frame (_self)"                                : "Aceeaşi fereastră (_self)",
+		"Target:"                                           : "Ţinta:",
+		"Title (tooltip):"                                  : "Titlul (tooltip):",
+		"Top frame (_top)"                                  : "Fereastra principală (_top)",
+		"URL:"                                              : "URL:",
+		"You must enter the URL where this link points to"  : "Trebuie să introduceţi un URL"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/lv.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/lv.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/lv.js	(revision 1328)
@@ -0,0 +1,55 @@
+// I18N constants
+
+// LANG: "lv", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+// Translated by: Janis Klavins, <janis.klavins@devia.lv>
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "lv",
+
+	tooltips: {
+		bold:           "Trekniem burtiem",
+		italic:         "Kursîvâ",
+		underline:      "Pasvîtrots",
+		strikethrough:  "Pârsvîtrots",
+		subscript:      "Novietot zem rindas",
+		superscript:    "Novietot virs rindas",
+		justifyleft:    "Izlîdzinât pa kreisi",
+		justifycenter:  "Izlîdzinât centrâ",
+		justifyright:   "Izlîdzinât pa labi",
+		justifyfull:    "Izlîdzinât pa visu lapu",
+		orderedlist:    "Numurçts saraksts",
+		unorderedlist:  "Saraksts",
+		outdent:        "Samazinât atkâpi",
+		indent:         "Palielinât atkâpi",
+		forecolor:      "Burtu krâsa",
+		hilitecolor:    "Fona krâsa",
+		horizontalrule: "Horizontâla atdalîtâjsvîtra",
+		createlink:     "Ievietot hipersaiti",
+		insertimage:    "Ievietot attçlu",
+		inserttable:    "Ievietot tabulu",
+		htmlmode:       "Skatît HTML kodu",
+		popupeditor:    "Palielinât Rediìçtâju",
+		about:          "Par ðo rediìçtâju",
+		showhelp:       "Rediìçtâja palîgs",
+		textindicator:  "Patreizçjais stils",
+		undo:           "Atcelt pçdçjo darbîbu",
+		redo:           "Atkârtot pçdçjo darbîbu",
+		cut:            "Izgriezt iezîmçto",
+		copy:           "Kopçt iezîmçto",
+		paste:          "Ievietot iezîmçto"
+	},
+
+	buttons: {
+		"ok":           "Labi",
+		"cancel":       "Atcelt"
+	},
+
+	msg: {
+		"Path":         "Ceïð",
+		"TEXT_MODE":    "Jûs patlaban darbojaties TEKSTA REÞÎMÂ. Lai pârietu atpakaï uz GRAFISKO REÞÎMU (WYSIWIG), lietojiet [<>] pogu."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/vn.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/vn.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/vn.js	(revision 1328)
@@ -0,0 +1,51 @@
+// I18N constants : Vietnamese
+// LANG: "en", ENCODING: UTF-8
+// Author: Nguyễn Đình Nam, <hncryptologist@yahoo.com>
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "vn",
+
+	tooltips: {
+		bold:           "Đậm",
+		italic:         "Nghiêng",
+		underline:      "Gạch Chân",
+		strikethrough:  "Gạch Xóa",
+		subscript:      "Viết Xuống Dưới",
+		superscript:    "Viết Lên Trên",
+		justifyleft:    "Căn Trái",
+		justifycenter:  "Căn Giữa",
+		justifyright:   "Căn Phải",
+		justifyfull:    "Căn Đều",
+		orderedlist:    "Danh Sách Có Thứ Tự",
+		unorderedlist:  "Danh Sách Phi Thứ Tự",
+		outdent:        "Lùi Ra Ngoài",
+		indent:         "Thụt Vào Trong",
+		forecolor:      "Màu Chữ",
+		backcolor:      "Màu Nền",
+		horizontalrule: "Dòng Kẻ Ngang",
+		createlink:     "Tạo Liên Kết",
+		insertimage:    "Chèn Ảnh",
+		inserttable:    "Chèn Bảng",
+		htmlmode:       "Chế Độ Mã HTML",
+		popupeditor:    "Phóng To Ô Soạn Thảo",
+		about:          "Tự Giới Thiệu",
+		showhelp:       "Giúp Đỡ",
+		textindicator:  "Định Dạng Hiện Thời",
+		undo:           "Undo",
+		redo:           "Redo",
+		cut:            "Cắt",
+		copy:           "Copy",
+		paste:          "Dán"
+	},
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Hủy"
+	},
+	msg: {
+		"Path":         "Đường Dẫn",
+		"TEXT_MODE":    "Bạn đang ở chế độ text.  Sử dụng nút [<>] để chuyển lại chế độ WYSIWIG."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/da.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/da.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/da.js	(revision 1328)
@@ -0,0 +1,38 @@
+// danish version for htmlArea v3.0 - Alpha Release
+// - translated by rene<rene@laerke.net>
+// term´s and licenses are equal to htmlarea!
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "da",
+
+	tooltips: {
+		bold:           "Fed",
+		italic:         "Kursiv",
+		underline:      "Understregning",
+		strikethrough:  "Overstregning ",
+		subscript:      "Sænket skrift",
+		superscript:    "Hævet skrift",
+		justifyleft:    "Venstrejuster",
+		justifycenter:  "Centrer",
+		justifyright:   "Højrejuster",
+		justifyfull:    "Lige margener",
+		orderedlist:    "Opstilling med tal",
+		unorderedlist:  "Opstilling med punkttegn",
+		outdent:        "Formindsk indrykning",
+		indent:         "Forøg indrykning",
+		forecolor:      "Skriftfarve",
+		backcolor:      "Baggrundsfarve",
+		horizontalrule: "Horisontal linie",
+		createlink:     "Indsæt hyperlink",
+		insertimage:    "Indsæt billede",
+		inserttable:    "Indsæt tabel",
+		htmlmode:       "HTML visning",
+		popupeditor:    "Vis editor i popup",
+		about:          "Om htmlarea",
+		help:           "Hjælp",
+		textindicator:  "Anvendt stil"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ru.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ru.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ru.js	(revision 1328)
@@ -0,0 +1,63 @@
+﻿// I18N constants
+
+// LANG: "ru", ENCODING: UTF-8 | ISO-8859-1
+// Author: Yulya Shtyryakova, <yulya@vdcom.ru>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ru",
+
+	tooltips: {
+		bold:           "Полужирный",
+		italic:         "Наклонный",
+		underline:      "Подчеркнутый",
+		strikethrough:  "Перечеркнутый",
+		subscript:      "Нижний индекс",
+		superscript:    "Верхний индекс",
+		justifyleft:    "По левому краю",
+		justifycenter:  "По центру",
+		justifyright:   "По правому краю",
+		justifyfull:    "По ширине",
+		insertorderedlist:    "Нумерованный лист",
+		insertunorderedlist:  "Маркированный лист",
+		outdent:        "Уменьшить отступ",
+		indent:         "Увеличить отступ",
+		forecolor:      "Цвет шрифта",
+		hilitecolor:    "Цвет фона",
+		horizontalrule: "Горизонтальный разделитель",
+		createlink:     "Вставить гиперссылку",
+		insertimage:    "Вставить изображение",
+		inserttable:    "Вставить таблицу",
+		htmlmode:       "Показать Html-код",
+		popupeditor:    "Увеличить редактор",
+		about:          "О редакторе",
+		showhelp:       "Помощь",
+		textindicator:  "Текущий стиль",
+		undo:           "Отменить",
+		redo:           "Повторить",
+		cut:            "Вырезать",
+		copy:           "Копировать",
+		paste:          "Вставить"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Отмена"
+	},
+
+	msg: {
+		"Path":         "Путь",
+		"TEXT_MODE":    "Вы в режиме отображения Html-кода. нажмите кнопку [<>], чтобы переключиться в визуальный режим."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/gb.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/gb.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/gb.js	(revision 1328)
@@ -0,0 +1,36 @@
+// I18N constants -- Chinese GB
+// by Dave Lo -- dlo@interactivetools.com
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "gb",
+
+	tooltips: {
+		bold:           "´ÖÌå",
+		italic:         "Ð±Ìå",
+		underline:      "µ×Ïß",
+		strikethrough:  "É¾³ýÏß",
+		subscript:      "ÏÂ±ê",
+		superscript:    "ÉÏ±ê",
+		justifyleft:    "Î»ÖÃ¿¿×ó",
+		justifycenter:  "Î»ÖÃ¾ÓÖÐ",
+		justifyright:   "Î»ÖÃ¿¿ÓÒ",
+		justifyfull:    "Î»ÖÃ×óÓÒÆ½µÈ",
+		orderedlist:    "Ë³ÐòÇåµ¥",
+		unorderedlist:  "ÎÞÐòÇåµ¥",
+		outdent:        "¼õÐ¡ÐÐÇ°¿Õ°×",
+		indent:         "¼Ó¿íÐÐÇ°¿Õ°×",
+		forecolor:      "ÎÄ×ÖÑÕÉ«",
+		backcolor:      "±³¾°ÑÕÉ«",
+		horizontalrule: "Ë®Æ½Ïß",
+		createlink:     "²åÈëÁ¬½á",
+		insertimage:    "²åÈëÍ¼ÐÎ",
+		inserttable:    "²åÈë±í¸ñ",
+		htmlmode:       "ÇÐ»»HTMLÔ­Ê¼Âë",
+		popupeditor:    "·Å´ó",
+		about:          "¹Øì¶ HTMLArea",
+		help:           "ËµÃ÷",
+		textindicator:  "×ÖÌåÀý×Ó"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/de.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/de.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/de.js	(revision 1328)
@@ -0,0 +1,54 @@
+// german version for htmlArea v3.0 - Alpha Release
+// - translated by AtK<atk@chello.at>
+// term´s and licenses are equal to htmlarea!
+// translation improved by broxx<broxx@broxx.com>
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "de",
+
+	tooltips: {
+		bold:           "Fett",
+		italic:         "Kursiv",
+		underline:      "Unterstrichen",
+		strikethrough:  "Durchgestrichen",
+		subscript:      "Hochgestellt",
+		superscript:    "Tiefgestellt",
+		justifyleft:    "Links ausrichten",
+		justifycenter:  "Zentrieren",
+		justifyright:   "Rechts ausrichten",
+		justifyfull:    "Blocksatz",
+		orderedlist:    "Nummerierung",
+		unorderedlist:  "Aufzaehlungszeichen",
+		outdent:        "Einzug verkleinern",
+		indent:         "Einzug vergrössern",
+		forecolor:      "Text Farbe",
+		hilitecolor:    "Hintergrund Farbe",
+		horizontalrule: "Horizontale Linie",
+		createlink:     "Hyperlink einfuegen",
+		insertimage:    "Bild einfuegen",
+		inserttable:    "Tabelle einfuegen",
+		htmlmode:       "HTML Modus",
+		popupeditor:    "Editor im Popup öffnen",
+		about:          "Ueber HtmlArea",
+		showhelp:       "Hilfe",
+		textindicator:  "derzeitiger Stil",
+		undo:           "Rueckgaengig",
+		redo:           "Wiederholen",
+		cut:            "Ausschneiden",
+		copy:           "Kopieren",
+		paste:          "Einfuegen"
+	},
+  
+ buttons: {
+		"ok":           "OK",
+		"cancel":       "Abbrechen"
+	},
+
+	msg: {
+		"Path":         "Pfad",
+		"TEXT_MODE":    "Du befindest dich im HTML Modus.  Benuetze die [<>] Schaltflaeche um in den WYSIWIG-Modus zu wechseln."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ee.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ee.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ee.js	(revision 1328)
@@ -0,0 +1,63 @@
+// I18N constants
+
+// LANG: "ee", ENCODING: UTF-8 | ISO-8859-1
+// Author: Martin Raie, <albertvill@hot.ee>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ee",
+
+	tooltips: {
+		bold:           "Paks",
+		italic:         "Kursiiv",
+		underline:      "Allakriipsutatud",
+		strikethrough:  "Läbikriipsutatud",
+		subscript:      "Allindeks",
+		superscript:    "Ülaindeks",
+		justifyleft:    "Joonda vasakule",
+		justifycenter:  "Joonda keskele",
+		justifyright:   "Joonda paremale",
+		justifyfull:    "Rööpjoonda",
+		insertorderedlist:    "Nummerdus",
+		insertunorderedlist:  "Täpploend",
+		outdent:        "Vähenda taanet",
+		indent:         "Suurenda taanet",
+		forecolor:      "Fondi värv",
+		hilitecolor:    "Tausta värv",
+		inserthorizontalrule: "Horisontaaljoon",
+		createlink:     "Lisa viit",
+		insertimage:    "Lisa pilt",
+		inserttable:    "Lisa tabel",
+		htmlmode:       "HTML/tavaline vaade",
+		popupeditor:    "Suurenda toimeti aken",
+		about:          "Teave toimeti kohta",
+		showhelp:       "Spikker",
+		textindicator:  "Kirjastiil",
+		undo:           "Võta tagasi",
+		redo:           "Tee uuesti",
+		cut:            "Lõika",
+		copy:           "Kopeeri",
+		paste:          "Kleebi"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Loobu"
+	},
+
+	msg: {
+		"Path":         "Path",
+		"TEXT_MODE":    "Sa oled tekstireziimis.  Kasuta nuppu [<>] lülitamaks tagasi WYSIWIG reziimi."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/he.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/he.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/he.js	(revision 1328)
@@ -0,0 +1,63 @@
+// I18N constants
+
+// LANG: "he", ENCODING: UTF-8
+// Author: Liron Newman, <plastish@ultinet.org>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "he",
+
+	tooltips: {
+		bold:           "מודגש",
+		italic:         "נטוי",
+		underline:      "קו תחתי",
+		strikethrough:  "קו אמצע",
+		subscript:      "כתב עילי",
+		superscript:    "כתב תחתי",
+		justifyleft:    " ישור לשמאל",
+		justifycenter:  "ישור למרכז",
+		justifyright:   "ישור לימין",
+		justifyfull:    "יישור לשורה מלאה",
+		orderedlist:    "רשימה ממוספרת",
+		unorderedlist:  "רשימה לא ממוספרת",
+		outdent:        "הקטן כניסה",
+		indent:         "הגדל כניסה",
+		forecolor:      "צבע גופן",
+		hilitecolor:    "צבע רקע",
+		horizontalrule: "קו אנכי",
+		createlink:     "הכנס היפר-קישור",
+		insertimage:    "הכנס תמונה",
+		inserttable:    "הכנס טבלה",
+		htmlmode:       "שנה מצב קוד HTML",
+		popupeditor:    "הגדל את העורך",
+		about:          "אודות עורך זה",
+		showhelp:       "עזרה לשימוש בעורך",
+		textindicator:  "סגנון נוכחי",
+		undo:           "מבטל את פעולתך האחרונה",
+		redo:           "מבצע מחדש את הפעולה האחרונה שביטלת",
+		cut:            "גזור בחירה",
+		copy:           "העתק בחירה",
+		paste:          "הדבק מהלוח"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "ביטול"
+	},
+
+	msg: {
+		"Path":         "נתיב עיצוב",
+		"TEXT_MODE":    "אתה במצב טקסט נקי (קוד). השתמש בכפתור [<>] כדי לחזור למצב WYSIWYG (תצוגת עיצוב)."
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/fi.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/fi.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/fi.js	(revision 1328)
@@ -0,0 +1,46 @@
+// I18N constants
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "en",
+
+	tooltips: {
+		bold:           	"Lihavoitu",
+		italic:         	"Kursivoitu",
+		underline:      	"Alleviivattu",
+		strikethrough:  	"Yliviivattu",
+		subscript:      	"Alaindeksi",
+		superscript:    	"Yläindeksi",
+		justifyleft:    	"Tasaa vasemmat reunat",
+		justifycenter:  	"Keskitä",
+		justifyright:   	"Tasaa oikeat reunat",
+		justifyfull:    	"Tasaa molemmat reunat",
+		insertorderedlist: 	"Numerointi",
+		insertunorderedlist: 	"Luettelomerkit",
+		outdent:        	"Lisää sisennystä",
+		indent:         	"Pienennä sisennystä",
+		forecolor:      	"Fontin väri",
+		hilitecolor:    	"Taustaväri",
+		inserthorizontalrule: 	"Vaakaviiva",
+		createlink:     	"Lisää Linkki",
+		insertimage:    	"Lisää Kuva",
+		inserttable:    	"Lisää Taulu",
+		htmlmode:       	"HTML Lähdekoodi vs WYSIWYG",
+		popupeditor:    	"Suurenna Editori",
+		about:          	"Tietoja Editorista",
+		showhelp:           	"Näytä Ohje",
+		textindicator:  	"Nykyinen tyyli",
+		undo:           	"Peruuta viimeinen toiminto",
+		redo:           	"Palauta viimeinen toiminto",
+		cut:            	"Leikkaa maalattu",
+		copy:           	"Kopioi maalattu",
+		paste:          	"Liitä leikepyödältä"
+	},
+
+	buttons: {
+		"ok":           	"Hyväksy",
+		"cancel":       	"Peruuta"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/nb.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/nb.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/nb.js	(revision 1328)
@@ -0,0 +1,36 @@
+// I18N constants
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "nb",
+
+	tooltips: {
+		bold:           "Fet",
+		italic:         "Kursiv",
+		underline:      "Understreket",
+		strikethrough:  "Gjennomstreket",
+		subscript:      "Senket",
+		superscript:    "Hevet",
+		justifyleft:    "Venstrejuster",
+		justifycenter:  "Midtjuster",
+		justifyright:   "Høyrejuster",
+		justifyfull:    "Blokkjuster",
+		orderedlist:    "Nummerert liste",
+		unorderedlist:  "Punktmerket liste",
+		outdent:        "Øke innrykk",
+		indent:         "Reduser innrykk",
+		forecolor:      "Skriftfarge",
+		backcolor:      "Bakgrunnsfarge",
+		horizontalrule: "Horisontal linje",
+		createlink:     "Sett inn lenke",
+		insertimage:    "Sett inn bilde",
+		inserttable:    "Sett inn tabell",
+		htmlmode:       "Vis HTML kode",
+		popupeditor:    "Forstørr redigeringsvindu",
+		about:          "Om..",
+		help:           "Hjelp",
+		textindicator:  "Gjeldende stil"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-sjis.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-sjis.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-sjis.js	(revision 1328)
@@ -0,0 +1,38 @@
+// I18N constants -- Japanese Shift-JIS
+// by Manabu Onoue -- tmocsys@tmocsys.com
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ja-sjis",
+
+	tooltips: {
+		bold:           "¾",
+		italic:         "ÎÌ",
+		underline:      "ºü",
+		strikethrough:  "Å¿Áµü",
+		subscript:      "ºt«Y¦",
+		superscript:    "ãt«Y¦",
+		justifyleft:    "¶ñ¹",
+		justifycenter:  "ñ¹",
+		justifyright:   "Eñ¹",
+		justifyfull:    "Ït",
+		orderedlist:    "Ôt«Óð«",
+		unorderedlist:  "Lt«Óð«",
+		outdent:        "Cfgð",
+		indent:         "CfgÝè",
+		forecolor:      "¶F",
+		backcolor:      "wiF",
+		horizontalrule: "
+½ü",
+		createlink:     "Nì¬",
+		insertimage:    "æ}ü",
+		inserttable:    "e[u}ü",
+		htmlmode:       "HTML\¦ØÖ",
+		popupeditor:    "GfB^gå",
+		about:          "o[Wîñ",
+		help:           "wv",
+		textindicator:  "»ÝÌX^C"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/el.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/el.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/el.js	(revision 1328)
@@ -0,0 +1,75 @@
+// I18N constants
+
+// LANG: "el", ENCODING: UTF-8 | ISO-8859-7
+// Author: Dimitris Glezos, dimitris@glezos.com
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "el",
+
+	tooltips: {
+		bold:           "Έντονα",
+		italic:         "Πλάγια",
+		underline:      "Υπογραμμισμένα",
+		strikethrough:  "Διαγραμμένα",
+		subscript:      "Δείκτης",
+		superscript:    "Δείκτης",
+		justifyleft:    "Στοίχιση Αριστερά",
+		justifycenter:  "Στοίχιση Κέντρο",
+		justifyright:   "Στοίχιση Δεξιά",
+		justifyfull:    "Πλήρης Στοίχιση",
+		orderedlist:    "Αρίθμηση",
+		unorderedlist:  "Κουκκίδες",
+		outdent:        "Μείωση Εσοχής",
+		indent:         "Αύξηση Εσοχής",
+		forecolor:      "Χρώμα Γραμματοσειράς",
+		hilitecolor:    "Χρώμα Φόντου",
+		horizontalrule: "Οριζόντια Γραμμή",
+		createlink:     "Εισαγωγή Συνδέσμου",
+		insertimage:    "Εισαγωγή/Τροποποίηση Εικόνας",
+		inserttable:    "Εισαγωγή Πίνακα",
+		htmlmode:       "Εναλλαγή σε/από HTML",
+		popupeditor:    "Μεγένθυνση επεξεργαστή",
+		about:          "Πληροφορίες",
+		showhelp:       "Βοήθεια",
+		textindicator:  "Παρών στυλ",
+		undo:           "Αναίρεση τελευταίας ενέργειας",
+		redo:           "Επαναφορά από αναίρεση",
+		cut:            "Αποκοπή",
+		copy:           "Αντιγραφή",
+		paste:          "Επικόλληση",
+        lefttoright:    "Κατεύθυνση αριστερά προς δεξιά",
+        righttoleft:    "Κατεύθυνση από δεξιά προς τα αριστερά"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Ακύρωση"
+	},
+
+	msg: {
+		"Path":         "Διαδρομή",
+		"TEXT_MODE":    "Είστε σε TEXT MODE.  Χρησιμοποιήστε το κουμπί [<>] για να επανέρθετε στο WYSIWIG.",
+
+       "IE-sucks-full-screen":	"Η κατάσταση πλήρης οθόνης έχει προβλήματα με τον Internet Explorer, " +
+       							"λόγω σφαλμάτων στον ίδιο τον browser.  Αν το σύστημα σας είναι Windows 9x " +
+       							"μπορεί και να χρειαστείτε reboot. Αν είστε σίγουροι, πατήστε ΟΚ."
+       },
+
+       dialogs: {
+               "Cancel"                                            : "Ακύρωση",
+               "Insert/Modify Link"                                : "Εισαγωγή/Τροποποίηση σύνδεσμου",
+               "New window (_blank)"                               : "Νέο παράθυρο (_blank)",
+               "None (use implicit)"                               : "Κανένα (χρήση απόλυτου)",
+               "OK"                                                : "Εντάξει",
+               "Other"                                             : "Αλλο",
+               "Same frame (_self)"                                : "Ίδιο frame (_self)",
+               "Target:"                                           : "Target:",
+               "Title (tooltip):"                                  : "Τίτλος (tooltip):",
+               "Top frame (_top)"                                  : "Πάνω frame (_top)",
+               "URL:"                                              : "URL:",
+               "You must enter the URL where this link points to"  : "Πρέπει να εισάγετε το URL που οδηγεί αυτός ο σύνδεσμος"
+       }
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/en.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/en.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/en.js	(revision 1328)
@@ -0,0 +1,88 @@
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "en",
+
+	tooltips: {
+		bold:           "Bold",
+		italic:         "Italic",
+		underline:      "Underline",
+		strikethrough:  "Strikethrough",
+		subscript:      "Subscript",
+		superscript:    "Superscript",
+		justifyleft:    "Justify Left",
+		justifycenter:  "Justify Center",
+		justifyright:   "Justify Right",
+		justifyfull:    "Justify Full",
+		orderedlist:    "Ordered List",
+		unorderedlist:  "Bulleted List",
+		outdent:        "Decrease Indent",
+		indent:         "Increase Indent",
+		forecolor:      "Font Color",
+		hilitecolor:    "Background Color",
+		horizontalrule: "Horizontal Rule",
+		createlink:     "Insert Web Link",
+		insertimage:    "Insert/Modify Image",
+		inserttable:    "Insert Table",
+		htmlmode:       "Toggle HTML Source",
+		popupeditor:    "Enlarge Editor",
+		about:          "About this editor",
+		showhelp:       "Help using editor",
+		textindicator:  "Current style",
+		undo:           "Undoes your last action",
+		redo:           "Redoes your last action",
+		cut:            "Cut selection",
+		copy:           "Copy selection",
+		paste:          "Paste from clipboard",
+		lefttoright:    "Direction left to right",
+		righttoleft:    "Direction right to left"
+	},
+
+	buttons: {
+		"ok":           "OK",
+		"cancel":       "Cancel"
+	},
+
+	msg: {
+		"Path":         "Path",
+		"TEXT_MODE":    "You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG.",
+
+		"IE-sucks-full-screen" :
+		// translate here
+		"The full screen mode is known to cause problems with Internet Explorer, " +
+		"due to browser bugs that we weren't able to workaround.  You might experience garbage " +
+		"display, lack of editor functions and/or random browser crashes.  If your system is Windows 9x " +
+		"it's very likely that you'll get a 'General Protection Fault' and need to reboot.\n\n" +
+		"You have been warned.  Please press OK if you still want to try the full screen editor."
+	},
+
+	dialogs: {
+		"Cancel"                                            : "Cancel",
+		"Insert/Modify Link"                                : "Insert/Modify Link",
+		"New window (_blank)"                               : "New window (_blank)",
+		"None (use implicit)"                               : "None (use implicit)",
+		"OK"                                                : "OK",
+		"Other"                                             : "Other",
+		"Same frame (_self)"                                : "Same frame (_self)",
+		"Target:"                                           : "Target:",
+		"Title (tooltip):"                                  : "Title (tooltip):",
+		"Top frame (_top)"                                  : "Top frame (_top)",
+		"URL:"                                              : "URL:",
+		"You must enter the URL where this link points to"  : "You must enter the URL where this link points to"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-euc.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-euc.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/ja-euc.js	(revision 1328)
@@ -0,0 +1,37 @@
+// I18N constants -- Japanese EUC
+// by Manabu Onoue -- tmocsys@tmocsys.com
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "ja-euc",
+
+	tooltips: {
+		bold:           "ÂÀ»ú",
+		italic:         "¼ÐÂÎ",
+		underline:      "²¼Àþ",
+		strikethrough:  "ÂÇ¤Á¾Ã¤·Àþ",
+		subscript:      "²¼ÉÕ¤­Åº¤¨»ú",
+		superscript:    "¾åÉÕ¤­Åº¤¨»ú",
+		justifyleft:    "º¸´ó¤»",
+		justifycenter:  "Ãæ±û´ó¤»",
+		justifyright:   "±¦´ó¤»",
+		justifyfull:    "¶ÑÅù³äÉÕ",
+		orderedlist:    "ÈÖ¹æÉÕ¤­²Õ¾ò½ñ¤­",
+		unorderedlist:  "µ­¹æÉÕ¤­²Õ¾ò½ñ¤­",
+		outdent:        "¥¤¥ó¥Ç¥ó¥È²ò½ü",
+		indent:         "¥¤¥ó¥Ç¥ó¥ÈÀßÄê",
+		forecolor:      "Ê¸»ú¿§",
+		backcolor:      "ÇØ·Ê¿§",
+		horizontalrule: "¿åÊ¿Àþ",
+		createlink:     "¥ê¥ó¥¯ºîÀ®",
+		insertimage:    "²èÁüÁÞÆþ",
+		inserttable:    "¥Æ¡¼¥Ö¥ëÁÞÆþ",
+		htmlmode:       "HTMLÉ½¼¨ÀÚÂØ",
+		popupeditor:    "¥¨¥Ç¥£¥¿³ÈÂç",
+		about:          "¥Ð¡¼¥¸¥ç¥ó¾ðÊó",
+		help:           "¥Ø¥ë¥×",
+		textindicator:  "¸½ºß¤Î¥¹¥¿¥¤¥ë"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/pt_br.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/pt_br.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/pt_br.js	(revision 1328)
@@ -0,0 +1,37 @@
+// I18N constants
+// Brazilian Portuguese Translation by Alex Piaz <webmaster@globalmap.com>
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "pt_br",
+
+	tooltips: {
+		bold:           "Negrito",
+		italic:         "Itálico",
+		underline:      "Sublinhado",
+		strikethrough:  "Tachado",
+		subscript:      "Subescrito",
+		superscript:    "Sobrescrito",
+		justifyleft:    "Alinhar à Esquerda",
+		justifycenter:  "Centralizar",
+		justifyright:   "Alinhar à Direita",
+		justifyfull:    "Justificar",
+		orderedlist:    "Lista Numerada",
+		unorderedlist:  "Lista Marcadores",
+		outdent:        "Diminuir Indentação",
+		indent:         "Aumentar Indentação",
+		forecolor:      "Cor da Fonte",
+		backcolor:      "Cor do Fundo",
+		horizontalrule: "Linha Horizontal",
+		createlink:     "Inserir Link",
+		insertimage:    "Inserir Imagem",
+		inserttable:    "Inserir Tabela",
+		htmlmode:       "Ver Código-Fonte",
+		popupeditor:    "Expandir Editor",
+		about:          "Sobre",
+		help:           "Ajuda",
+		textindicator:  "Estilo Atual"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/lang/b5.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/lang/b5.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/lang/b5.js	(revision 1328)
@@ -0,0 +1,36 @@
+// I18N constants -- Chinese Big-5
+// by Dave Lo -- dlo@interactivetools.com
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "b5",
+
+	tooltips: {
+		bold:           "²ÊÅé",
+		italic:         "±×Åé",
+		underline:      "©³½u",
+		strikethrough:  "§R°£½u",
+		subscript:      "¤U¼Ð",
+		superscript:    "¤W¼Ð",
+		justifyleft:    "¦ì¸m¾a¥ª",
+		justifycenter:  "¦ì¸m©~¤¤",
+		justifyright:   "¦ì¸m¾a¥k",
+		justifyfull:    "¦ì¸m¥ª¥k¥­µ¥",
+		orderedlist:    "¶¶§Ç²M³æ",
+		unorderedlist:  "µL§Ç²M³æ",
+		outdent:        "´î¤p¦æ«eªÅ¥Õ",
+		indent:         "¥[¼e¦æ«eªÅ¥Õ",
+		forecolor:      "¤å¦rÃC¦â",
+		backcolor:      "­I´ºÃC¦â",
+		horizontalrule: "¤ô¥­½u",
+		createlink:     "´¡¤J³sµ²",
+		insertimage:    "´¡¤J¹Ï§Î",
+		inserttable:    "´¡¤Jªí®æ",
+		htmlmode:       "¤Á´«HTML­ì©l½X",
+		popupeditor:    "©ñ¤j",
+		about:          "Ãö©ó HTMLArea",
+		help:           "»¡©ú",
+		textindicator:  "¦rÅé¨Ò¤l"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/CSS/lang/en.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/CSS/lang/en.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/CSS/lang/en.js	(revision 1328)
@@ -0,0 +1,2 @@
+// none yet; this file is a stub.
+CSS.I18N = {};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/CSS/css.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/CSS/css.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/CSS/css.js	(revision 1328)
@@ -0,0 +1,116 @@
+// Simple CSS (className) plugin for the editor
+// Sponsored by http://www.miro.com.au
+// Implementation by Mihai Bazon, http://dynarch.com/mishoo.
+//
+// (c) dynarch.com 2003
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+//
+// $Id$
+
+function CSS(editor, params) {
+	this.editor = editor;
+	var cfg = editor.config;
+	var toolbar = cfg.toolbar;
+	var self = this;
+	var i18n = CSS.I18N;
+	var plugin_config = params[0];
+	var combos = plugin_config.combos;
+
+	var first = true;
+	for (var i = combos.length; --i >= 0;) {
+		var combo = combos[i];
+		var id = "CSS-class" + i;
+		var css_class = {
+			id         : id,
+			options    : combo.options,
+			action     : function(editor) { self.onSelect(editor, this, combo.context, combo.updatecontextclass); },
+			refresh    : function(editor) { self.updateValue(editor, this); },
+			context    : combo.context
+		};
+		cfg.registerDropdown(css_class);
+
+		// prepend to the toolbar
+		toolbar[1].splice(0, 0, first ? "separator" : "space");
+		toolbar[1].splice(0, 0, id);
+		if (combo.label)
+			toolbar[1].splice(0, 0, "T[" + combo.label + "]");
+		first = false;
+	}
+};
+
+CSS._pluginInfo = {
+	name          : "CSS",
+	version       : "1.0",
+	developer     : "Mihai Bazon",
+	developer_url : "http://dynarch.com/mishoo/",
+	c_owner       : "Mihai Bazon",
+	sponsor       : "Miro International",
+	sponsor_url   : "http://www.miro.com.au",
+	license       : "htmlArea"
+};
+
+CSS.prototype.onSelect = function(editor, obj, context, updatecontextclass) {
+	var tbobj = editor._toolbarObjects[obj.id];
+	var index = tbobj.element.selectedIndex;
+	var className = tbobj.element.value;
+
+	// retrieve parent element of the selection
+	var parent = editor.getParentElement();
+	var surround = true;
+
+	var is_span = (parent && parent.tagName.toLowerCase() == "span");
+	var update_parent = (context && updatecontextclass && parent && parent.tagName.toLowerCase() == context);
+
+	if (update_parent) {
+		parent.className = className;
+		editor.updateToolbar();
+		return;
+	}
+
+	if (is_span && index == 0 && !/\S/.test(parent.style.cssText)) {
+		while (parent.firstChild) {
+			parent.parentNode.insertBefore(parent.firstChild, parent);
+		}
+		parent.parentNode.removeChild(parent);
+		editor.updateToolbar();
+		return;
+	}
+
+	if (is_span) {
+		// maybe we could simply change the class of the parent node?
+		if (parent.childNodes.length == 1) {
+			parent.className = className;
+			surround = false;
+			// in this case we should handle the toolbar updation
+			// ourselves.
+			editor.updateToolbar();
+		}
+	}
+
+	// Other possibilities could be checked but require a lot of code.  We
+	// can't afford to do that now.
+	if (surround) {
+		// shit happens ;-) most of the time.  this method works, but
+		// it's dangerous when selection spans multiple block-level
+		// elements.
+		editor.surroundHTML("<span class='" + className + "'>", "</span>");
+	}
+};
+
+CSS.prototype.updateValue = function(editor, obj) {
+	var select = editor._toolbarObjects[obj.id].element;
+	var parent = editor.getParentElement();
+	if (typeof parent.className != "undefined" && /\S/.test(parent.className)) {
+		var options = select.options;
+		var value = parent.className;
+		for (var i = options.length; --i >= 0;) {
+			var option = options[i];
+			if (value == option.value) {
+				select.selectedIndex = i;
+				return;
+			}
+		}
+	}
+	select.selectedIndex = 0;
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/context-menu.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/context-menu.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/context-menu.js	(revision 1328)
@@ -0,0 +1,416 @@
+// Context Menu Plugin for HTMLArea-3.0
+// Sponsored by www.americanbible.org
+// Implementation by Mihai Bazon, http://dynarch.com/mishoo/
+//
+// (c) dynarch.com 2003.
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+//
+// $Id$
+
+HTMLArea.loadStyle("menu.css", "ContextMenu");
+
+function ContextMenu(editor) {
+	this.editor = editor;
+};
+
+ContextMenu._pluginInfo = {
+	name          : "ContextMenu",
+	version       : "1.0",
+	developer     : "Mihai Bazon",
+	developer_url : "http://dynarch.com/mishoo/",
+	c_owner       : "dynarch.com",
+	sponsor       : "American Bible Society",
+	sponsor_url   : "http://www.americanbible.org",
+	license       : "htmlArea"
+};
+
+ContextMenu.prototype.onGenerate = function() {
+	var self = this;
+	var doc = this.editordoc = this.editor._iframe.contentWindow.document;
+	HTMLArea._addEvents(doc, ["contextmenu"],
+			    function (event) {
+				    return self.popupMenu(HTMLArea.is_ie ? self.editor._iframe.contentWindow.event : event);
+			    });
+	this.currentMenu = null;
+};
+
+ContextMenu.prototype.getContextMenu = function(target) {
+	var self = this;
+	var editor = this.editor;
+	var config = editor.config;
+	var menu = [];
+	var tbo = this.editor.plugins.TableOperations;
+	if (tbo) tbo = tbo.instance;
+	var i18n = ContextMenu.I18N;
+
+	var selection = editor.hasSelectedText();
+	if (selection)
+		menu.push([ i18n["Cut"], function() { editor.execCommand("cut"); }, null, config.btnList["cut"][1] ],
+			  [ i18n["Copy"], function() { editor.execCommand("copy"); }, null, config.btnList["copy"][1] ]);
+	menu.push([ i18n["Paste"], function() { editor.execCommand("paste"); }, null, config.btnList["paste"][1] ]);
+
+	var currentTarget = target;
+	var elmenus = [];
+
+	var link = null;
+	var table = null;
+	var tr = null;
+	var td = null;
+	var img = null;
+
+	function tableOperation(opcode) {
+		tbo.buttonPress(editor, opcode);
+	};
+
+	for (; target; target = target.parentNode) {
+		var tag = target.tagName;
+		if (!tag)
+			continue;
+		tag = tag.toLowerCase();
+		switch (tag) {
+		    case "img":
+			img = target;
+			elmenus.push(null,
+				     [ i18n["Image Properties"],
+				       function() {
+					       editor._insertImage(img);
+				       },
+				       i18n["Show the image properties dialog"],
+				       config.btnList["insertimage"][1] ]
+				);
+			break;
+		    case "a":
+			link = target;
+			elmenus.push(null,
+				     [ i18n["Modify Link"],
+				       function() { editor.execCommand("createlink", true); },
+				       i18n["Current URL is"] + ': ' + link.href,
+				       config.btnList["createlink"][1] ],
+
+				     [ i18n["Check Link"],
+				       function() { window.open(link.href); },
+				       i18n["Opens this link in a new window"] ],
+
+				     [ i18n["Remove Link"],
+				       function() {
+					       if (confirm(i18n["Please confirm that you want to unlink this element."] + "\n" +
+							   i18n["Link points to:"] + " " + link.href)) {
+						       while (link.firstChild)
+							       link.parentNode.insertBefore(link.firstChild, link);
+						       link.parentNode.removeChild(link);
+					       }
+				       },
+				       i18n["Unlink the current element"] ]
+				);
+			break;
+		    case "td":
+			td = target;
+			if (!tbo) break;
+			elmenus.push(null,
+				     [ i18n["Cell Properties"],
+				       function() { tableOperation("TO-cell-prop"); },
+				       i18n["Show the Table Cell Properties dialog"],
+				       config.btnList["TO-cell-prop"][1] ]
+				);
+			break;
+		    case "tr":
+			tr = target;
+			if (!tbo) break;
+			elmenus.push(null,
+				     [ i18n["Row Properties"],
+				       function() { tableOperation("TO-row-prop"); },
+				       i18n["Show the Table Row Properties dialog"],
+				       config.btnList["TO-row-prop"][1] ],
+
+				     [ i18n["Insert Row Before"],
+				       function() { tableOperation("TO-row-insert-above"); },
+				       i18n["Insert a new row before the current one"],
+				       config.btnList["TO-row-insert-above"][1] ],
+
+				     [ i18n["Insert Row After"],
+				       function() { tableOperation("TO-row-insert-under"); },
+				       i18n["Insert a new row after the current one"],
+				       config.btnList["TO-row-insert-under"][1] ],
+
+				     [ i18n["Delete Row"],
+				       function() { tableOperation("TO-row-delete"); },
+				       i18n["Delete the current row"],
+				       config.btnList["TO-row-delete"][1] ]
+				);
+			break;
+		    case "table":
+			table = target;
+			if (!tbo) break;
+			elmenus.push(null,
+				     [ i18n["Table Properties"],
+				       function() { tableOperation("TO-table-prop"); },
+				       i18n["Show the Table Properties dialog"],
+				       config.btnList["TO-table-prop"][1] ],
+
+				     [ i18n["Insert Column Before"],
+				       function() { tableOperation("TO-col-insert-before"); },
+				       i18n["Insert a new column before the current one"],
+				       config.btnList["TO-col-insert-before"][1] ],
+
+				     [ i18n["Insert Column After"],
+				       function() { tableOperation("TO-col-insert-after"); },
+				       i18n["Insert a new column after the current one"],
+				       config.btnList["TO-col-insert-after"][1] ],
+
+				     [ i18n["Delete Column"],
+				       function() { tableOperation("TO-col-delete"); },
+				       i18n["Delete the current column"],
+				       config.btnList["TO-col-delete"][1] ]
+				);
+			break;
+		    case "body":
+			elmenus.push(null,
+				     [ i18n["Justify Left"],
+				       function() { editor.execCommand("justifyleft"); }, null,
+				       config.btnList["justifyleft"][1] ],
+				     [ i18n["Justify Center"],
+				       function() { editor.execCommand("justifycenter"); }, null,
+				       config.btnList["justifycenter"][1] ],
+				     [ i18n["Justify Right"],
+				       function() { editor.execCommand("justifyright"); }, null,
+				       config.btnList["justifyright"][1] ],
+				     [ i18n["Justify Full"],
+				       function() { editor.execCommand("justifyfull"); }, null,
+				       config.btnList["justifyfull"][1] ]
+				);
+			break;
+		}
+	}
+
+	if (selection && !link)
+		menu.push(null, [ i18n["Make link"],
+				  function() { editor.execCommand("createlink", true); },
+				  i18n["Create a link"],
+				  config.btnList["createlink"][1] ]);
+
+	for (var i in elmenus)
+		menu.push(elmenus[i]);
+
+	menu.push(null,
+		  [ i18n["Remove the"] + " &lt;" + currentTarget.tagName + "&gt; " + i18n["Element"],
+		    function() {
+			    if (confirm(i18n["Please confirm that you want to remove this element:"] + " " + currentTarget.tagName)) {
+				    var el = currentTarget;
+				    var p = el.parentNode;
+				    p.removeChild(el);
+				    if (HTMLArea.is_gecko) {
+					    if (p.tagName.toLowerCase() == "td" && !p.hasChildNodes())
+						    p.appendChild(editor._doc.createElement("br"));
+					    editor.forceRedraw();
+					    editor.focusEditor();
+					    editor.updateToolbar();
+					    if (table) {
+						    var save_collapse = table.style.borderCollapse;
+						    table.style.borderCollapse = "collapse";
+						    table.style.borderCollapse = "separate";
+						    table.style.borderCollapse = save_collapse;
+					    }
+				    }
+			    }
+		    },
+		    i18n["Remove this node from the document"] ]);
+	return menu;
+};
+
+ContextMenu.prototype.popupMenu = function(ev) {
+	var self = this;
+	var i18n = ContextMenu.I18N;
+	if (this.currentMenu)
+		this.currentMenu.parentNode.removeChild(this.currentMenu);
+	function getPos(el) {
+		var r = { x: el.offsetLeft, y: el.offsetTop };
+		if (el.offsetParent) {
+			var tmp = getPos(el.offsetParent);
+			r.x += tmp.x;
+			r.y += tmp.y;
+		}
+		return r;
+	};
+	function documentClick(ev) {
+		ev || (ev = window.event);
+		if (!self.currentMenu) {
+			alert(i18n["How did you get here? (Please report!)"]);
+			return false;
+		}
+		var el = HTMLArea.is_ie ? ev.srcElement : ev.target;
+		for (; el != null && el != self.currentMenu; el = el.parentNode);
+		if (el == null)
+			self.closeMenu();
+		//HTMLArea._stopEvent(ev);
+		//return false;
+	};
+	var keys = [];
+	function keyPress(ev) {
+		ev || (ev = window.event);
+		HTMLArea._stopEvent(ev);
+		if (ev.keyCode == 27) {
+			self.closeMenu();
+			return false;
+		}
+		var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase();
+		for (var i = keys.length; --i >= 0;) {
+			var k = keys[i];
+			if (k[0].toLowerCase() == key)
+				k[1].__msh.activate();
+		}
+	};
+	self.closeMenu = function() {
+		self.currentMenu.parentNode.removeChild(self.currentMenu);
+		self.currentMenu = null;
+		HTMLArea._removeEvent(document, "mousedown", documentClick);
+		HTMLArea._removeEvent(self.editordoc, "mousedown", documentClick);
+		if (keys.length > 0)
+			HTMLArea._removeEvent(self.editordoc, "keypress", keyPress);
+		if (HTMLArea.is_ie)
+			self.iePopup.hide();
+	};
+	var target = HTMLArea.is_ie ? ev.srcElement : ev.target;
+	var ifpos = getPos(self.editor._iframe);
+	var x = ev.clientX + ifpos.x;
+	var y = ev.clientY + ifpos.y;
+
+	var div;
+	var doc;
+	if (!HTMLArea.is_ie) {
+		doc = document;
+	} else {
+		// IE stinks
+		var popup = this.iePopup = window.createPopup();
+		doc = popup.document;
+		doc.open();
+		doc.write("<html><head><style type='text/css'>@import url(" + _editor_url + "plugins/ContextMenu/menu.css); html, body { padding: 0px; margin: 0px; overflow: hidden; border: 0px; }</style></head><body unselectable='yes'></body></html>");
+		doc.close();
+	}
+	div = doc.createElement("div");
+	if (HTMLArea.is_ie)
+		div.unselectable = "on";
+	div.oncontextmenu = function() { return false; };
+	div.className = "htmlarea-context-menu";
+	if (!HTMLArea.is_ie)
+		div.style.left = div.style.top = "0px";
+	doc.body.appendChild(div);
+
+	var table = doc.createElement("table");
+	div.appendChild(table);
+	table.cellSpacing = 0;
+	table.cellPadding = 0;
+	var parent = doc.createElement("tbody");
+	table.appendChild(parent);
+
+	var options = this.getContextMenu(target);
+	for (var i = 0; i < options.length; ++i) {
+		var option = options[i];
+		var item = doc.createElement("tr");
+		parent.appendChild(item);
+		if (HTMLArea.is_ie)
+			item.unselectable = "on";
+		else item.onmousedown = function(ev) {
+			HTMLArea._stopEvent(ev);
+			return false;
+		};
+		if (!option) {
+			item.className = "separator";
+			var td = doc.createElement("td");
+			td.className = "icon";
+			var IE_IS_A_FUCKING_SHIT = '>';
+			if (HTMLArea.is_ie) {
+				td.unselectable = "on";
+				IE_IS_A_FUCKING_SHIT = " unselectable='on' style='height=1px'>&nbsp;";
+			}
+			td.innerHTML = "<div" + IE_IS_A_FUCKING_SHIT + "</div>";
+			var td1 = td.cloneNode(true);
+			td1.className = "label";
+			item.appendChild(td);
+			item.appendChild(td1);
+		} else {
+			var label = option[0];
+			item.className = "item";
+			item.__msh = {
+				item: item,
+				label: label,
+				action: option[1],
+				tooltip: option[2] || null,
+				icon: option[3] || null,
+				activate: function() {
+					self.closeMenu();
+					self.editor.focusEditor();
+					this.action();
+				}
+			};
+			label = label.replace(/_([a-zA-Z0-9])/, "<u>$1</u>");
+			if (label != option[0])
+				keys.push([ RegExp.$1, item ]);
+			label = label.replace(/__/, "_");
+			var td1 = doc.createElement("td");
+			if (HTMLArea.is_ie)
+				td1.unselectable = "on";
+			item.appendChild(td1);
+			td1.className = "icon";
+			if (item.__msh.icon)
+				td1.innerHTML = "<img align='middle' src='" + item.__msh.icon + "' />";
+			var td2 = doc.createElement("td");
+			if (HTMLArea.is_ie)
+				td2.unselectable = "on";
+			item.appendChild(td2);
+			td2.className = "label";
+			td2.innerHTML = label;
+			item.onmouseover = function() {
+				this.className += " hover";
+				self.editor._statusBarTree.innerHTML = this.__msh.tooltip || '&nbsp;';
+			};
+			item.onmouseout = function() { this.className = "item"; };
+			item.oncontextmenu = function(ev) {
+				this.__msh.activate();
+				if (!HTMLArea.is_ie)
+					HTMLArea._stopEvent(ev);
+				return false;
+			};
+			item.onmouseup = function(ev) {
+				var timeStamp = (new Date()).getTime();
+				if (timeStamp - self.timeStamp > 500)
+					this.__msh.activate();
+				if (!HTMLArea.is_ie)
+					HTMLArea._stopEvent(ev);
+				return false;
+			};
+			//if (typeof option[2] == "string")
+			//item.title = option[2];
+		}
+	}
+
+	if (!HTMLArea.is_ie) {
+		var dx = x + div.offsetWidth - window.innerWidth + 4;
+		var dy = y + div.offsetHeight - window.innerHeight + 4;
+		if (dx > 0) x -= dx;
+		if (dy > 0) y -= dy;
+		div.style.left = x + "px";
+		div.style.top = y + "px";
+	} else {
+		// determine the size (did I mention that IE stinks?)
+		var foobar = document.createElement("div");
+		foobar.className = "htmlarea-context-menu";
+		foobar.innerHTML = div.innerHTML;
+		document.body.appendChild(foobar);
+		var w = foobar.offsetWidth;
+		var h = foobar.offsetHeight;
+		document.body.removeChild(foobar);
+		this.iePopup.show(ev.screenX, ev.screenY, w, h);
+	}
+
+	this.currentMenu = div;
+	this.timeStamp = (new Date()).getTime();
+
+	HTMLArea._addEvent(document, "mousedown", documentClick);
+	HTMLArea._addEvent(this.editordoc, "mousedown", documentClick);
+	if (keys.length > 0)
+		HTMLArea._addEvent(this.editordoc, "keypress", keyPress);
+
+	HTMLArea._stopEvent(ev);
+	return false;
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/en.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/en.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/en.js	(revision 1328)
@@ -0,0 +1,66 @@
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+ContextMenu.I18N = {
+	// Items that appear in menu.  Please note that an underscore (_)
+	// character in the translation (right column) will cause the following
+	// letter to become underlined and be shortcut for that menu option.
+
+	"Cut"                                                   : "Cut",
+	"Copy"                                                  : "Copy",
+	"Paste"                                                 : "Paste",
+	"Image Properties"                                      : "_Image Properties...",
+	"Modify Link"                                           : "_Modify Link...",
+	"Check Link"                                            : "Chec_k Link...",
+	"Remove Link"                                           : "_Remove Link...",
+	"Cell Properties"                                       : "C_ell Properties...",
+	"Row Properties"                                        : "Ro_w Properties...",
+	"Insert Row Before"                                     : "I_nsert Row Before",
+	"Insert Row After"                                      : "In_sert Row After",
+	"Delete Row"                                            : "_Delete Row",
+	"Table Properties"                                      : "_Table Properties...",
+	"Insert Column Before"                                  : "Insert _Column Before",
+	"Insert Column After"                                   : "Insert C_olumn After",
+	"Delete Column"                                         : "De_lete Column",
+	"Justify Left"                                          : "Justify Left",
+	"Justify Center"                                        : "Justify Center",
+	"Justify Right"                                         : "Justify Right",
+	"Justify Full"                                          : "Justify Full",
+	"Make link"                                             : "Make lin_k...",
+	"Remove the"                                            : "Remove the",
+	"Element"                                               : "Element...",
+
+	// Other labels (tooltips and alert/confirm box messages)
+
+	"Please confirm that you want to remove this element:"  : "Please confirm that you want to remove this element:",
+	"Remove this node from the document"                    : "Remove this node from the document",
+	"How did you get here? (Please report!)"                : "How did you get here? (Please report!)",
+	"Show the image properties dialog"                      : "Show the image properties dialog",
+	"Modify URL"                                            : "Modify URL",
+	"Current URL is"                                        : "Current URL is",
+	"Opens this link in a new window"                       : "Opens this link in a new window",
+	"Please confirm that you want to unlink this element."  : "Please confirm that you want to unlink this element.",
+	"Link points to:"                                       : "Link points to:",
+	"Unlink the current element"                            : "Unlink the current element",
+	"Show the Table Cell Properties dialog"                 : "Show the Table Cell Properties dialog",
+	"Show the Table Row Properties dialog"                  : "Show the Table Row Properties dialog",
+	"Insert a new row before the current one"               : "Insert a new row before the current one",
+	"Insert a new row after the current one"                : "Insert a new row after the current one",
+	"Delete the current row"                                : "Delete the current row",
+	"Show the Table Properties dialog"                      : "Show the Table Properties dialog",
+	"Insert a new column before the current one"            : "Insert a new column before the current one",
+	"Insert a new column after the current one"             : "Insert a new column after the current one",
+	"Delete the current column"                             : "Delete the current column",
+	"Create a link"                                         : "Create a link"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/de.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/de.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/de.js	(revision 1328)
@@ -0,0 +1,59 @@
+﻿// I18N constants
+
+// LANG: "de", ENCODING: UTF-8 | ISO-8859-1
+
+// translated: <]{MJ}[>  i@student.ethz.ch
+
+
+ContextMenu.I18N = {
+	// Items that appear in menu.  Please note that an underscore (_)
+	// character in the translation (right column) will cause the following
+	// letter to become underlined and be shortcut for that menu option.
+
+	"Cut"                                                   : "Ausschneiden",
+	"Copy"                                                  : "Kopieren",
+	"Paste"                                                 : "Einfügen",
+	"Image Properties"                                      : "_Bild Einstellungen...",
+	"Modify Link"                                           : "_Link ändern...",
+	"Check Link"                                            : "Link testen...",
+	"Remove Link"                                           : "Link entfernen...",
+	"Cell Properties"                                       : "Z_ellen Einstellungen...",
+	"Row Properties"                                        : "Ze_ilen Einstellungen...",
+	"Insert Row Before"                                     : "Zeile einfügen v_or Position",
+	"Insert Row After"                                      : "Zeile einfügen n_ach Position",
+	"Delete Row"                                            : "Zeile löschen",
+	"Table Properties"                                      : "_Tabellen Einstellungen...",
+	"Insert Column Before"                                  : "Spalte einfügen vo_r Position",
+	"Insert Column After"                                   : "Spalte einfügen na_ch Position",
+	"Delete Column"                                         : "Spalte löschen",
+	"Justify Left"                                          : "Links ausrichten",
+	"Justify Center"                                        : "Zentriert",
+	"Justify Right"                                         : "Rechts ausrichten",
+	"Justify Full"                                          : "Blocksatz",
+	"Make link"                                             : "Lin_k erstellen...",
+	"Remove the"                                            : "",
+	"Element"                                               : "Element entfernen...",
+
+	// Other labels (tooltips and alert/confirm box messages)
+
+	"Please confirm that you want to remove this element:"  : "Wollen sie dieses Element wirklich entfernen ?",
+	"Remove this node from the document"                    : "Dieses Element aus dem Dokument entfernen",
+	"How did you get here? (Please report!)"                : "How did you get here? (Please report!)",
+	"Show the image properties dialog"                      : "Fenster für die Bild-Einstellungen anzeigen",
+	"Modify URL"                                            : "URL ändern",
+	"Current URL is"                                        : "Aktuelle URL ist",
+	"Opens this link in a new window"                       : "Diesen Link in neuem Fenster öffnen",
+	"Please confirm that you want to unlink this element."  : "Wollen sie diesen Link wirklich entfernen ?",
+	"Link points to:"                                       : "Link zeigt auf:",
+	"Unlink the current element"                            : "Link auf Element entfernen",
+	"Show the Table Cell Properties dialog"                 : "Zellen-Einstellungen anzeigen",
+	"Show the Table Row Properties dialog"                  : "Zeilen-Einstellungen anzeigen",
+	"Insert a new row before the current one"               : "Zeile einfügen vor der aktuellen Position",
+	"Insert a new row after the current one"                : "Zeile einfügen nach der aktuellen Position",
+	"Delete the current row"                                : "Zeile löschen",
+	"Show the Table Properties dialog"                      : "Show the Table Properties dialog",
+	"Insert a new column before the current one"            : "Spalte einfügen vor der aktuellen Position",
+	"Insert a new column after the current one"             : "Spalte einfügen nach der aktuellen Position",
+	"Delete the current column"                             : "Spalte löschen",
+	"Create a link"                                         : "Link erstellen"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/nl.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/nl.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/nl.js	(revision 1328)
@@ -0,0 +1,66 @@
+// I18N constants
+
+// LANG: "nl", ENCODING: UTF-8 | ISO-8859-1
+// Author: Michel Weegeerink (info@mmc-shop.nl), http://mmc-shop.nl
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+ContextMenu.I18N = {
+	// Items that appear in menu.  Please note that an underscore (_)
+	// character in the translation (right column) will cause the following
+	// letter to become underlined and be shortcut for that menu option.
+
+	"Cut"                                                   : "Knippen",
+	"Copy"                                                  : "Kopiëren",
+	"Paste"                                                 : "Plakken",
+	"Image Properties"                                      : "Eigenschappen afbeelding...",
+	"Modify Link"                                           : "Hyperlin_k aanpassen...",
+	"Check Link"                                            : "Controleer hyperlin_k...",
+	"Remove Link"                                           : "Ve_rwijder hyperlink...",
+	"Cell Properties"                                       : "C_eleigenschappen...",
+	"Row Properties"                                        : "Rijeigenscha_ppen...",
+	"Insert Row Before"                                     : "Rij invoegen boven",
+	"Insert Row After"                                      : "Rij invoegen onder",
+	"Delete Row"                                            : "Rij _verwijderen",
+	"Table Properties"                                      : "_Tabeleigenschappen...",
+	"Insert Column Before"                                  : "Kolom invoegen voor",
+	"Insert Column After"                                   : "Kolom invoegen na",
+	"Delete Column"                                         : "Kolom verwijderen",
+	"Justify Left"                                          : "Links uitlijnen",
+	"Justify Center"                                        : "Centreren",
+	"Justify Right"                                         : "Rechts uitlijnen",
+	"Justify Full"                                          : "Uitvullen",
+	"Make link"                                             : "Maak hyperlin_k...",
+	"Remove the"                                            : "Verwijder het",
+	"Element"                                               : "element...",
+
+	// Other labels (tooltips and alert/confirm box messages)
+
+	"Please confirm that you want to remove this element:"  : "Is het werkelijk de bedoeling dit element te verwijderen:",
+	"Remove this node from the document"                    : "Verwijder dit punt van het document",
+	"How did you get here? (Please report!)"                : "Hoe kwam je hier? (A.U.B. doorgeven!)",
+	"Show the image properties dialog"                      : "Laat het afbeeldingseigenschappen dialog zien",
+	"Modify URL"                                            : "Aanpassen URL",
+	"Current URL is"                                        : "Huidig URL is",
+	"Opens this link in a new window"                       : "Opend deze hyperlink in een nieuw venster",
+	"Please confirm that you want to unlink this element."  : "Is het werkelijk de bedoeling dit element te unlinken.",
+	"Link points to:"                                       : "Hyperlink verwijst naar:",
+	"Unlink the current element"                            : "Unlink het huidige element",
+	"Show the Table Cell Properties dialog"                 : "Laat de tabel celeigenschappen dialog zien",
+	"Show the Table Row Properties dialog"                  : "Laat de tabel rijeigenschappen dialog zien",
+	"Insert a new row before the current one"               : "Voeg een nieuwe rij in boven de huidige",
+	"Insert a new row after the current one"                : "Voeg een nieuwe rij in onder de huidige",
+	"Delete the current row"                                : "Verwijder de huidige rij",
+	"Show the Table Properties dialog"                      : "Laat de tabel eigenschappen dialog zien",
+	"Insert a new column before the current one"            : "Voeg een nieuwe kolom in voor de huidige",
+	"Insert a new column after the current one"             : "Voeg een nieuwe kolom in na de huidige",
+	"Delete the current column"                             : "Verwijder de huidige kolom",
+	"Create a link"                                         : "Maak een hyperlink"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/el.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/el.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/ContextMenu/lang/el.js	(revision 1328)
@@ -0,0 +1,57 @@
+// I18N constants
+
+// LANG: "el", ENCODING: UTF-8 | ISO-8859-7
+// Author: Dimitris Glezos, dimitris@glezos.com
+
+ContextMenu.I18N = {
+	// Items that appear in menu.  Please note that an underscore (_)
+	// character in the translation (right column) will cause the following
+	// letter to become underlined and be shortcut for that menu option.
+
+	"Cut"                                                   : "Αποκοπή",
+	"Copy"                                                  : "Αντιγραφή",
+	"Paste"                                                 : "Επικόλληση",
+	"Image Properties"                                      : "Ιδιότητες Εικόνας...",
+	"Modify Link"                                           : "Τροποποίηση συνδέσμου...",
+	"Check Link"                                            : "Έλεγχος συνδέσμων...",
+	"Remove Link"                                           : "Διαγραφή συνδέσμου...",
+	"Cell Properties"                                       : "Ιδιότητες κελιού...",
+	"Row Properties"                                        : "Ιδιότητες γραμμής...",
+	"Insert Row Before"                                     : "Εισαγωγή γραμμής πριν",
+	"Insert Row After"                                      : "Εισαγωγή γραμμής μετά",
+	"Delete Row"                                            : "Διαγραφή γραμμής",
+	"Table Properties"                                      : "Ιδιότητες πίνακα...",
+	"Insert Column Before"                                  : "Εισαγωγή στήλης πριν",
+	"Insert Column After"                                   : "Εισαγωγή στήλης μετά",
+	"Delete Column"                                         : "Διαγραφή στήλης",
+	"Justify Left"                                          : "Στοίχηση Αριστερά",
+	"Justify Center"                                        : "Στοίχηση Κέντρο",
+	"Justify Right"                                         : "Στοίχηση Δεξιά",
+	"Justify Full"                                          : "Πλήρης Στοίχηση",
+	"Make link"                                             : "Δημιουργία συνδέσμου...",
+	"Remove the"                                            : "Αφαίρεση",
+	"Element"                                               : "στοιχείου...",
+
+	// Other labels (tooltips and alert/confirm box messages)
+
+	"Please confirm that you want to remove this element:"  : "Είστε βέβαιος πως θέλετε να αφαιρέσετε το στοιχείο ",
+	"Remove this node from the document"                    : "Αφαίρεση αυτού του κόμβου από το έγγραφο",
+	"How did you get here? (Please report!)"                : "Πώς ήρθατε μέχρι εδώ; (Παρακαλούμε αναφέρετε το!)",
+	"Show the image properties dialog"                      : "Εμφάνιση διαλόγου με τις Ιδιότητες εικόνας",
+	"Modify URL"                                            : "Τροποποίηση URL",
+	"Current URL is"                                        : "Το τρέχων URL είναι",
+	"Opens this link in a new window"                       : "Ανοίγει αυτό τον σύνδεσμο σε ένα νέο παράθυρο",
+	"Please confirm that you want to unlink this element."  : "Είστε βέβαιος πως θέλετε να αφαιρέσετε τον σύνδεσμο από αυτό το στοιχείο:",
+	"Link points to:"                                       : "Ο σύνδεμος οδηγεί εδώ:",
+	"Unlink the current element"                            : "Αφαίρεση συνδέσμου από το παρών στοιχείο",
+	"Show the Table Cell Properties dialog"                 : "Εμφάνιση διαλόγου με τις Ιδιότητες κελιού Πίνακα",
+	"Show the Table Row Properties dialog"                  : "Εμφάνιση διαλόγου με τις Ιδιότητες γραμμής Πίνακα",
+	"Insert a new row before the current one"               : "Εισαγωγή μιας νέας γραμμής πριν την επιλεγμένη",
+	"Insert a new row after the current one"                : "Εισαγωγή μιας νέας γραμμής μετά την επιλεγμένη",
+	"Delete the current row"                                : "Διαγραφή επιλεγμένης γραμμής",
+	"Show the Table Properties dialog"                      : "Εμφάνιση διαλόγου με τις Ιδιότητες Πίνακα",
+	"Insert a new column before the current one"            : "Εισαγωγή νέας στήλης πριν την επιλεγμένη",
+	"Insert a new column after the current one"             : "Εισαγωγή νέας στήλης μετά την επιλεγμένη",
+	"Delete the current column"                             : "Διαγραφή επιλεγμένης στήλης",
+	"Create a link"                                         : "Δημιουργία συνδέσμου"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/fi.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/fi.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/fi.js	(revision 1328)
@@ -0,0 +1,66 @@
+TableOperations.I18N = {
+	"Align":					  "Kohdistus",
+	"All four sides":				  "Kaikki neljä sivua",
+	"Background":					  "Tausta",
+	"Baseline":                                       "Takaraja",
+	"Border":					  "Reuna",
+	"Borders":					  "Reunat",
+	"Bottom":                                         "Alle",
+	"CSS Style":					  "Tyyli [CSS]",
+	"Caption":					  "Otsikko",
+	"Cell Properties":                                "Solun asetukset",
+	"Center":					  "Keskelle",
+	"Char":                                           "Merkki",
+	"Collapsed borders":                              "Luhistetut reunat",
+	"Color":					  "Väri",
+	"Description":					  "Kuvaus",
+	"FG Color":					  "FG Väri",
+	"Frames":					  "Kehykset",
+	"Image URL":					  "Kuvan osoite",
+	"Layout":					  "Sommittelu",
+	"Left":						  "Vasen",
+	"Margin":                                         "Marginaali",
+	"Middle":                                         "Keskelle",
+	"No rules":					  "Ei viivoja",
+	"No sides":					  "Ei sivuja",
+	"Padding":					  "Palstantäyte",
+	"Right":					  "Oikea",
+	"Row Properties":                                 "Rivin asetukset",
+	"Rules will appear between all rows and columns": "Viivat jokaisen rivin ja sarakkeen välillä",
+	"Rules will appear between columns only":	  "Viivat ainoastaan sarakkeiden välillä",
+	"Rules will appear between rows only":		  "Viivat ainoastaan rivien välillä",
+	"Rules":					  "Viivat",
+	"Spacing":					  "Palstatila",
+	"Summary":					  "Yhteenveto",
+	"TO-cell-delete":				  "Poista solu",
+	"TO-cell-insert-after":				  "Lisää solu perään",
+	"TO-cell-insert-before":			  "Lisää solu ennen",
+	"TO-cell-merge":				  "Yhdistä solut",
+	"TO-cell-prop":					  "Solun asetukset",
+	"TO-cell-split":				  "Jaa solu",
+	"TO-col-delete":				  "Poista sarake",
+	"TO-col-insert-after":				  "Lisää sarake perään",
+	"TO-col-insert-before":				  "Lisää sarake ennen",
+	"TO-col-split":					  "Jaa sarake",
+	"TO-row-delete":				  "Poista rivi",
+	"TO-row-insert-above":				  "Lisää rivi yläpuolelle",
+	"TO-row-insert-under":				  "Lisää rivi alapuolelle",
+	"TO-row-prop":					  "Rivin asetukset",
+	"TO-row-split":					  "Jaa rivi",
+	"TO-table-prop":				  "Taulukon asetukset",
+	"Top":                                            "Ylös",	
+	"Table Properties":				  "Taulukon asetukset",
+	"The bottom side only":				  "Ainoastaan alapuolelle",
+	"The left-hand side only":			  "Ainoastaan vasenreuna",
+	"The right and left sides only":		  "Oikea- ja vasenreuna",
+	"The right-hand side only":			  "Ainoastaan oikeareuna",
+	"The top and bottom sides only":		  "Ylä- ja alapuoli.",
+	"The top side only":				  "Ainoastaan yläpuoli",
+	"Vertical align":                                 "Vertikaali kohdistus",
+	"Width":					  "Leveys",
+	"not-del-last-cell":				  "Ei voida poistaa viimeistä solua rivistä.",
+	"not-del-last-col":				  "Ei voida poistaa viimeistä saraketta taulusta.",
+	"not-del-last-row":				  "Ei voida poistaa viimeistä riviä taulusta.",
+	"percent":					  "prosenttia",
+	"pixels":					  "pikseliä"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/el.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/el.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/el.js	(revision 1328)
@@ -0,0 +1,81 @@
+// I18N constants
+
+// LANG: "el", ENCODING: UTF-8 | ISO-8859-7
+// Author: Dimitris Glezos, dimitris@glezos.com
+
+TableOperations.I18N = {
+	"Align":					  "Στοίχηση",
+	"All four sides":				  "Και οι 4 πλευρές",
+	"Background":					  "Φόντο",
+	"Baseline":                                       "Baseline",
+	"Border":					  "Περίγραμμα",
+	"Borders":					  "Περιγράμματα",
+	"Bottom":                                         "Κάτω μέρος",
+	"CSS Style":					  "Στυλ [CSS]",
+	"Caption":					  "Λεζάντα",
+	"Cell Properties":                                "Ιδιότητες Κελιού",
+	"Center":					  "Κέντρο",
+	"Char":                                           "Χαρακτήρας",
+	"Collapsed borders":                              "Συμπτυγμένα περιγράμματα",
+	"Color":					  "Χρώμα",
+	"Description":					  "Περιγραφή",
+	"FG Color":					  "Χρώμα αντικειμένων",
+	"Float":                                          "Float",
+	"Frames":					  "Frames",
+	"Height":                                         "Ύψος",
+	"How many columns would you like to merge?":      "Πόσες στήλες θέλετε να ενώσετε;",
+	"How many rows would you like to merge?":         "Πόσες γραμμές θέλετε να ενώσετε;",
+	"Image URL":					  "URL εικόνας",
+	"Justify":                                        "Πλήρης στοίχηση",
+	"Layout":					  "Διάταξη",
+	"Left":						  "Αριστερά",
+	"Margin":                                         "Περιθώριο",
+	"Middle":                                         "Κέντρο",
+	"No rules":					  "Χωρίς Γραμμές",
+	"No sides":					  "No sides",
+	"None":                                           "Τίποτα",
+	"Padding":					  "Εσοχή",
+	"Please click into some cell":                    "Κάντε κλικ μέσα σε κάποιο κελί",
+	"Right":					  "Δεξιά",
+	"Row Properties":                                 "Ιδιότητες Γραμμής",
+	"Rules will appear between all rows and columns": "Γραμμές θα εμφανίζονται μεταξύ όλων των γραμμών και στηλών",
+	"Rules will appear between columns only":	  "Γραμμές θα εμφανίζονται μόνο μεταξύ στηλών",
+	"Rules will appear between rows only":		  "Γραμμές θα εμφανίζονται μόνο μεταξύ γραμμών",
+	"Rules":					  "Γραμμές",
+	"Spacing and padding":                            "Αποστάσεις και εσοχές",
+	"Spacing":					  "Αποστάσεις",
+	"Summary":					  "Σύνοψη",
+	"TO-cell-delete":				  "Διαγραφή κελιού",
+	"TO-cell-insert-after":				  "Εισαγωγή κελιού μετά",
+	"TO-cell-insert-before":			  "Εισαγωγή κελιού πριν",
+	"TO-cell-merge":				  "Συγχώνευση κελιών",
+	"TO-cell-prop":					  "Ιδιότητες κελιού",
+	"TO-cell-split":				  "Διαίρεση κελιού",
+	"TO-col-delete":				  "Διαγραφή στήλης",
+	"TO-col-insert-after":				  "Εισαγωγή στήλης μετά",
+	"TO-col-insert-before":				  "Εισαγωγή στήλης πριν",
+	"TO-col-split":					  "Διαίρεση στήλης",
+	"TO-row-delete":				  "Διαγραφή γραμμής",
+	"TO-row-insert-above":				  "Εισαγωγή γραμμής μετά",
+	"TO-row-insert-under":				  "Εισαγωγή γραμμής πριν",
+	"TO-row-prop":					  "Ιδιότητες γραμμής",
+	"TO-row-split":					  "Διαίρεση γραμμής",
+	"TO-table-prop":				  "Ιδιότητες πίνακα",
+	"Table Properties":				  "Ιδιότητες πίνακα",
+	"Text align":                                     "Στοίχηση κειμένου",
+	"The bottom side only":				  "Η κάτω πλευρά μόνο",
+	"The left-hand side only":			  "Η αριστερή πλευρά μόνο",
+	"The right and left sides only":		  "Οι δεξιές και αριστερές πλευρές μόνο",
+	"The right-hand side only":			  "Η δεξιά πλευρά μόνο",
+	"The top and bottom sides only":		  "Οι πάνω και κάτω πλευρές μόνο",
+	"The top side only":				  "Η πάνω πλευρά μόνο",
+	"Top":                                            "Πάνω",	
+	"Unset color":                                    "Αναίρεση χρώματος",
+	"Vertical align":                                 "Κατακόρυφη στοίχηση",
+	"Width":					  "Πλάτος",
+	"not-del-last-cell":				  "Δεν μπορεί να διαγραφεί το τελευταίο κελί σε μια γραμμή.",
+	"not-del-last-col":				  "Δεν μπορεί να διαγραφεί η τελευταία στήλη σε ένα πίνακα.",
+	"not-del-last-row":				  "Δεν μπορεί να διαγραφεί η τελευταία γραμμή σε ένα πίνακα.",
+	"percent":					  "τοις εκατόν",
+	"pixels":					  "pixels"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/ro.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/ro.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/ro.js	(revision 1328)
@@ -0,0 +1,90 @@
+// I18N constants
+
+// LANG: "ro", ENCODING: UTF-8
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+TableOperations.I18N = {
+	"Align":					  "Aliniere",
+	"All four sides":				  "Toate părţile",
+	"Background":					  "Fundal",
+	"Baseline":                                       "Baseline",
+	"Border":					  "Chenar",
+	"Borders":					  "Chenare",
+	"Bottom":                                         "Jos",
+	"CSS Style":					  "Stil [CSS]",
+	"Caption":					  "Titlu de tabel",
+	"Cell Properties":                                "Proprietăţile celulei",
+	"Center":					  "Centru",
+	"Char":                                           "Caracter",
+	"Collapsed borders":                              "Chenare asimilate",
+	"Color":					  "Culoare",
+	"Description":					  "Descriere",
+	"FG Color":					  "Culoare text",
+	"Float":                                          "Poziţie",
+	"Frames":					  "Chenare",
+	"Height":                                         "Înălţimea",
+	"How many columns would you like to merge?":      "Câte coloane vrei să uneşti?",
+	"How many rows would you like to merge?":         "Câte linii vrei să uneşti?",
+	"Image URL":					  "URL-ul imaginii",
+	"Justify":                                        "Justify",
+	"Layout":					  "Aranjament",
+	"Left":						  "Stânga",
+	"Margin":                                         "Margine",
+	"Middle":                                         "Mijloc",
+	"No rules":					  "Fără linii",
+	"No sides":					  "Fără părţi",
+	"None":                                           "Nimic",
+	"Padding":					  "Spaţiere",
+	"Please click into some cell":                    "Vă rog să daţi click într-o celulă",
+	"Right":					  "Dreapta",
+	"Row Properties":                                 "Proprietăţile liniei",
+	"Rules will appear between all rows and columns": "Vor apărea linii între toate rândurile şi coloanele",
+	"Rules will appear between columns only":	  "Vor apărea doar linii verticale",
+	"Rules will appear between rows only":		  "Vor apărea doar linii orizontale",
+	"Rules":					  "Linii",
+	"Spacing and padding":                            "Spaţierea",
+	"Spacing":					  "Între celule",
+	"Summary":					  "Sumar",
+	"TO-cell-delete":				  "Şterge celula",
+	"TO-cell-insert-after":				  "Inserează o celulă la dreapta",
+	"TO-cell-insert-before":			  "Inserează o celulă la stânga",
+	"TO-cell-merge":				  "Uneşte celulele",
+	"TO-cell-prop":					  "Proprietăţile celulei",
+	"TO-cell-split":				  "Împarte celula",
+	"TO-col-delete":				  "Şterge coloana",
+	"TO-col-insert-after":				  "Inserează o coloană la dreapta",
+	"TO-col-insert-before":				  "Inserează o coloană la stânga",
+	"TO-col-split":					  "Împarte coloana",
+	"TO-row-delete":				  "Şterge rândul",
+	"TO-row-insert-above":				  "Inserează un rând înainte",
+	"TO-row-insert-under":				  "Inserează un rând după",
+	"TO-row-prop":					  "Proprietăţile rândului",
+	"TO-row-split":					  "Împarte rândul",
+	"TO-table-prop":				  "Proprietăţile tabelei",
+	"Table Properties":				  "Proprietăţile tabelei",
+	"Text align":                                     "Aliniere",
+	"The bottom side only":				  "Doar partea de jos",
+	"The left-hand side only":			  "Doar partea din stânga",
+	"The right and left sides only":		  "Partea din stânga şi cea din dreapta",
+	"The right-hand side only":			  "Doar partea din dreapta",
+	"The top and bottom sides only":		  "Partea de sus si cea de jos",
+	"The top side only":				  "Doar partea de sus",
+	"Top":                                            "Sus",	
+	"Unset color":                                    "Dezactivează culoarea",
+	"Vertical align":                                 "Aliniere pe verticală",
+	"Width":					  "Lăţime",
+	"not-del-last-cell":				  "HTMLArea refuză cu laşitate să şteargă ultima celulă din rând.",
+	"not-del-last-col":				  "HTMLArea refuză cu laşitate să şteargă ultima coloamă din tabela.",
+	"not-del-last-row":				  "HTMLArea refuză cu laşitate să şteargă ultimul rând din tabela.",
+	"percent":					  "procente",
+	"pixels":					  "pixeli"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/en.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/en.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/en.js	(revision 1328)
@@ -0,0 +1,90 @@
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+TableOperations.I18N = {
+	"Align":					  "Align",
+	"All four sides":				  "All four sides",
+	"Background":					  "Background",
+	"Baseline":                                       "Baseline",
+	"Border":					  "Border",
+	"Borders":					  "Borders",
+	"Bottom":                                         "Bottom",
+	"CSS Style":					  "Style [CSS]",
+	"Caption":					  "Caption",
+	"Cell Properties":                                "Cell Properties",
+	"Center":					  "Center",
+	"Char":                                           "Char",
+	"Collapsed borders":                              "Collapsed borders",
+	"Color":					  "Color",
+	"Description":					  "Description",
+	"FG Color":					  "FG Color",
+	"Float":                                          "Float",
+	"Frames":					  "Frames",
+	"Height":                                         "Height",
+	"How many columns would you like to merge?":      "How many columns would you like to merge?",
+	"How many rows would you like to merge?":         "How many rows would you like to merge?",
+	"Image URL":					  "Image URL",
+	"Justify":                                        "Justify",
+	"Layout":					  "Layout",
+	"Left":						  "Left",
+	"Margin":                                         "Margin",
+	"Middle":                                         "Middle",
+	"No rules":					  "No rules",
+	"No sides":					  "No sides",
+	"None":                                           "None",
+	"Padding":					  "Padding",
+	"Please click into some cell":                    "Please click into some cell",
+	"Right":					  "Right",
+	"Row Properties":                                 "Row Properties",
+	"Rules will appear between all rows and columns": "Rules will appear between all rows and columns",
+	"Rules will appear between columns only":	  "Rules will appear between columns only",
+	"Rules will appear between rows only":		  "Rules will appear between rows only",
+	"Rules":					  "Rules",
+	"Spacing and padding":                            "Spacing and padding",
+	"Spacing":					  "Spacing",
+	"Summary":					  "Summary",
+	"TO-cell-delete":				  "Delete cell",
+	"TO-cell-insert-after":				  "Insert cell after",
+	"TO-cell-insert-before":			  "Insert cell before",
+	"TO-cell-merge":				  "Merge cells",
+	"TO-cell-prop":					  "Cell properties",
+	"TO-cell-split":				  "Split cell",
+	"TO-col-delete":				  "Delete column",
+	"TO-col-insert-after":				  "Insert column after",
+	"TO-col-insert-before":				  "Insert column before",
+	"TO-col-split":					  "Split column",
+	"TO-row-delete":				  "Delete row",
+	"TO-row-insert-above":				  "Insert row before",
+	"TO-row-insert-under":				  "Insert row after",
+	"TO-row-prop":					  "Row properties",
+	"TO-row-split":					  "Split row",
+	"TO-table-prop":				  "Table properties",
+	"Table Properties":				  "Table Properties",
+	"Text align":                                     "Text align",
+	"The bottom side only":				  "The bottom side only",
+	"The left-hand side only":			  "The left-hand side only",
+	"The right and left sides only":		  "The right and left sides only",
+	"The right-hand side only":			  "The right-hand side only",
+	"The top and bottom sides only":		  "The top and bottom sides only",
+	"The top side only":				  "The top side only",
+	"Top":                                            "Top",	
+	"Unset color":                                    "Unset color",
+	"Vertical align":                                 "Vertical align",
+	"Width":					  "Width",
+	"not-del-last-cell":				  "HTMLArea cowardly refuses to delete the last cell in row.",
+	"not-del-last-col":				  "HTMLArea cowardly refuses to delete the last column in table.",
+	"not-del-last-row":				  "HTMLArea cowardly refuses to delete the last row in table.",
+	"percent":					  "percent",
+	"pixels":					  "pixels"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/da.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/da.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/da.js	(revision 1328)
@@ -0,0 +1,90 @@
+﻿// I18N constants
+
+// LANG: "da", ENCODING: UTF-8 | ISO-8859-1
+// Author: Steen Sønderup, <steen@soenderup.com>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+TableOperations.I18N = {
+	"Align":											"Placer",
+	"All four sides":									"Alle fire sider",
+	"Background":										"Baggrund",
+	"Baseline":											"Bundlinie",
+	"Border":											"Kant",
+	"Borders":											"Kanter",
+	"Bottom":											"Bund",
+	"CSS Style":										"Stil [CSS]",
+	"Caption":											"Titel",
+	"Cell Properties":									"Celle egenskaber",
+	"Center":											"Centrer",
+	"Char":												"Plads",
+	"Collapsed borders":								"Sammensmelt rammer",
+	"Color":											"Farve",
+	"Description":										"Beskrivelse",
+	"FG Color":											"Font farve",
+	"Float":											"Justering",
+	"Frames":											"Udvendig",
+	"Height":											"Højde",
+	"How many columns would you like to merge?":		"Hvor mange kollonner vil du samle?",
+	"How many rows would you like to merge?":			"Hvor mange rækker vil du samle?",
+	"Image URL":										"Billede URL",
+	"Justify":											"Lige margener",
+	"Layout":											"Opsætning",
+	"Left":												"Venstre",
+	"Margin":											"Margen",
+	"Middle":											"Centrer",
+	"No rules":											"Ingen rammer",
+	"No sides":											"Ingen sider",
+	"None":												"Ingen",
+	"Padding":											"Margen",
+	"Please click into some cell":						"Klik på en celle",
+	"Right":											"Højre",
+	"Row Properties":									"Række egenskaber",
+	"Rules will appear between all rows and columns":	"Rammer mellem rækker og kolonner",
+	"Rules will appear between columns only":			"Kun rammer mellem kolonner",
+	"Rules will appear between rows only":				"Kun rammer mellem rækker",
+	"Rules":											"Invendig",
+	"Spacing and padding":								"Afstand og margen",
+	"Spacing":											"Afstand",
+	"Summary":											"Beskrivelse",
+	"TO-cell-delete":									"Slet celle",
+	"TO-cell-insert-after":								"Indsæt celle efter",
+	"TO-cell-insert-before":							"Indsæt celle før",
+	"TO-cell-merge":									"Sammensæt celler",
+	"TO-cell-prop":										"Celle egenskaber",
+	"TO-cell-split":									"Opdel celle",
+	"TO-col-delete":									"Slet kollonne",
+	"TO-col-insert-after":								"Indsæt kolonne efter",
+	"TO-col-insert-before":								"Indsæt kolonne før",
+	"TO-col-split":										"Opdel kolonne",
+	"TO-row-delete":									"Slet række",
+	"TO-row-insert-above":								"Indsæt række før",
+	"TO-row-insert-under":								"Indsæt række efter",
+	"TO-row-prop":										"Række egenskaber",
+	"TO-row-split":										"Opdel række",
+	"TO-table-prop":									"Tabel egenskaber",
+	"Table Properties":									"Tabel egenskaber",
+	"Text align":										"Tekst",
+	"The bottom side only":								"Kun i bunden",
+	"The left-hand side only":							"Kun i højre side",
+	"The right and left sides only":					"Kun i siderne",
+	"The right-hand side only":							"Kun i venstre side",
+	"The top and bottom sides only":					"Kun i top og bund",
+	"The top side only":								"Kun i toppen",
+	"Top":												"Top",	
+	"Unset color":										"Farve ikke valgt",
+	"Vertical align":									"Vertikal placering",
+	"Width":											"Bredde",
+	"not-del-last-cell":								"Du kan ikke slette den sidste celle i en række.",
+	"not-del-last-col":									"Du kan ikke slette den sidste kolonne i en tabel.",
+	"not-del-last-row":									"Du kan ikke slette den sidste række i en tabel.",
+	"percent":											"procent",
+	"pixels":											"pixel"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/de.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/de.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/de.js	(revision 1328)
@@ -0,0 +1,81 @@
+// I18N constants
+
+// LANG: "de", ENCODING: UTF-8 | ISO-8859-1
+// Author: broxx, <broxx@broxx.com>
+
+TableOperations.I18N = {
+	"Align":					  "Ausrichten",
+	"All four sides":				  "Alle 4 Seiten",
+	"Background":					  "Hintergrund",
+	"Baseline":                                       "Basislinie",
+	"Border":					  "Rand",
+	"Borders":					  "Raender",
+	"Bottom":                                         "Unten",
+	"CSS Style":					  "Style [CSS]",
+	"Caption":					  "Ueberschrift",
+	"Cell Properties":                                "Zellen",
+	"Center":					  "Zentrieren",
+	"Char":                                           "Zeichen",
+	"Collapsed borders":                              "Collapsed borders",
+	"Color":					  "Farbe",
+	"Description":					  "Beschreibung",
+	"FG Color":					  "FG Farbe",
+	"Float":                                          "Ausrichtung",
+	"Frames":					  "Rahmen",
+	"Height":                                         "Hoehe",
+	"How many columns would you like to merge?":      "Wieviele Spalten willst du verbinden?",
+	"How many rows would you like to merge?":         "Wieviele Zeilen willst du verbinden?",
+	"Image URL":					  "Bild URL",
+	"Justify":                                        "Justieren",
+	"Layout":					  "Layout",
+	"Left":						  "Links",
+	"Margin":                                         "Rand",
+	"Middle":                                         "Mitte",
+	"No rules":					  "Keine Balken",
+	"No sides":					  "Keine Seiten",
+	"None":                                           "Keine",
+	"Padding":					  "Auffuellung",
+	"Please click into some cell":                    "Waehle eine Zelle",
+	"Right":					  "Rechts",
+	"Row Properties":                                 "Reihen",
+	"Rules will appear between all rows and columns": "Balken zwischen Reihen und Spalten",
+	"Rules will appear between columns only":	  "Balken zwischen Spalten",
+	"Rules will appear between rows only":		  "Balken zwischen Reihen",
+	"Rules":					  "Balken",
+	"Spacing and padding":                            "Abstaende",
+	"Spacing":					  "Abstand",
+	"Summary":					  "Zusammenfassung",
+	"TO-cell-delete":				  "Zelle loeschen",
+	"TO-cell-insert-after":				  "Zelle einfuegen nach",
+	"TO-cell-insert-before":			  "Zelle einfuegen bevor",
+	"TO-cell-merge":				  "Zellen zusammenfuegen",
+	"TO-cell-prop":					  "Zelleinstellungen",
+	"TO-cell-split":				  "Zellen aufteilen",
+	"TO-col-delete":				  "Spalte loeschen",
+	"TO-col-insert-after":				  "Spalte einfuegen nach",
+	"TO-col-insert-before":				  "Spalte einfuegen bevor",
+	"TO-col-split":					  "Spalte aufteilen",
+	"TO-row-delete":				  "Reihe loeschen",
+	"TO-row-insert-above":				  "Reihe einfuegen vor",
+	"TO-row-insert-under":				  "Reihe einfuegen nach",
+	"TO-row-prop":					  "Reiheneinstellungen",
+	"TO-row-split":					  "Reihen aufteilen",
+	"TO-table-prop":				  "Tabelle",
+	"Table Properties":				  "Tabelle",
+	"Text align":                                     "Ausrichtung",
+	"The bottom side only":				  "Nur untere Seite",
+	"The left-hand side only":			  "Nur linke Seite",
+	"The right and left sides only":		  "Nur linke und rechte Seite",
+	"The right-hand side only":			  "Nur rechte Seite",
+	"The top and bottom sides only":		  "Nur obere und untere Seite",
+	"The top side only":				  "Nur obere Seite",
+	"Top":                                            "Oben",	
+	"Unset color":                                    "Farbe",
+	"Vertical align":                                 "Ausrichtung",
+	"Width":					  "Breite",
+	"not-del-last-cell":				  "Letzte Zelle in dieser Reihe!",
+	"not-del-last-col":				  "Letzte Spalte in dieser Tabelle!",
+	"not-del-last-row":				  "Letzte Reihe in dieser Tabelle",
+	"percent":					  "%",
+	"pixels":					  "pixels"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/nl.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/nl.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/nl.js	(revision 1328)
@@ -0,0 +1,90 @@
+// I18N constants
+
+// LANG: "nl", ENCODING: UTF-8 | ISO-8859-1
+// Author: Michel Weegeerink (info@mmc-shop.nl), http://mmc-shop.nl
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+TableOperations.I18N = {
+	"Align":											"Uitlijning",
+	"All four sides":									"Alle 4 zijden",
+	"Background":										"Achtergrond",
+	"Baseline":											"Basis",
+	"Border":											"Rand",
+	"Borders":											"Randen",
+	"Bottom":											"Onder",
+	"CSS Style":										"CSS Style",
+	"Caption":											"Opmerking",
+	"Cell Properties":									"Celeigenschappen",
+	"Center":											"Centreren",
+	"Char":												"Karakter",
+	"Collapsed borders":								"Geen randen",
+	"Color":											"Kleur",
+	"Description":										"Omschrijving",
+	"FG Color":											"Voorgrond",
+	"Float":											"Zwevend",
+	"Frames":											"Frames",
+	"Height":											"Hoogte",
+	"How many columns would you like to merge?":		"Hoeveel kolommen wilt u samenvoegen?",
+	"How many rows would you like to merge?":			"Hoeveel rijen wilt u samenvoegen?",
+	"Image URL":										"Afbeelding URL",
+	"Justify":											"Uitvullen",
+	"Layout":											"Opmaak",
+	"Left":												"Links",
+	"Margin":											"Marge",
+	"Middle":											"Midden",
+	"No rules":											"Geen regels",
+	"No sides":											"Geen zijlijnen",
+	"None":												"Geen",
+	"Padding":											"Celmarge",
+	"Please click into some cell":						"Klik in een cel a.u.b.",
+	"Right":											"Rechts",
+	"Row Properties":									"Rijeigenschappen",
+	"Rules will appear between all rows and columns":	"Regels verschijnen tussen alle rijen en kolommen",
+	"Rules will appear between columns only":	  		"Regels verschijnen enkel tussen de kolommen",
+	"Rules will appear between rows only":				"Regels verschijnen enkel tussen de rijen",
+	"Rules":					  						"Regels",
+	"Spacing and padding":                           	"Celmarge en afstand tussen cellen",
+	"Spacing":											"marge",
+	"Summary":											"Overzicht",
+	"TO-cell-delete":				  					"Cel verwijderen",
+	"TO-cell-insert-after":				  				"Voeg cel toe achter",
+	"TO-cell-insert-before":			  				"Voeg cel toe voor",
+	"TO-cell-merge":									"Cellen samenvoegen",
+	"TO-cell-prop":										"Celeigenschappen",
+	"TO-cell-split":									"Cel splitsen",
+	"TO-col-delete":									"Kolom verwijderen",
+	"TO-col-insert-after":								"Kolom invoegen achter",
+	"TO-col-insert-before":								"Kolom invoegen voor",
+	"TO-col-split":										"Kolom splitsen",
+	"TO-row-delete":									"Rij verwijderen",
+	"TO-row-insert-above":								"Rij invoegen boven",
+	"TO-row-insert-under":								"Rij invoegen onder",
+	"TO-row-prop":										"Rij eigenschappen",
+	"TO-row-split":										"Rij splitsen",
+	"TO-table-prop":				  					"Tabel eigenschappen",
+	"Table Properties":				  					"Tabel eigenschappen",
+	"Text align":                                     	"Text uitlijning",
+	"The bottom side only":				  				"Enkel aan de onderkant",
+	"The left-hand side only":			 				"Enkel aan de linkerkant",
+	"The right and left sides only":		 			"Enkel aan de linker en rechterkant",
+	"The right-hand side only":							"Enkel aan de rechterkant",
+	"The top and bottom sides only":					"Enkel aan de bovenen onderkant",
+	"The top side only":								"Enkel aan de bovenkant",
+	"Top":												"Boven",
+	"Unset color":										"Wis kleur",
+	"Vertical align":									"Vertikale uitlijning",
+	"Width":					 						"Breedte",
+	"not-del-last-cell":								"HTMLArea kan de laatste cel in deze tabel niet verwijderen.",
+	"not-del-last-col":									"HTMLArea kan de laatste kolom in deze tabel niet verwijderen.",
+	"not-del-last-row":									"HTMLArea kan de laatste rij in deze tabel niet verwijderen.",
+	"percent":											"procent",
+	"pixels":											"pixels"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/cz.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/cz.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/cz.js	(revision 1328)
@@ -0,0 +1,90 @@
+﻿// I18N constants
+
+// LANG: "cz", ENCODING: UTF-8 | ISO-8859-2
+// Author: Jiri Löw, <jirilow@jirilow.com>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+TableOperations.I18N = {
+	"Align":					  "Zarovnání",
+	"All four sides":				  "Všechny čtyři strany",
+	"Background":					  "Pozadí",
+	"Baseline":                                       "Základní linka",
+	"Border":					  "Obrys",
+	"Borders":					  "Obrysy",
+	"Bottom":                                         "Dolů",
+	"CSS Style":					  "Kaskádové styly (CSS)",
+	"Caption":					  "Titulek",
+	"Cell Properties":                                "Vlastnosti buňky",
+	"Center":					  "Na střed",
+	"Char":                                           "Znak",
+	"Collapsed borders":                              "Stlačené okraje",
+	"Color":					  "Barva",
+	"Description":					  "Popis",
+	"FG Color":					  "Barva popředí",
+	"Float":                                          "Obtékání",
+	"Frames":					  "Rámečky",
+	"Height":                                         "Výška",
+	"How many columns would you like to merge?":      "Kolik sloupců si přejete spojit?",
+	"How many rows would you like to merge?":         "Kolik řádků si přejete spojit?",
+	"Image URL":					  "Adresa obrázku",
+	"Justify":                                        "Do stran",
+	"Layout":					  "Rozložení",
+	"Left":						  "Vlevo",
+	"Margin":                                         "Okraj",
+	"Middle":                                         "Na střed",
+	"No rules":					  "Žádné čáry",
+	"No sides":					  "Žádné strany",
+	"None":                                           "Žádné",
+	"Padding":					  "Odsazování",
+	"Please click into some cell":                    "Prosím klikněte do některé buňky",
+	"Right":					  "Vpravo",
+	"Row Properties":                                 "Vlastnosti řádku",
+	"Rules will appear between all rows and columns": "Čáry mezi všemi řádky i sloupci",
+	"Rules will appear between columns only":	  "Čáry pouze mezi sloupci",
+	"Rules will appear between rows only":		  "Čáry pouze mezi řádky",
+	"Rules":					  "Čáry",
+	"Spacing and padding":                            "Mezery a odsazování",
+	"Spacing":					  "Mezery",
+	"Summary":					  "Shrnutí",
+	"TO-cell-delete":				  "Smazat buňku",
+	"TO-cell-insert-after":				  "Vložit buňku za",
+	"TO-cell-insert-before":			  "Vložit buňku před",
+	"TO-cell-merge":				  "Spojit buňky",
+	"TO-cell-prop":					  "Vlastnosti buňky",
+	"TO-cell-split":				  "Rozdělit buňku",
+	"TO-col-delete":				  "Smazat sloupec",
+	"TO-col-insert-after":				  "Vložit sloupec za",
+	"TO-col-insert-before":				  "Vložit sloupec před",
+	"TO-col-split":					  "Rozdělit sloupec",
+	"TO-row-delete":				  "Smazat řádek",
+	"TO-row-insert-above":				  "Smazat řádek nad",
+	"TO-row-insert-under":				  "Smazat řádek pod",
+	"TO-row-prop":					  "Vlastnosti řádku",
+	"TO-row-split":					  "Rozdělit řádek",
+	"TO-table-prop":				  "Vlastnosti tabulky",
+	"Table Properties":				  "Vlastnosti tabulky",
+	"Text align":                                     "Zarovnání textu",
+	"The bottom side only":				  "Pouze spodní strana",
+	"The left-hand side only":			  "Pouze levá strana",
+	"The right and left sides only":		  "Pouze levá a pravá strana",
+	"The right-hand side only":			  "Pouze pravá strana",
+	"The top and bottom sides only":		  "Pouze horní a dolní strana",
+	"The top side only":				  "Pouze horní strana",
+	"Top":                                            "Nahoru",	
+	"Unset color":                                    "Zrušit barvu",
+	"Vertical align":                                 "Svislé zarovnání",
+	"Width":					  "Šířka",
+	"not-del-last-cell":				  "HTMLArea zbaběle odmítá smazat poslední buňku v řádku.",
+	"not-del-last-col":				  "HTMLArea zbaběle odmítá smazat poslední sloupec v tabulce.",
+	"not-del-last-row":				  "HTMLArea zbaběle odmítá smazat poslední řádek v tabulce.",
+	"percent":					  "procent",
+	"pixels":					  "pixelů"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/hu.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/hu.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/hu.js	(revision 1328)
@@ -0,0 +1,63 @@
+// I18N constants
+
+// LANG: "hu", ENCODING: UTF-8
+// Author: Miklós Somogyi, <somogyine@vnet.hu>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+HTMLArea.I18N = {
+
+	// the following should be the filename without .js extension
+	// it will be used for automatically load plugin language.
+	lang: "hu",
+
+	tooltips: {
+		bold:           "Félkövér",
+		italic:         "Dőlt",
+		underline:      "Aláhúzott",
+		strikethrough:  "Áthúzott",
+		subscript:      "Alsó index",
+		superscript:    "Felső index",
+		justifyleft:    "Balra zárt",
+		justifycenter:  "Középre zárt",
+		justifyright:   "Jobbra zárt",
+		justifyfull:    "Sorkizárt",
+		orderedlist:    "Számozott lista",
+		unorderedlist:  "Számozatlan lista",
+		outdent:        "Behúzás csökkentése",
+		indent:         "Behúzás növelése",
+		forecolor:      "Karakterszín",
+		hilitecolor:    "Háttérszín",
+		horizontalrule: "Elválasztó vonal",
+		createlink:     "Hiperhivatkozás beszúrása",
+		insertimage:    "Kép beszúrása",
+		inserttable:    "Táblázat beszúrása",
+		htmlmode:       "HTML forrás be/ki",
+		popupeditor:    "Szerkesztő külön ablakban",
+		about:          "Névjegy",
+		showhelp:       "Súgó",
+		textindicator:  "Aktuális stílus",
+		undo:           "Visszavonás",
+		redo:           "Újra végrehajtás",
+		cut:            "Kivágás",
+		copy:           "Másolás",
+		paste:          "Beillesztés"
+	},
+
+	buttons: {
+		"ok":           "Rendben",
+		"cancel":       "Mégsem"
+	},
+
+	msg: {
+		"Path":         "Hierarchia",
+		"TEXT_MODE":    "Forrás mód. Visszaváltás [<>] gomb"
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/it.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/it.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/it.js	(revision 1328)
@@ -0,0 +1,81 @@
+// I18N constants
+
+// LANG: "it", ENCODING: UTF-8 | ISO-8859-1
+// Author: Fabio Rotondo <fabio@rotondo.it>
+
+TableOperations.I18N = {
+	"Align":					  "Allinea",
+	"All four sides":				  "Tutti e quattro i lati",
+	"Background":					  "Sfondo",
+	"Baseline":                                       "Allineamento",
+	"Border":					  "Bordo",
+	"Borders":					  "Bordi",
+	"Bottom":                                         "Basso",
+	"CSS Style":					  "Stile [CSS]",
+	"Caption":					  "Titolo",
+	"Cell Properties":                                "Proprietà della Cella",
+	"Center":					  "Centra",
+	"Char":                                           "Carattere",
+	"Collapsed borders":                              "Bordi chiusi",
+	"Color":					  "Colore",
+	"Description":					  "Descrizione",
+	"FG Color":					  "Colore Principale",
+	"Float":                                          "Fluttuante",
+	"Frames":					  "Frames",
+	"Height":                                         "Altezza",
+	"How many columns would you like to merge?":      "Quante colonne vuoi unire?",
+	"How many rows would you like to merge?":         "Quante righe vuoi unire?",
+	"Image URL":					  "URL dell'Immagine",
+	"Justify":                                        "Justifica",
+	"Layout":					  "Layout",
+	"Left":						  "Sinistra",
+	"Margin":                                         "Margine",
+	"Middle":                                         "Centrale",
+	"No rules":					  "Nessun righello",
+	"No sides":					  "Nessun lato",
+	"None":                                           "Nulla",
+	"Padding":					  "Padding",
+	"Please click into some cell":                    "Per favore, clicca in una cella",
+	"Right":					  "Destra",
+	"Row Properties":                                 "Proprietà della Riga",
+	"Rules will appear between all rows and columns": "Le linee appariranno tra tutte le righe e colonne",
+	"Rules will appear between columns only":	  "Le linee appariranno solo tra le colonne",
+	"Rules will appear between rows only":		  "Le linee appariranno solo tra le righe",
+	"Rules":					  "Linee",
+	"Spacing and padding":                            "Spaziatura e Padding",
+	"Spacing":					  "Spaziatura",
+	"Summary":					  "Sommario",
+	"TO-cell-delete":				  "Cancella cella",
+	"TO-cell-insert-after":				  "Inserisci cella dopo",
+	"TO-cell-insert-before":			  "Inserisci cella prima",
+	"TO-cell-merge":				  "Unisci celle",
+	"TO-cell-prop":					  "Proprietà della cella",
+	"TO-cell-split":				  "Dividi cella",
+	"TO-col-delete":				  "Cancella colonna",
+	"TO-col-insert-after":				  "Inserisci colonna dopo",
+	"TO-col-insert-before":				  "Inserisci colonna prima",
+	"TO-col-split":					  "Dividi colonna",
+	"TO-row-delete":				  "Cancella riga",
+	"TO-row-insert-above":				  "Inserisci riga prima",
+	"TO-row-insert-under":				  "Inserisci riga dopo",
+	"TO-row-prop":					  "Proprietà della riga",
+	"TO-row-split":					  "Dividi riga",
+	"TO-table-prop":				  "Proprietà della Tabella",
+	"Table Properties":				  "Proprietà della Tabella",
+	"Text align":                                     "Allineamento del Testo",
+	"The bottom side only":				  "Solo la parte inferiore",
+	"The left-hand side only":			  "Solo la parte sinistra",
+	"The right and left sides only":		  "Solo destra e sinistra",
+	"The right-hand side only":			  "Solo la parte destra",
+	"The top and bottom sides only":		  "Solo sopra e sotto",
+	"The top side only":				  "Solo la parte sopra",
+	"Top":                                            "Alto",	
+	"Unset color":                                    "Rimuovi colore",
+	"Vertical align":                                 "Allineamento verticale",
+	"Width":					  "Larghezza",
+	"not-del-last-cell":				  "HTMLArea si rifiuta codardamente di cancellare l'ultima cella nella riga.",
+	"not-del-last-col":				  "HTMLArea si rifiuta codardamente di cancellare l'ultima colonna nella tabella.",
+	"not-del-last-row":				  "HTMLArea si rifiuta codardamente di cancellare l'ultima riga nella tabella.",
+	"percent":					  "percento",
+	"pixels":					  "pixels"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/no.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/no.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/lang/no.js	(revision 1328)
@@ -0,0 +1,91 @@
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>
+// translated into Norwegia: ses@online.no  11.11.03
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+TableOperations.I18N = {
+	"Align":					  	"Juster",
+	"All four sides":			  	"Alle fire sider",
+	"Background":					"Bakgrund",
+	"Baseline":                   	"Grunnlinje",
+	"Border":					  	"Kantlinje",
+	"Borders":					  	"Kantlinjer",
+	"Bottom":                     	"Bunn",
+	"CSS Style":					"Stil [CSS]",
+	"Caption":					  	"Overskrift",
+	"Cell Properties":              "Celleegenskaper",
+	"Center":					  	"Sentrer",
+	"Char":                         "Tegn",
+	"Collapsed borders":            "Fjern kantlinjer",
+	"Color":					  	"Farge",
+	"Description":					"Beskrivelse",
+	"FG Color":					  	"FG farge",
+	"Float":                        "Flytende",
+	"Frames":					  	"rammer",
+	"Height":                       "Høyde",
+	"How many columns would you like to merge?":      "Hvor mange kolonner vil du slå sammen?",
+	"How many rows would you like to merge?":         "Hvor mange rader vil du slå sammen?",
+	"Image URL":					"Bildets URL",
+	"Justify":                      "Juster",
+	"Layout":					  	"Layout",
+	"Left":						  	"Venstre",
+	"Margin":                       "Marg",
+	"Middle":                       "Midten",
+	"No rules":					  	"Ingen linjal",
+	"No sides":					  	"Ingen sider",
+	"None":                         "Ingen",
+	"Padding":					  	"Luft",
+	"Please click into some cell":  "Klikk i en eller annen celle",
+	"Right":					  	"Høyre",
+	"Row Properties":               "Egenskaper for rad",
+	"Rules will appear between all rows and columns": "Linjer vil synes mellom alle rader og kolonner",
+	"Rules will appear between columns only":	  "Linjer vil synes kun mellom kolonner",
+	"Rules will appear between rows only":		  "Linjer vil synes kun mellom rader",
+	"Rules":					  	"Linjer",
+	"Spacing and padding":          "Luft",
+	"Spacing":					  	"Luft",
+	"Summary":					  	"Sammendrag",
+	"TO-cell-delete":				"Slett celle",
+	"TO-cell-insert-after":			"Sett inn celle etter",
+	"TO-cell-insert-before":		"Sett inn celle foran",
+	"TO-cell-merge":				"Slå sammen celler",
+	"TO-cell-prop":					"Egenskaper for celle",
+	"TO-cell-split":				"Del celle",
+	"TO-col-delete":				"Slett kolonne",
+	"TO-col-insert-after":			"Skyt inn kolonne etter",
+	"TO-col-insert-before":			"Skyt inn kolonne før",
+	"TO-col-split":					"Del kolonne",
+	"TO-row-delete":				"Slett rad",
+	"TO-row-insert-above":			"Skyt inn rad foran",
+	"TO-row-insert-under":			"Skyt inn rad etter",
+	"TO-row-prop":					"Egenskaper for rad",
+	"TO-row-split":					"Del rad",
+	"TO-table-prop":				"Tabellegenskaper",
+	"Table Properties":				"Tabellegenskaper",
+	"Text align":                   "Juster tekst",
+	"The bottom side only":			"Bunnen kun",
+	"The left-hand side only":		"Venstresiden kun",
+	"The right and left sides only":	"Høyre- og venstresiden kun",
+	"The right-hand side only":			"Høyresiden kun",
+	"The top and bottom sides only":	"The top and bottom sides only",
+	"The top side only":				"Overkanten kun",
+	"Top":                          "Overkant",	
+	"Unset color":                  "Ikke-bestemt farge",
+	"Vertical align":               "Vertikal justering",
+	"Width":					  	"Bredde",
+	"not-del-last-cell":			"HTMLArea nekter å slette siste cellen i tabellen.",
+	"not-del-last-col":				"HTMLArea nekter å slette siste kolonnen i tabellen.",
+	"not-del-last-row":				"HTMLArea nekter å slette siste raden i tabellen.",
+	"percent":					  	"prosent",
+	"pixels":					  	"billedpunkter"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/table-operations.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/table-operations.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/TableOperations/table-operations.js	(revision 1328)
@@ -0,0 +1,1160 @@
+// Table Operations Plugin for HTMLArea-3.0
+// Implementation by Mihai Bazon.  Sponsored by http://www.bloki.com
+//
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
+// This notice MUST stay intact for use (see license.txt).
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon for InteractiveTools.
+//   http://dynarch.com/mishoo
+//
+// $Id$
+
+// Object that will encapsulate all the table operations provided by
+// HTMLArea-3.0 (except "insert table" which is included in the main file)
+function TableOperations(editor) {
+	this.editor = editor;
+
+	var cfg = editor.config;
+	var tt = TableOperations.I18N;
+	var bl = TableOperations.btnList;
+	var self = this;
+
+	// register the toolbar buttons provided by this plugin
+	var toolbar = ["linebreak"];
+	for (var i in bl) {
+		var btn = bl[i];
+		if (!btn) {
+			toolbar.push("separator");
+		} else {
+			var id = "TO-" + btn[0];
+			cfg.registerButton(id, tt[id], editor.imgURL(btn[0] + ".gif", "TableOperations"), false,
+					   function(editor, id) {
+						   // dispatch button press event
+						   self.buttonPress(editor, id);
+					   }, btn[1]);
+			toolbar.push(id);
+		}
+	}
+
+	// add a new line in the toolbar
+	cfg.toolbar.push(toolbar);
+};
+
+TableOperations._pluginInfo = {
+	name          : "TableOperations",
+	version       : "1.0",
+	developer     : "Mihai Bazon",
+	developer_url : "http://dynarch.com/mishoo/",
+	c_owner       : "Mihai Bazon",
+	sponsor       : "Zapatec Inc.",
+	sponsor_url   : "http://www.bloki.com",
+	license       : "htmlArea"
+};
+
+/************************
+ * UTILITIES
+ ************************/
+
+// retrieves the closest element having the specified tagName in the list of
+// ancestors of the current selection/caret.
+TableOperations.prototype.getClosest = function(tagName) {
+	var editor = this.editor;
+	var ancestors = editor.getAllAncestors();
+	var ret = null;
+	tagName = ("" + tagName).toLowerCase();
+	for (var i in ancestors) {
+		var el = ancestors[i];
+		if (el.tagName.toLowerCase() == tagName) {
+			ret = el;
+			break;
+		}
+	}
+	return ret;
+};
+
+// this function requires the file PopupDiv/PopupWin to be loaded from browser
+TableOperations.prototype.dialogTableProperties = function() {
+	var i18n = TableOperations.I18N;
+	// retrieve existing values
+	var table = this.getClosest("table");
+	// this.editor.selectNodeContents(table);
+	// this.editor.updateToolbar();
+
+	var dialog = new PopupWin(this.editor, i18n["Table Properties"], function(dialog, params) {
+		TableOperations.processStyle(params, table);
+		for (var i in params) {
+			var val = params[i];
+			switch (i) {
+			    case "f_caption":
+				if (/\S/.test(val)) {
+					// contains non white-space characters
+					var caption = table.getElementsByTagName("caption")[0];
+					if (!caption) {
+						caption = dialog.editor._doc.createElement("caption");
+						table.insertBefore(caption, table.firstChild);
+					}
+					caption.innerHTML = val;
+				} else {
+					// search for caption and delete it if found
+					var caption = table.getElementsByTagName("caption")[0];
+					if (caption) {
+						caption.parentNode.removeChild(caption);
+					}
+				}
+				break;
+			    case "f_summary":
+				table.summary = val;
+				break;
+			    case "f_width":
+				table.style.width = ("" + val) + params.f_unit;
+				break;
+			    case "f_align":
+				table.align = val;
+				break;
+			    case "f_spacing":
+				table.cellSpacing = val;
+				break;
+			    case "f_padding":
+				table.cellPadding = val;
+				break;
+			    case "f_borders":
+				table.border = val;
+				break;
+			    case "f_frames":
+				table.frame = val;
+				break;
+			    case "f_rules":
+				table.rules = val;
+				break;
+			}
+		}
+		// various workarounds to refresh the table display (Gecko,
+		// what's going on?! do not disappoint me!)
+		dialog.editor.forceRedraw();
+		dialog.editor.focusEditor();
+		dialog.editor.updateToolbar();
+		var save_collapse = table.style.borderCollapse;
+		table.style.borderCollapse = "collapse";
+		table.style.borderCollapse = "separate";
+		table.style.borderCollapse = save_collapse;
+	},
+
+	// this function gets called when the dialog needs to be initialized
+	function (dialog) {
+
+		var f_caption = "";
+		var capel = table.getElementsByTagName("caption")[0];
+		if (capel) {
+			f_caption = capel.innerHTML;
+		}
+		var f_summary = table.summary;
+		var f_width = parseInt(table.style.width);
+		isNaN(f_width) && (f_width = "");
+		var f_unit = /%/.test(table.style.width) ? 'percent' : 'pixels';
+		var f_align = table.align;
+		var f_spacing = table.cellSpacing;
+		var f_padding = table.cellPadding;
+		var f_borders = table.border;
+		var f_frames = table.frame;
+		var f_rules = table.rules;
+
+		function selected(val) {
+			return val ? " selected" : "";
+		};
+
+		// dialog contents
+		dialog.content.style.width = "400px";
+		dialog.content.innerHTML = " \
+<div class='title'\
+ style='background: url(" + dialog.baseURL + dialog.editor.imgURL("table-prop.gif", "TableOperations") + ") #fff 98% 50% no-repeat'>" + i18n["Table Properties"] + "\
+</div> \
+<table style='width:100%'> \
+  <tr> \
+    <td> \
+      <fieldset><legend>" + i18n["Description"] + "</legend> \
+       <table style='width:100%'> \
+        <tr> \
+          <td class='label'>" + i18n["Caption"] + ":</td> \
+          <td class='value'><input type='text' name='f_caption' value='" + f_caption + "'/></td> \
+        </tr><tr> \
+          <td class='label'>" + i18n["Summary"] + ":</td> \
+          <td class='value'><input type='text' name='f_summary' value='" + f_summary + "'/></td> \
+        </tr> \
+       </table> \
+      </fieldset> \
+    </td> \
+  </tr> \
+  <tr><td id='--HA-layout'></td></tr> \
+  <tr> \
+    <td> \
+      <fieldset><legend>" + i18n["Spacing and padding"] + "</legend> \
+       <table style='width:100%'> \
+"+//        <tr> \
+//           <td class='label'>" + i18n["Width"] + ":</td> \
+//           <td><input type='text' name='f_width' value='" + f_width + "' size='5' /> \
+//             <select name='f_unit'> \
+//               <option value='%'" + selected(f_unit == "percent") + ">" + i18n["percent"] + "</option> \
+//               <option value='px'" + selected(f_unit == "pixels") + ">" + i18n["pixels"] + "</option> \
+//             </select> &nbsp;&nbsp;" + i18n["Align"] + ": \
+//             <select name='f_align'> \
+//               <option value='left'" + selected(f_align == "left") + ">" + i18n["Left"] + "</option> \
+//               <option value='center'" + selected(f_align == "center") + ">" + i18n["Center"] + "</option> \
+//               <option value='right'" + selected(f_align == "right") + ">" + i18n["Right"] + "</option> \
+//             </select> \
+//           </td> \
+//         </tr> \
+"        <tr> \
+          <td class='label'>" + i18n["Spacing"] + ":</td> \
+          <td><input type='text' name='f_spacing' size='5' value='" + f_spacing + "' /> &nbsp;" + i18n["Padding"] + ":\
+            <input type='text' name='f_padding' size='5' value='" + f_padding + "' /> &nbsp;&nbsp;" + i18n["pixels"] + "\
+          </td> \
+        </tr> \
+       </table> \
+      </fieldset> \
+    </td> \
+  </tr> \
+  <tr> \
+    <td> \
+      <fieldset><legend>Frame and borders</legend> \
+        <table width='100%'> \
+          <tr> \
+            <td class='label'>" + i18n["Borders"] + ":</td> \
+            <td><input name='f_borders' type='text' size='5' value='" + f_borders + "' /> &nbsp;&nbsp;" + i18n["pixels"] + "</td> \
+          </tr> \
+          <tr> \
+            <td class='label'>" + i18n["Frames"] + ":</td> \
+            <td> \
+              <select name='f_frames'> \
+                <option value='void'" + selected(f_frames == "void") + ">" + i18n["No sides"] + "</option> \
+                <option value='above'" + selected(f_frames == "above") + ">" + i18n["The top side only"] + "</option> \
+                <option value='below'" + selected(f_frames == "below") + ">" + i18n["The bottom side only"] + "</option> \
+                <option value='hsides'" + selected(f_frames == "hsides") + ">" + i18n["The top and bottom sides only"] + "</option> \
+                <option value='vsides'" + selected(f_frames == "vsides") + ">" + i18n["The right and left sides only"] + "</option> \
+                <option value='lhs'" + selected(f_frames == "lhs") + ">" + i18n["The left-hand side only"] + "</option> \
+                <option value='rhs'" + selected(f_frames == "rhs") + ">" + i18n["The right-hand side only"] + "</option> \
+                <option value='box'" + selected(f_frames == "box") + ">" + i18n["All four sides"] + "</option> \
+              </select> \
+            </td> \
+          </tr> \
+          <tr> \
+            <td class='label'>" + i18n["Rules"] + ":</td> \
+            <td> \
+              <select name='f_rules'> \
+                <option value='none'" + selected(f_rules == "none") + ">" + i18n["No rules"] + "</option> \
+                <option value='rows'" + selected(f_rules == "rows") + ">" + i18n["Rules will appear between rows only"] + "</option> \
+                <option value='cols'" + selected(f_rules == "cols") + ">" + i18n["Rules will appear between columns only"] + "</option> \
+                <option value='all'" + selected(f_rules == "all") + ">" + i18n["Rules will appear between all rows and columns"] + "</option> \
+              </select> \
+            </td> \
+          </tr> \
+        </table> \
+      </fieldset> \
+    </td> \
+  </tr> \
+  <tr> \
+    <td id='--HA-style'></td> \
+  </tr> \
+</table> \
+";
+		var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, table);
+		var p = dialog.doc.getElementById("--HA-style");
+		p.appendChild(st_prop);
+		var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, table);
+		p = dialog.doc.getElementById("--HA-layout");
+		p.appendChild(st_layout);
+		dialog.modal = true;
+		dialog.addButtons("ok", "cancel");
+		dialog.showAtElement(dialog.editor._iframe, "c");
+	});
+};
+
+// this function requires the file PopupDiv/PopupWin to be loaded from browser
+TableOperations.prototype.dialogRowCellProperties = function(cell) {
+	var i18n = TableOperations.I18N;
+	// retrieve existing values
+	var element = this.getClosest(cell ? "td" : "tr");
+	var table = this.getClosest("table");
+	// this.editor.selectNodeContents(element);
+	// this.editor.updateToolbar();
+
+	var dialog = new PopupWin(this.editor, i18n[cell ? "Cell Properties" : "Row Properties"], function(dialog, params) {
+		TableOperations.processStyle(params, element);
+		for (var i in params) {
+			var val = params[i];
+			switch (i) {
+			    case "f_align":
+				element.align = val;
+				break;
+			    case "f_char":
+				element.ch = val;
+				break;
+			    case "f_valign":
+				element.vAlign = val;
+				break;
+			}
+		}
+		// various workarounds to refresh the table display (Gecko,
+		// what's going on?! do not disappoint me!)
+		dialog.editor.forceRedraw();
+		dialog.editor.focusEditor();
+		dialog.editor.updateToolbar();
+		var save_collapse = table.style.borderCollapse;
+		table.style.borderCollapse = "collapse";
+		table.style.borderCollapse = "separate";
+		table.style.borderCollapse = save_collapse;
+	},
+
+	// this function gets called when the dialog needs to be initialized
+	function (dialog) {
+
+		var f_align = element.align;
+		var f_valign = element.vAlign;
+		var f_char = element.ch;
+
+		function selected(val) {
+			return val ? " selected" : "";
+		};
+
+		// dialog contents
+		dialog.content.style.width = "400px";
+		dialog.content.innerHTML = " \
+<div class='title'\
+ style='background: url(" + dialog.baseURL + dialog.editor.imgURL(cell ? "cell-prop.gif" : "row-prop.gif", "TableOperations") + ") #fff 98% 50% no-repeat'>" + i18n[cell ? "Cell Properties" : "Row Properties"] + "</div> \
+<table style='width:100%'> \
+  <tr> \
+    <td id='--HA-layout'> \
+"+//      <fieldset><legend>" + i18n["Layout"] + "</legend> \
+//        <table style='width:100%'> \
+//         <tr> \
+//           <td class='label'>" + i18n["Align"] + ":</td> \
+//           <td> \
+//             <select name='f_align'> \
+//               <option value='left'" + selected(f_align == "left") + ">" + i18n["Left"] + "</option> \
+//               <option value='center'" + selected(f_align == "center") + ">" + i18n["Center"] + "</option> \
+//               <option value='right'" + selected(f_align == "right") + ">" + i18n["Right"] + "</option> \
+//               <option value='char'" + selected(f_align == "char") + ">" + i18n["Char"] + "</option> \
+//             </select> \
+//             &nbsp;&nbsp;" + i18n["Char"] + ": \
+//             <input type='text' style='font-family: monospace; text-align: center' name='f_char' size='1' value='" + f_char + "' /> \
+//           </td> \
+//         </tr><tr> \
+//           <td class='label'>" + i18n["Vertical align"] + ":</td> \
+//           <td> \
+//             <select name='f_valign'> \
+//               <option value='top'" + selected(f_valign == "top") + ">" + i18n["Top"] + "</option> \
+//               <option value='middle'" + selected(f_valign == "middle") + ">" + i18n["Middle"] + "</option> \
+//               <option value='bottom'" + selected(f_valign == "bottom") + ">" + i18n["Bottom"] + "</option> \
+//               <option value='baseline'" + selected(f_valign == "baseline") + ">" + i18n["Baseline"] + "</option> \
+//             </select> \
+//           </td> \
+//         </tr> \
+//        </table> \
+//       </fieldset> \
+"    </td> \
+  </tr> \
+  <tr> \
+    <td id='--HA-style'></td> \
+  </tr> \
+</table> \
+";
+		var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, element);
+		var p = dialog.doc.getElementById("--HA-style");
+		p.appendChild(st_prop);
+		var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, element);
+		p = dialog.doc.getElementById("--HA-layout");
+		p.appendChild(st_layout);
+		dialog.modal = true;
+		dialog.addButtons("ok", "cancel");
+		dialog.showAtElement(dialog.editor._iframe, "c");
+	});
+};
+
+// this function gets called when some button from the TableOperations toolbar
+// was pressed.
+TableOperations.prototype.buttonPress = function(editor, button_id) {
+	this.editor = editor;
+	var mozbr = HTMLArea.is_gecko ? "<br />" : "";
+	var i18n = TableOperations.I18N;
+
+	// helper function that clears the content in a table row
+	function clearRow(tr) {
+		var tds = tr.getElementsByTagName("td");
+		for (var i = tds.length; --i >= 0;) {
+			var td = tds[i];
+			td.rowSpan = 1;
+			td.innerHTML = mozbr;
+		}
+	};
+
+	function splitRow(td) {
+		var n = parseInt("" + td.rowSpan);
+		var nc = parseInt("" + td.colSpan);
+		td.rowSpan = 1;
+		tr = td.parentNode;
+		var itr = tr.rowIndex;
+		var trs = tr.parentNode.rows;
+		var index = td.cellIndex;
+		while (--n > 0) {
+			tr = trs[++itr];
+			var otd = editor._doc.createElement("td");
+			otd.colSpan = td.colSpan;
+			otd.innerHTML = mozbr;
+			tr.insertBefore(otd, tr.cells[index]);
+		}
+		editor.forceRedraw();
+		editor.updateToolbar();
+	};
+
+	function splitCol(td) {
+		var nc = parseInt("" + td.colSpan);
+		td.colSpan = 1;
+		tr = td.parentNode;
+		var ref = td.nextSibling;
+		while (--nc > 0) {
+			var otd = editor._doc.createElement("td");
+			otd.rowSpan = td.rowSpan;
+			otd.innerHTML = mozbr;
+			tr.insertBefore(otd, ref);
+		}
+		editor.forceRedraw();
+		editor.updateToolbar();
+	};
+
+	function splitCell(td) {
+		var nc = parseInt("" + td.colSpan);
+		splitCol(td);
+		var items = td.parentNode.cells;
+		var index = td.cellIndex;
+		while (nc-- > 0) {
+			splitRow(items[index++]);
+		}
+	};
+
+	function selectNextNode(el) {
+		var node = el.nextSibling;
+		while (node && node.nodeType != 1) {
+			node = node.nextSibling;
+		}
+		if (!node) {
+			node = el.previousSibling;
+			while (node && node.nodeType != 1) {
+				node = node.previousSibling;
+			}
+		}
+		if (!node) {
+			node = el.parentNode;
+		}
+		editor.selectNodeContents(node);
+	};
+
+	switch (button_id) {
+		// ROWS
+
+	    case "TO-row-insert-above":
+	    case "TO-row-insert-under":
+		var tr = this.getClosest("tr");
+		if (!tr) {
+			break;
+		}
+		var otr = tr.cloneNode(true);
+		clearRow(otr);
+		tr.parentNode.insertBefore(otr, /under/.test(button_id) ? tr.nextSibling : tr);
+		editor.forceRedraw();
+		editor.focusEditor();
+		break;
+	    case "TO-row-delete":
+		var tr = this.getClosest("tr");
+		if (!tr) {
+			break;
+		}
+		var par = tr.parentNode;
+		if (par.rows.length == 1) {
+			alert(i18n["not-del-last-row"]);
+			break;
+		}
+		// set the caret first to a position that doesn't
+		// disappear.
+		selectNextNode(tr);
+		par.removeChild(tr);
+		editor.forceRedraw();
+		editor.focusEditor();
+		editor.updateToolbar();
+		break;
+	    case "TO-row-split":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		splitRow(td);
+		break;
+
+		// COLUMNS
+
+	    case "TO-col-insert-before":
+	    case "TO-col-insert-after":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		var rows = td.parentNode.parentNode.rows;
+		var index = td.cellIndex;
+		for (var i = rows.length; --i >= 0;) {
+			var tr = rows[i];
+			var ref = tr.cells[index + (/after/.test(button_id) ? 1 : 0)];
+			var otd = editor._doc.createElement("td");
+			otd.innerHTML = mozbr;
+			tr.insertBefore(otd, ref);
+		}
+		editor.focusEditor();
+		break;
+	    case "TO-col-split":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		splitCol(td);
+		break;
+	    case "TO-col-delete":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		var index = td.cellIndex;
+		if (td.parentNode.cells.length == 1) {
+			alert(i18n["not-del-last-col"]);
+			break;
+		}
+		// set the caret first to a position that doesn't disappear
+		selectNextNode(td);
+		var rows = td.parentNode.parentNode.rows;
+		for (var i = rows.length; --i >= 0;) {
+			var tr = rows[i];
+			tr.removeChild(tr.cells[index]);
+		}
+		editor.forceRedraw();
+		editor.focusEditor();
+		editor.updateToolbar();
+		break;
+
+		// CELLS
+
+	    case "TO-cell-split":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		splitCell(td);
+		break;
+	    case "TO-cell-insert-before":
+	    case "TO-cell-insert-after":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		var tr = td.parentNode;
+		var otd = editor._doc.createElement("td");
+		otd.innerHTML = mozbr;
+		tr.insertBefore(otd, /after/.test(button_id) ? td.nextSibling : td);
+		editor.forceRedraw();
+		editor.focusEditor();
+		break;
+	    case "TO-cell-delete":
+		var td = this.getClosest("td");
+		if (!td) {
+			break;
+		}
+		if (td.parentNode.cells.length == 1) {
+			alert(i18n["not-del-last-cell"]);
+			break;
+		}
+		// set the caret first to a position that doesn't disappear
+		selectNextNode(td);
+		td.parentNode.removeChild(td);
+		editor.forceRedraw();
+		editor.updateToolbar();
+		break;
+	    case "TO-cell-merge":
+		// !! FIXME: Mozilla specific !!
+		var sel = editor._getSelection();
+		var range, i = 0;
+		var rows = [];
+		var row = null;
+		var cells = null;
+		if (!HTMLArea.is_ie) {
+			try {
+				while (range = sel.getRangeAt(i++)) {
+					var td = range.startContainer.childNodes[range.startOffset];
+					if (td.parentNode != row) {
+						row = td.parentNode;
+						(cells) && rows.push(cells);
+						cells = [];
+					}
+					cells.push(td);
+				}
+			} catch(e) {/* finished walking through selection */}
+			rows.push(cells);
+		} else {
+			// Internet Explorer "browser"
+			var td = this.getClosest("td");
+			if (!td) {
+				alert(i18n["Please click into some cell"]);
+				break;
+			}
+			var tr = td.parentElement;
+			var no_cols = prompt(i18n["How many columns would you like to merge?"], 2);
+			if (!no_cols) {
+				// cancelled
+				break;
+			}
+			var no_rows = prompt(i18n["How many rows would you like to merge?"], 2);
+			if (!no_rows) {
+				// cancelled
+				break;
+			}
+			var cell_index = td.cellIndex;
+			while (no_rows-- > 0) {
+				td = tr.cells[cell_index];
+				cells = [td];
+				for (var i = 1; i < no_cols; ++i) {
+					td = td.nextSibling;
+					if (!td) {
+						break;
+					}
+					cells.push(td);
+				}
+				rows.push(cells);
+				tr = tr.nextSibling;
+				if (!tr) {
+					break;
+				}
+			}
+		}
+		var HTML = "";
+		for (i = 0; i < rows.length; ++i) {
+			// i && (HTML += "<br />");
+			var cells = rows[i];
+			for (var j = 0; j < cells.length; ++j) {
+				// j && (HTML += "&nbsp;");
+				var cell = cells[j];
+				HTML += cell.innerHTML;
+				(i || j) && (cell.parentNode.removeChild(cell));
+			}
+		}
+		var td = rows[0][0];
+		td.innerHTML = HTML;
+		td.rowSpan = rows.length;
+		td.colSpan = rows[0].length;
+		editor.selectNodeContents(td);
+		editor.forceRedraw();
+		editor.focusEditor();
+		break;
+
+		// PROPERTIES
+
+	    case "TO-table-prop":
+		this.dialogTableProperties();
+		break;
+
+	    case "TO-row-prop":
+		this.dialogRowCellProperties(false);
+		break;
+
+	    case "TO-cell-prop":
+		this.dialogRowCellProperties(true);
+		break;
+
+	    default:
+		alert("Button [" + button_id + "] not yet implemented");
+	}
+};
+
+// the list of buttons added by this plugin
+TableOperations.btnList = [
+	// table properties button
+	["table-prop",       "table"],
+	null,			// separator
+
+	// ROWS
+	["row-prop",         "tr"],
+	["row-insert-above", "tr"],
+	["row-insert-under", "tr"],
+	["row-delete",       "tr"],
+	["row-split",        "td[rowSpan!=1]"],
+	null,
+
+	// COLS
+	["col-insert-before", "td"],
+	["col-insert-after",  "td"],
+	["col-delete",        "td"],
+	["col-split",         "td[colSpan!=1]"],
+	null,
+
+	// CELLS
+	["cell-prop",          "td"],
+	["cell-insert-before", "td"],
+	["cell-insert-after",  "td"],
+	["cell-delete",        "td"],
+	["cell-merge",         "tr"],
+	["cell-split",         "td[colSpan!=1,rowSpan!=1]"]
+	];
+
+
+
+//// GENERIC CODE [style of any element; this should be moved into a separate
+//// file as it'll be very useful]
+//// BEGIN GENERIC CODE -----------------------------------------------------
+
+TableOperations.getLength = function(value) {
+	var len = parseInt(value);
+	if (isNaN(len)) {
+		len = "";
+	}
+	return len;
+};
+
+// Applies the style found in "params" to the given element.
+TableOperations.processStyle = function(params, element) {
+	var style = element.style;
+	for (var i in params) {
+		var val = params[i];
+		switch (i) {
+		    case "f_st_backgroundColor":
+			style.backgroundColor = val;
+			break;
+		    case "f_st_color":
+			style.color = val;
+			break;
+		    case "f_st_backgroundImage":
+			if (/\S/.test(val)) {
+				style.backgroundImage = "url(" + val + ")";
+			} else {
+				style.backgroundImage = "none";
+			}
+			break;
+		    case "f_st_borderWidth":
+			style.borderWidth = val;
+			break;
+		    case "f_st_borderStyle":
+			style.borderStyle = val;
+			break;
+		    case "f_st_borderColor":
+			style.borderColor = val;
+			break;
+		    case "f_st_borderCollapse":
+			style.borderCollapse = val ? "collapse" : "";
+			break;
+		    case "f_st_width":
+			if (/\S/.test(val)) {
+				style.width = val + params["f_st_widthUnit"];
+			} else {
+				style.width = "";
+			}
+			break;
+		    case "f_st_height":
+			if (/\S/.test(val)) {
+				style.height = val + params["f_st_heightUnit"];
+			} else {
+				style.height = "";
+			}
+			break;
+		    case "f_st_textAlign":
+			if (val == "char") {
+				var ch = params["f_st_textAlignChar"];
+				if (ch == '"') {
+					ch = '\\"';
+				}
+				style.textAlign = '"' + ch + '"';
+			} else {
+				style.textAlign = val;
+			}
+			break;
+		    case "f_st_verticalAlign":
+			style.verticalAlign = val;
+			break;
+		    case "f_st_float":
+			style.cssFloat = val;
+			break;
+// 		    case "f_st_margin":
+// 			style.margin = val + "px";
+// 			break;
+// 		    case "f_st_padding":
+// 			style.padding = val + "px";
+// 			break;
+		}
+	}
+};
+
+// Returns an HTML element for a widget that allows color selection.  That is,
+// a button that contains the given color, if any, and when pressed will popup
+// the sooner-or-later-to-be-rewritten select_color.html dialog allowing user
+// to select some color.  If a color is selected, an input field with the name
+// "f_st_"+name will be updated with the color value in #123456 format.
+TableOperations.createColorButton = function(doc, editor, color, name) {
+	if (!color) {
+		color = "";
+	} else if (!/#/.test(color)) {
+		color = HTMLArea._colorToRgb(color);
+	}
+
+	var df = doc.createElement("span");
+ 	var field = doc.createElement("input");
+	field.type = "hidden";
+	df.appendChild(field);
+ 	field.name = "f_st_" + name;
+	field.value = color;
+	var button = doc.createElement("span");
+	button.className = "buttonColor";
+	df.appendChild(button);
+	var span = doc.createElement("span");
+	span.className = "chooser";
+	// span.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
+	span.style.backgroundColor = color;
+	button.appendChild(span);
+	button.onmouseover = function() { if (!this.disabled) { this.className += " buttonColor-hilite"; }};
+	button.onmouseout = function() { if (!this.disabled) { this.className = "buttonColor"; }};
+	span.onclick = function() {
+		if (this.parentNode.disabled) {
+			return false;
+		}
+		editor._popupDialog("select_color.html", function(color) {
+			if (color) {
+				span.style.backgroundColor = "#" + color;
+				field.value = "#" + color;
+			}
+		}, color);
+	};
+	var span2 = doc.createElement("span");
+	span2.innerHTML = "&#x00d7;";
+	span2.className = "nocolor";
+	span2.title = TableOperations.I18N["Unset color"];
+	button.appendChild(span2);
+	span2.onmouseover = function() { if (!this.parentNode.disabled) { this.className += " nocolor-hilite"; }};
+	span2.onmouseout = function() { if (!this.parentNode.disabled) { this.className = "nocolor"; }};
+	span2.onclick = function() {
+		span.style.backgroundColor = "";
+		field.value = "";
+	};
+	return df;
+};
+
+TableOperations.createStyleLayoutFieldset = function(doc, editor, el) {
+	var i18n = TableOperations.I18N;
+	var fieldset = doc.createElement("fieldset");
+	var legend = doc.createElement("legend");
+	fieldset.appendChild(legend);
+	legend.innerHTML = i18n["Layout"];
+	var table = doc.createElement("table");
+	fieldset.appendChild(table);
+	table.style.width = "100%";
+	var tbody = doc.createElement("tbody");
+	table.appendChild(tbody);
+
+	var tagname = el.tagName.toLowerCase();
+	var tr, td, input, select, option, options, i;
+
+	if (tagname != "td" && tagname != "tr" && tagname != "th") {
+		tr = doc.createElement("tr");
+		tbody.appendChild(tr);
+		td = doc.createElement("td");
+		td.className = "label";
+		tr.appendChild(td);
+		td.innerHTML = i18n["Float"] + ":";
+		td = doc.createElement("td");
+		tr.appendChild(td);
+		select = doc.createElement("select");
+		td.appendChild(select);
+		select.name = "f_st_float";
+		options = ["None", "Left", "Right"];
+		for (i in options) {
+			var Val = options[i];
+			var val = options[i].toLowerCase();
+			option = doc.createElement("option");
+			option.innerHTML = i18n[Val];
+			option.value = val;
+			option.selected = (("" + el.style.cssFloat).toLowerCase() == val);
+			select.appendChild(option);
+		}
+	}
+
+	tr = doc.createElement("tr");
+	tbody.appendChild(tr);
+	td = doc.createElement("td");
+	td.className = "label";
+	tr.appendChild(td);
+	td.innerHTML = i18n["Width"] + ":";
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	input = doc.createElement("input");
+	input.type = "text";
+	input.value = TableOperations.getLength(el.style.width);
+	input.size = "5";
+	input.name = "f_st_width";
+	input.style.marginRight = "0.5em";
+	td.appendChild(input);
+	select = doc.createElement("select");
+	select.name = "f_st_widthUnit";
+	option = doc.createElement("option");
+	option.innerHTML = i18n["percent"];
+	option.value = "%";
+	option.selected = /%/.test(el.style.width);
+	select.appendChild(option);
+	option = doc.createElement("option");
+	option.innerHTML = i18n["pixels"];
+	option.value = "px";
+	option.selected = /px/.test(el.style.width);
+	select.appendChild(option);
+	td.appendChild(select);
+
+	select.style.marginRight = "0.5em";
+	td.appendChild(doc.createTextNode(i18n["Text align"] + ":"));
+	select = doc.createElement("select");
+	select.style.marginLeft = select.style.marginRight = "0.5em";
+	td.appendChild(select);
+	select.name = "f_st_textAlign";
+	options = ["Left", "Center", "Right", "Justify"];
+	if (tagname == "td") {
+		options.push("Char");
+	}
+	input = doc.createElement("input");
+	input.name = "f_st_textAlignChar";
+	input.size = "1";
+	input.style.fontFamily = "monospace";
+	td.appendChild(input);
+	for (i in options) {
+		var Val = options[i];
+		var val = Val.toLowerCase();
+		option = doc.createElement("option");
+		option.value = val;
+		option.innerHTML = i18n[Val];
+		option.selected = (el.style.textAlign.toLowerCase() == val);
+		select.appendChild(option);
+	}
+	function setCharVisibility(value) {
+		input.style.visibility = value ? "visible" : "hidden";
+		if (value) {
+			input.focus();
+			input.select();
+		}
+	};
+	select.onchange = function() { setCharVisibility(this.value == "char"); };
+	setCharVisibility(select.value == "char");
+
+	tr = doc.createElement("tr");
+	tbody.appendChild(tr);
+	td = doc.createElement("td");
+	td.className = "label";
+	tr.appendChild(td);
+	td.innerHTML = i18n["Height"] + ":";
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	input = doc.createElement("input");
+	input.type = "text";
+	input.value = TableOperations.getLength(el.style.height);
+	input.size = "5";
+	input.name = "f_st_height";
+	input.style.marginRight = "0.5em";
+	td.appendChild(input);
+	select = doc.createElement("select");
+	select.name = "f_st_heightUnit";
+	option = doc.createElement("option");
+	option.innerHTML = i18n["percent"];
+	option.value = "%";
+	option.selected = /%/.test(el.style.height);
+	select.appendChild(option);
+	option = doc.createElement("option");
+	option.innerHTML = i18n["pixels"];
+	option.value = "px";
+	option.selected = /px/.test(el.style.height);
+	select.appendChild(option);
+	td.appendChild(select);
+
+	select.style.marginRight = "0.5em";
+	td.appendChild(doc.createTextNode(i18n["Vertical align"] + ":"));
+	select = doc.createElement("select");
+	select.name = "f_st_verticalAlign";
+	select.style.marginLeft = "0.5em";
+	td.appendChild(select);
+	options = ["Top", "Middle", "Bottom", "Baseline"];
+	for (i in options) {
+		var Val = options[i];
+		var val = Val.toLowerCase();
+		option = doc.createElement("option");
+		option.value = val;
+		option.innerHTML = i18n[Val];
+		option.selected = (el.style.verticalAlign.toLowerCase() == val);
+		select.appendChild(option);
+	}
+
+	return fieldset;
+};
+
+// Returns an HTML element containing the style attributes for the given
+// element.  This can be easily embedded into any dialog; the functionality is
+// also provided.
+TableOperations.createStyleFieldset = function(doc, editor, el) {
+	var i18n = TableOperations.I18N;
+	var fieldset = doc.createElement("fieldset");
+	var legend = doc.createElement("legend");
+	fieldset.appendChild(legend);
+	legend.innerHTML = i18n["CSS Style"];
+	var table = doc.createElement("table");
+	fieldset.appendChild(table);
+	table.style.width = "100%";
+	var tbody = doc.createElement("tbody");
+	table.appendChild(tbody);
+
+	var tr, td, input, select, option, options, i;
+
+	tr = doc.createElement("tr");
+	tbody.appendChild(tr);
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	td.className = "label";
+	td.innerHTML = i18n["Background"] + ":";
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	var df = TableOperations.createColorButton(doc, editor, el.style.backgroundColor, "backgroundColor");
+	df.firstChild.nextSibling.style.marginRight = "0.5em";
+	td.appendChild(df);
+	td.appendChild(doc.createTextNode(i18n["Image URL"] + ": "));
+	input = doc.createElement("input");
+	input.type = "text";
+	input.name = "f_st_backgroundImage";
+	if (el.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)) {
+		input.value = RegExp.$1;
+	}
+	// input.style.width = "100%";
+	td.appendChild(input);
+
+	tr = doc.createElement("tr");
+	tbody.appendChild(tr);
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	td.className = "label";
+	td.innerHTML = i18n["FG Color"] + ":";
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	td.appendChild(TableOperations.createColorButton(doc, editor, el.style.color, "color"));
+
+	// for better alignment we include an invisible field.
+	input = doc.createElement("input");
+	input.style.visibility = "hidden";
+	input.type = "text";
+	td.appendChild(input);
+
+	tr = doc.createElement("tr");
+	tbody.appendChild(tr);
+	td = doc.createElement("td");
+	tr.appendChild(td);
+	td.className = "label";
+	td.innerHTML = i18n["Border"] + ":";
+	td = doc.createElement("td");
+	tr.appendChild(td);
+
+	var colorButton = TableOperations.createColorButton(doc, editor, el.style.borderColor, "borderColor");
+	var btn = colorButton.firstChild.nextSibling;
+	td.appendChild(colorButton);
+	// borderFields.push(btn);
+	btn.style.marginRight = "0.5em";
+
+	select = doc.createElement("select");
+	var borderFields = [];
+	td.appendChild(select);
+	select.name = "f_st_borderStyle";
+	options = ["none", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"];
+	var currentBorderStyle = el.style.borderStyle;
+	// Gecko reports "solid solid solid solid" for "border-style: solid".
+	// That is, "top right bottom left" -- we only consider the first
+	// value.
+	(currentBorderStyle.match(/([^\s]*)\s/)) && (currentBorderStyle = RegExp.$1);
+	for (i in options) {
+		var val = options[i];
+		option = doc.createElement("option");
+		option.value = val;
+		option.innerHTML = val;
+		(val == currentBorderStyle) && (option.selected = true);
+		select.appendChild(option);
+	}
+	select.style.marginRight = "0.5em";
+	function setBorderFieldsStatus(value) {
+		for (i in borderFields) {
+			var el = borderFields[i];
+			el.style.visibility = value ? "hidden" : "visible";
+			if (!value && (el.tagName.toLowerCase() == "input")) {
+				el.focus();
+				el.select();
+			}
+		}
+	};
+	select.onchange = function() { setBorderFieldsStatus(this.value == "none"); };
+
+	input = doc.createElement("input");
+	borderFields.push(input);
+	input.type = "text";
+	input.name = "f_st_borderWidth";
+	input.value = TableOperations.getLength(el.style.borderWidth);
+	input.size = "5";
+	td.appendChild(input);
+	input.style.marginRight = "0.5em";
+	var span = doc.createElement("span");
+	span.innerHTML = i18n["pixels"];
+	td.appendChild(span);
+	borderFields.push(span);
+
+	setBorderFieldsStatus(select.value == "none");
+
+	if (el.tagName.toLowerCase() == "table") {
+		// the border-collapse style is only for tables
+		tr = doc.createElement("tr");
+		tbody.appendChild(tr);
+		td = doc.createElement("td");
+		td.className = "label";
+		tr.appendChild(td);
+		input = doc.createElement("input");
+		input.type = "checkbox";
+		input.name = "f_st_borderCollapse";
+		input.id = "f_st_borderCollapse";
+		var val = (/collapse/i.test(el.style.borderCollapse));
+		input.checked = val ? 1 : 0;
+		td.appendChild(input);
+
+		td = doc.createElement("td");
+		tr.appendChild(td);
+		var label = doc.createElement("label");
+		label.htmlFor = "f_st_borderCollapse";
+		label.innerHTML = i18n["Collapsed borders"];
+		td.appendChild(label);
+	}
+
+// 	tr = doc.createElement("tr");
+// 	tbody.appendChild(tr);
+// 	td = doc.createElement("td");
+// 	td.className = "label";
+// 	tr.appendChild(td);
+// 	td.innerHTML = i18n["Margin"] + ":";
+// 	td = doc.createElement("td");
+// 	tr.appendChild(td);
+// 	input = doc.createElement("input");
+// 	input.type = "text";
+// 	input.size = "5";
+// 	input.name = "f_st_margin";
+// 	td.appendChild(input);
+// 	input.style.marginRight = "0.5em";
+// 	td.appendChild(doc.createTextNode(i18n["Padding"] + ":"));
+
+// 	input = doc.createElement("input");
+// 	input.type = "text";
+// 	input.size = "5";
+// 	input.name = "f_st_padding";
+// 	td.appendChild(input);
+// 	input.style.marginLeft = "0.5em";
+// 	input.style.marginRight = "0.5em";
+// 	td.appendChild(doc.createTextNode(i18n["pixels"]));
+
+	return fieldset;
+};
+
+//// END GENERIC CODE -------------------------------------------------------
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/lang/ro.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/lang/ro.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/lang/ro.js	(revision 1328)
@@ -0,0 +1,25 @@
+// I18N for the FullPage plugin
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+FullPage.I18N = {
+	"Alternate style-sheet:":		"Template CSS alternativ:",
+	"Background color:":			"Culoare de fundal:",
+	"Cancel":				"Renunţă",
+	"DOCTYPE:":				"DOCTYPE:",
+	"Document properties":			"Proprietăţile documentului",
+	"Document title:":			"Titlul documentului:",
+	"OK":					"Acceptă",
+	"Primary style-sheet:":			"Template CSS principal:",
+	"Text color:":				"Culoare text:"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/lang/en.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/lang/en.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/lang/en.js	(revision 1328)
@@ -0,0 +1,25 @@
+// I18N for the FullPage plugin
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+FullPage.I18N = {
+	"Alternate style-sheet:":		"Alternate style-sheet:",
+	"Background color:":			"Background color:",
+	"Cancel":				"Cancel",
+	"DOCTYPE:":				"DOCTYPE:",
+	"Document properties":			"Document properties",
+	"Document title:":			"Document title:",
+	"OK":					"OK",
+	"Primary style-sheet:":			"Primary style-sheet:",
+	"Text color:":				"Text color:"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/test.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/test.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/test.html	(revision 1328)
@@ -0,0 +1,89 @@
+<html>
+  <head>
+    <title>Test of FullPage plugin</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <script type="text/javascript">
+      _editor_url = "../../";
+    </script>
+
+    <!-- load the main HTMLArea files -->
+    <script type="text/javascript" src="../../htmlarea.js"></script>
+    <script type="text/javascript" src="../../lang/en.js"></script>
+    <script type="text/javascript" src="../../dialog.js"></script>
+
+    <!-- <script type="text/javascript" src="popupdiv.js"></script> -->
+    <script type="text/javascript" src="../../popupwin.js"></script>
+
+    <script type="text/javascript">
+      HTMLArea.loadPlugin("TableOperations");
+      HTMLArea.loadPlugin("SpellChecker");
+      HTMLArea.loadPlugin("FullPage");
+
+      function initDocument() {
+        var editor = new HTMLArea("editor");
+        editor.registerPlugin(TableOperations);
+        editor.registerPlugin(SpellChecker);
+        editor.registerPlugin(FullPage);
+        editor.generate();
+      }
+    </script>
+
+    <style type="text/css">
+      @import url(../../htmlarea.css);
+    </style>
+
+  </head>
+
+  <body onload="initDocument()">
+    <h1>Test of FullPage plugin</h1>
+
+    <textarea id="editor" style="height: 30em; width: 100%;">
+      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
+      &lt;html&gt;
+        &lt;head&gt;
+          &lt;title&gt;FullPage plugin for HTMLArea&lt;/title&gt;
+          &lt;link rel="alternate stylesheet" href="http://dynarch.com/mishoo/css/dark.css" /&gt;
+          &lt;link rel="stylesheet" href="http://dynarch.com/mishoo/css/cool-light.css" /&gt;
+        &lt;/head&gt;
+        &lt;body style="background-color: #ddddee; color: #000077;"&gt;
+          &lt;table style="width:60%; height: 90%; margin: 2% auto 1% auto;" align="center" border="0" cellpadding="0" cellspacing="0"&gt;
+            &lt;tr&gt;
+              &lt;td style="background-color: #ddeedd; border: 2px solid #002; height: 1.5em; padding: 2px; font: bold 24px Verdana;"&gt;
+                FullPage plugin
+              &lt;/td&gt;
+            &lt;/tr&gt;
+            &lt;tr&gt;
+              &lt;td style="background-color: #fff; border: 1px solid #aab; padding: 1em 3em; font: 12px Verdana;"&gt;
+                &lt;p&gt;
+                  This plugin enables one to edit a full HTML file in &lt;a
+                    href="http://dynarch.com/htmlarea/"&gt;HTMLArea&lt;/a&gt;.  This is not
+                  normally possible with just the core editor since it only
+                  retrieves the HTML inside the &lt;code&gt;body&lt;/code&gt; tag.
+                &lt;/p&gt;
+                &lt;p&gt;
+                  It provides the ability to change the &lt;code&gt;DOCTYPE&lt;/code&gt; of
+                  the document, &lt;code&gt;body&lt;/code&gt; &lt;code&gt;bgcolor&lt;/code&gt; and
+                  &lt;code&gt;fgcolor&lt;/code&gt; attributes as well as to add additional
+                  &lt;code&gt;link&lt;/code&gt;-ed stylesheets.  Cool, eh?
+                &lt;/p&gt;
+                &lt;p&gt;
+                  The development of this plugin was initiated and sponsored by
+                  &lt;a href="http://thycotic.com"&gt;Thycotic Software Ltd.&lt;/a&gt;.
+                  That's also cool, isn't it? ;-)
+                &lt;/p&gt;
+              &lt;/td&gt;
+            &lt;/tr&gt;
+          &lt;/table&gt;
+        &lt;/body&gt;
+      &lt;/html&gt;
+    </textarea>
+
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Wed Oct  1 19:55:37 EEST 2003 -->
+<!-- hhmts start -->
+Last modified on Sat Oct 25 01:06:59 2003
+<!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/popups/docprop.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/popups/docprop.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/popups/docprop.html	(revision 1328)
@@ -0,0 +1,131 @@
+<html>
+
+<head>
+  <title>Document properties</title>
+
+<script type="text/javascript" src="../../../popups/popup.js"></script>
+
+<script type="text/javascript">
+
+FullPage = window.opener.FullPage; // load the FullPage plugin and lang file ;-)
+window.resizeTo(400, 100);
+
+  var accepted = {
+      f_doctype       : true,
+      f_title         : true,
+      f_body_bgcolor  : true,
+      f_body_fgcolor  : true,
+      f_base_style    : true,
+      f_alt_style     : true
+  };
+
+var editor = null;
+function Init() {
+  __dlg_translate(FullPage.I18N);
+  __dlg_init();
+  var params = window.dialogArguments;
+  for (var i in params) {
+      if (i in accepted) {
+        var el = document.getElementById(i);
+        el.value = params[i];
+      }
+  }
+  editor = params.editor;
+  document.getElementById("f_title").focus();
+  document.getElementById("f_title").select();
+};
+
+function onOK() {
+  var required = {
+  };
+  for (var i in required) {
+    var el = document.getElementById(i);
+    if (!el.value) {
+      alert(required[i]);
+      el.focus();
+      return false;
+    }
+  }
+
+  var param = {};
+  for (var i in accepted) {
+    var el = document.getElementById(i);
+    param[i] = el.value;
+  }
+  __dlg_close(param);
+  return false;
+};
+
+function onCancel() {
+  __dlg_close(null);
+  return false;
+};
+
+</script>
+
+<style type="text/css">
+html, body {
+  background: ButtonFace;
+  color: ButtonText;
+  font: 11px Tahoma,Verdana,sans-serif;
+  margin: 0px;
+  padding: 0px;
+}
+body { padding: 5px; }
+table {
+  font: 11px Tahoma,Verdana,sans-serif;
+}
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+button { width: 70px; }
+table .label { text-align: right; width: 12em; }
+
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+border-bottom: 1px solid black; letter-spacing: 2px;
+}
+
+#buttons {
+      margin-top: 1em; border-top: 1px solid #999;
+      padding: 2px; text-align: right;
+}
+</style>
+
+  </head>
+
+  <body onload="Init()">
+
+    <div class="title"><span>Document properties</span></div>
+
+    <table style="width: 100%">
+      <tr>
+        <td class="label"><span>Document title:</span></td>
+        <td><input type="text" id="f_title" style="width: 100%" /></td>
+      </tr>
+      <tr>
+        <td class="label"><span>DOCTYPE:</span></td>
+        <td><input type="text" id="f_doctype" style="width: 100%" /></td>
+      </tr>
+      <tr>
+        <td class="label"><span>Primary style-sheet:</span></td>
+        <td><input type="text" id="f_base_style" style="width: 100%" /></td>
+      </tr>
+      <tr>
+        <td class="label"><span>Alternate style-sheet:</span></td>
+        <td><input type="text" id="f_alt_style" style="width: 100%" /></td>
+      </tr>
+      <tr>
+        <td class="label"><span>Background color:</span></td>
+        <td><input type="text" id="f_body_bgcolor" size="7" /></td>
+      </tr>
+      <tr>
+        <td class="label"><span>Text color:</span></td>
+        <td><input type="text" id="f_body_fgcolor" size="7" /></td>
+      </tr>
+    </table>
+
+    <div id="buttons">
+      <button type="button" name="ok" onclick="return onOK();"><span>OK</span></button>
+      <button type="button" name="cancel" onclick="return onCancel();"><span>Cancel</span></button>
+    </div>
+
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/full-page.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/full-page.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/FullPage/full-page.js	(revision 1328)
@@ -0,0 +1,143 @@
+// FullPage Plugin for HTMLArea-3.0
+// Implementation by Mihai Bazon.  Sponsored by http://thycotic.com
+//
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
+// This notice MUST stay intact for use (see license.txt).
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon for InteractiveTools.
+//   http://dynarch.com/mishoo
+//
+// $Id$
+
+function FullPage(editor) {
+	this.editor = editor;
+
+	var cfg = editor.config;
+	cfg.fullPage = true;
+	var tt = FullPage.I18N;
+	var self = this;
+
+	cfg.registerButton("FP-docprop", tt["Document properties"], editor.imgURL("docprop.gif", "FullPage"), false,
+			   function(editor, id) {
+				   self.buttonPress(editor, id);
+			   });
+
+	// add a new line in the toolbar
+	cfg.toolbar[0].splice(0, 0, "separator");
+	cfg.toolbar[0].splice(0, 0, "FP-docprop");
+};
+
+FullPage._pluginInfo = {
+	name          : "FullPage",
+	version       : "1.0",
+	developer     : "Mihai Bazon",
+	developer_url : "http://dynarch.com/mishoo/",
+	c_owner       : "Mihai Bazon",
+	sponsor       : "Thycotic Software Ltd.",
+	sponsor_url   : "http://thycotic.com",
+	license       : "htmlArea"
+};
+
+FullPage.prototype.buttonPress = function(editor, id) {
+	var self = this;
+	switch (id) {
+	    case "FP-docprop":
+		var doc = editor._doc;
+		var links = doc.getElementsByTagName("link");
+		var style1 = '';
+		var style2 = '';
+		for (var i = links.length; --i >= 0;) {
+			var link = links[i];
+			if (/stylesheet/i.test(link.rel)) {
+				if (/alternate/i.test(link.rel))
+					style2 = link.href;
+				else
+					style1 = link.href;
+			}
+		}
+		var title = doc.getElementsByTagName("title")[0];
+		title = title ? title.innerHTML : '';
+		var init = {
+			f_doctype      : editor.doctype,
+			f_title        : title,
+			f_body_bgcolor : HTMLArea._colorToRgb(doc.body.style.backgroundColor),
+			f_body_fgcolor : HTMLArea._colorToRgb(doc.body.style.color),
+			f_base_style   : style1,
+			f_alt_style    : style2,
+
+			editor         : editor
+		};
+		editor._popupDialog("plugin://FullPage/docprop", function(params) {
+			self.setDocProp(params);
+		}, init);
+		break;
+	}
+};
+
+FullPage.prototype.setDocProp = function(params) {
+	var txt = "";
+	var doc = this.editor._doc;
+	var head = doc.getElementsByTagName("head")[0];
+	var links = doc.getElementsByTagName("link");
+	var style1 = null;
+	var style2 = null;
+	for (var i = links.length; --i >= 0;) {
+		var link = links[i];
+		if (/stylesheet/i.test(link.rel)) {
+			if (/alternate/i.test(link.rel))
+				style2 = link;
+			else
+				style1 = link;
+		}
+	}
+	function createLink(alt) {
+		var link = doc.createElement("link");
+		link.rel = alt ? "alternate stylesheet" : "stylesheet";
+		head.appendChild(link);
+		return link;
+	};
+
+	if (!style1 && params.f_base_style)
+		style1 = createLink(false);
+	if (params.f_base_style)
+		style1.href = params.f_base_style;
+	else if (style1)
+		head.removeChild(style1);
+
+	if (!style2 && params.f_alt_style)
+		style2 = createLink(true);
+	if (params.f_alt_style)
+		style2.href = params.f_alt_style;
+	else if (style2)
+		head.removeChild(style2);
+
+	for (var i in params) {
+		var val = params[i];
+		switch (i) {
+		    case "f_title":
+			var title = doc.getElementsByTagName("title")[0];
+			if (!title) {
+				title = doc.createElement("title");
+				head.appendChild(title);
+			} else while (node = title.lastChild)
+				title.removeChild(node);
+			if (!HTMLArea.is_ie)
+				title.appendChild(doc.createTextNode(val));
+			else
+				doc.title = val;
+			break;
+		    case "f_doctype":
+			this.editor.setDoctype(val);
+			break;
+		    case "f_body_bgcolor":
+			doc.body.style.backgroundColor = val;
+			break;
+		    case "f_body_fgcolor":
+			doc.body.style.color = val;
+			break;
+		}
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-check-ui.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-check-ui.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-check-ui.html	(revision 1328)
@@ -0,0 +1,122 @@
+<!--
+
+  Strangely, IE sucks with or without the DOCTYPE switch.
+  I thought it would only suck without it.
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+
+   Spell Checker Plugin for HTMLArea-3.0
+   Sponsored by www.americanbible.org
+   Implementation by Mihai Bazon, http://dynarch.com/mishoo/
+  
+   (c) dynarch.com 2003.
+   Distributed under the same terms as HTMLArea itself.
+   This notice MUST stay intact for use (see license.txt).
+
+   $Id$
+
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+  <head>
+    <title>Spell Checker</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <script type="text/javascript" src="spell-check-ui.js"></script>
+
+    <style type="text/css">
+      html, body { height: 100%; margin: 0px; padding: 0px; background-color: #fff;
+      color: #000; }
+      a:link, a:visited { color: #00f; text-decoration: none; }
+      a:hover { color: #f00; text-decoration: underline; }
+
+      table { background-color: ButtonFace; color: ButtonText;
+      font-family: tahoma,verdana,sans-serif; font-size: 11px; }
+
+      iframe { background-color: #fff; color: #000; height: 100%; width: 100%; }
+
+      .controls { width: 13em; }
+      .controls .sectitle { /* background-color: #736c6c; color: #fff;
+      border-top: 1px solid #000; border-bottom: 1px solid #fff; */
+      text-align: center;
+      font-weight: bold; padding: 2px 4px; }
+      .controls .secbody { margin-bottom: 10px; }
+
+      button, select { font-family: tahoma,verdana,sans-serif; font-size: 11px; }
+      button { width: 6em; padding: 0px; }
+
+      input, select { font-family: fixed,"andale mono",monospace; }
+
+      #v_currentWord { color: #f00; font-weight: bold; }
+      #statusbar { padding: 7px 0px 0px 5px; }
+      #status { font-weight: bold; }
+    </style>
+
+  </head>
+
+  <body onload="initDocument()">
+
+    <form style="display: none;" action="spell-check-logic.cgi"
+          method="post" target="framecontent"
+          accept-charset="UTF-8"
+          ><input type="hidden" name="content" id="f_content"
+          /><input type="hidden" name="dictionary" id="f_dictionary"
+          /><input type="hidden" name="init" id="f_init" value="1"
+    /></form>
+
+    <table style="height: 100%; width: 100%; border-collapse: collapse;" cellspacing="0" cellpadding="0">
+      <tr>
+        <td colspan="2" style="height: 1em; padding: 2px;">
+          <div style="float: right; padding: 2px;"><span>Dictionary</span>
+            <select id="v_dictionaries" style="width: 10em"></select>
+            <button id="b_recheck">Re-check</button>
+          </div>
+          <span id="status">Please wait.  Calling spell checker.</span>
+        </td>
+      </tr>
+      <tr>
+        <td valign="top" class="controls">
+          <div class="secbody" style="text-align: center">
+            <button id="b_info">Info</button>
+          </div>
+          <div class="sectitle">Original word</div>
+          <div class="secbody" id="v_currentWord" style="text-align:
+          center; margin-bottom: 0px;">pliz weit ;-)</div>
+          <div class="secbody" style="text-align: center">
+            <button id="b_revert">Revert</button>
+          </div>
+          <div class="sectitle">Replace with</div>
+          <div class="secbody">
+            <input type="text" id="v_replacement" style="width: 94%; margin-left: 3%;" /><br />
+            <div style="text-align: center; margin-top: 2px;">
+              <button id="b_replace">Replace</button><button
+                id="b_replall">Replace all</button><br /><button
+                id="b_ignore">Ignore</button><button
+                id="b_ignall">Ignore all</button>
+            </div>
+          </div>
+          <div class="sectitle">Suggestions</div>
+          <div class="secbody">
+            <select size="11" style="width: 94%; margin-left: 3%;" id="v_suggestions"></select>
+          </div>
+        </td>
+
+        <td>
+          <iframe src="about:blank" width="100%" height="100%"
+            id="i_framecontent" name="framecontent"></iframe>
+        </td>
+      </tr>
+      <tr>
+        <td style="height: 1em;" colspan="2">
+          <div style="padding: 4px 2px 2px 2px; float: right;">
+            <button id="b_ok">OK</button>
+            <button id="b_cancel">Cancel</button>
+          </div>
+          <div id="statusbar"></div>
+        </td>
+      </tr>
+    </table>
+
+  </body>
+
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-checker.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-checker.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-checker.js	(revision 1328)
@@ -0,0 +1,79 @@
+// Spell Checker Plugin for HTMLArea-3.0
+// Sponsored by www.americanbible.org
+// Implementation by Mihai Bazon, http://dynarch.com/mishoo/
+//
+// (c) dynarch.com 2003.
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+//
+// $Id$
+
+function SpellChecker(editor) {
+	this.editor = editor;
+
+	var cfg = editor.config;
+	var tt = SpellChecker.I18N;
+	var bl = SpellChecker.btnList;
+	var self = this;
+
+	// register the toolbar buttons provided by this plugin
+	var toolbar = [];
+	for (var i in bl) {
+		var btn = bl[i];
+		if (!btn) {
+			toolbar.push("separator");
+		} else {
+			var id = "SC-" + btn[0];
+			cfg.registerButton(id, tt[id], editor.imgURL(btn[0] + ".gif", "SpellChecker"), false,
+					   function(editor, id) {
+						   // dispatch button press event
+						   self.buttonPress(editor, id);
+					   }, btn[1]);
+			toolbar.push(id);
+		}
+	}
+
+	for (var i in toolbar) {
+		cfg.toolbar[0].push(toolbar[i]);
+	}
+};
+
+SpellChecker._pluginInfo = {
+	name          : "SpellChecker",
+	version       : "1.0",
+	developer     : "Mihai Bazon",
+	developer_url : "http://dynarch.com/mishoo/",
+	c_owner       : "Mihai Bazon",
+	sponsor       : "American Bible Society",
+	sponsor_url   : "http://www.americanbible.org",
+	license       : "htmlArea"
+};
+
+SpellChecker.btnList = [
+	null, // separator
+	["spell-check"]
+	];
+
+SpellChecker.prototype.buttonPress = function(editor, id) {
+	switch (id) {
+	    case "SC-spell-check":
+		SpellChecker.editor = editor;
+		SpellChecker.init = true;
+		var uiurl = _editor_url + "plugins/SpellChecker/spell-check-ui.html";
+		var win;
+		if (HTMLArea.is_ie) {
+			win = window.open(uiurl, "SC_spell_checker",
+					  "toolbar=no,location=no,directories=no,status=no,menubar=no," +
+					  "scrollbars=no,resizable=yes,width=600,height=450");
+		} else {
+			win = window.open(uiurl, "SC_spell_checker",
+					  "toolbar=no,menubar=no,personalbar=no,width=600,height=450," +
+					  "scrollbars=no,resizable=yes");
+		}
+		win.focus();
+		break;
+	}
+};
+
+// this needs to be global, it's accessed from spell-check-ui.html
+SpellChecker.editor = null;
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-check-ui.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-check-ui.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/spell-check-ui.js	(revision 1328)
@@ -0,0 +1,397 @@
+// Spell Checker Plugin for HTMLArea-3.0
+// Sponsored by www.americanbible.org
+// Implementation by Mihai Bazon, http://dynarch.com/mishoo/
+//
+// (c) dynarch.com 2003.
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+//
+// $Id$
+
+// internationalization file was already loaded in parent ;-)
+var SpellChecker = window.opener.SpellChecker;
+var i18n = SpellChecker.I18N;
+
+var HTMLArea = window.opener.HTMLArea;
+var is_ie = HTMLArea.is_ie;
+var editor = SpellChecker.editor;
+var frame = null;
+var currentElement = null;
+var wrongWords = null;
+var modified = false;
+var allWords = {};
+var fixedWords = [];
+var suggested_words = {};
+
+function makeCleanDoc(leaveFixed) {
+	// document.getElementById("status").innerHTML = 'Please wait: rendering valid HTML';
+	var words = wrongWords.concat(fixedWords);
+	for (var i = words.length; --i >= 0;) {
+		var el = words[i];
+		if (!(leaveFixed && /HA-spellcheck-fixed/.test(el.className))) {
+			el.parentNode.insertBefore(el.firstChild, el);
+			el.parentNode.removeChild(el);
+		} else
+			el.className = "HA-spellcheck-fixed";
+	}
+	// we should use innerHTML here, but IE6's implementation fucks up the
+	// HTML to such extent that our poor Perl parser doesn't understand it
+	// anymore.
+	return window.opener.HTMLArea.getHTML(frame.contentWindow.document.body, false, editor);
+};
+
+function recheckClicked() {
+	document.getElementById("status").innerHTML = i18n["Please wait: changing dictionary to"] + ': "' + document.getElementById("f_dictionary").value + '".';
+	var field = document.getElementById("f_content");
+	field.value = makeCleanDoc(true);
+	field.form.submit();
+};
+
+function saveClicked() {
+	if (modified) {
+		editor.setHTML(makeCleanDoc(false));
+	}
+	window.close();
+	return false;
+};
+
+function cancelClicked() {
+	var ok = true;
+	if (modified) {
+		ok = confirm(i18n["QUIT_CONFIRMATION"]);
+	}
+	if (ok) {
+		window.close();
+	}
+	return false;
+};
+
+function replaceWord(el) {
+	var replacement = document.getElementById("v_replacement").value;
+	var this_word_modified = (el.innerHTML != replacement);
+	if (this_word_modified)
+		modified = true;
+	if (el) {
+		el.className = el.className.replace(/\s*HA-spellcheck-(hover|fixed)\s*/g, " ");
+	}
+	el.className += " HA-spellcheck-fixed";
+	el.__msh_fixed = true;
+	if (!this_word_modified) {
+		return false;
+	}
+	el.innerHTML = replacement;
+};
+
+function replaceClicked() {
+	replaceWord(currentElement);
+	var start = currentElement.__msh_id;
+	var index = start;
+	do {
+		++index;
+		if (index == wrongWords.length) {
+			index = 0;
+		}
+	} while ((index != start) && wrongWords[index].__msh_fixed);
+	if (index == start) {
+		index = 0;
+		alert(i18n["Finished list of mispelled words"]);
+	}
+	wrongWords[index].__msh_wordClicked(true);
+	return false;
+};
+
+function revertClicked() {
+	document.getElementById("v_replacement").value = currentElement.__msh_origWord;
+	replaceWord(currentElement);
+	currentElement.className = "HA-spellcheck-error HA-spellcheck-current";
+	return false;
+};
+
+function replaceAllClicked() {
+	var replacement = document.getElementById("v_replacement").value;
+	var ok = true;
+	var spans = allWords[currentElement.__msh_origWord];
+	if (spans.length == 0) {
+		alert("An impossible condition just happened.  Call FBI.  ;-)");
+	} else if (spans.length == 1) {
+		replaceClicked();
+		return false;
+	}
+	/*
+	var message = "The word \"" + currentElement.__msh_origWord + "\" occurs " + spans.length + " times.\n";
+	if (replacement == currentElement.__msh_origWord) {
+		ok = confirm(message + "Ignore all occurrences?");
+	} else {
+		ok = confirm(message + "Replace all occurrences with \"" + replacement + "\"?");
+	}
+	*/
+	if (ok) {
+		for (var i in spans) {
+			if (spans[i] != currentElement) {
+				replaceWord(spans[i]);
+			}
+		}
+		// replace current element the last, so that we jump to the next word ;-)
+		replaceClicked();
+	}
+	return false;
+};
+
+function ignoreClicked() {
+	document.getElementById("v_replacement").value = currentElement.__msh_origWord;
+	replaceClicked();
+	return false;
+};
+
+function ignoreAllClicked() {
+	document.getElementById("v_replacement").value = currentElement.__msh_origWord;
+	replaceAllClicked();
+	return false;
+};
+
+function learnClicked() {
+	alert("Not [yet] implemented");
+	return false;
+};
+
+function internationalizeWindow() {
+	var types = ["div", "span", "button"];
+	for (var i in types) {
+		var tag = types[i];
+		var els = document.getElementsByTagName(tag);
+		for (var j = els.length; --j >= 0;) {
+			var el = els[j];
+			if (el.childNodes.length == 1 && /\S/.test(el.innerHTML)) {
+				var txt = el.innerHTML;
+				if (typeof i18n[txt] != "undefined") {
+					el.innerHTML = i18n[txt];
+				}
+			}
+		}
+	}
+};
+
+function initDocument() {
+	internationalizeWindow();
+	modified = false;
+	frame = document.getElementById("i_framecontent");
+	var field = document.getElementById("f_content");
+	field.value = HTMLArea.getHTML(editor._doc.body, false, editor);
+	field.form.submit();
+	document.getElementById("f_init").value = "0";
+
+	// assign some global event handlers
+
+	var select = document.getElementById("v_suggestions");
+	select.onchange = function() {
+		document.getElementById("v_replacement").value = this.value;
+	};
+	if (is_ie) {
+		select.attachEvent("ondblclick", replaceClicked);
+	} else {
+		select.addEventListener("dblclick", replaceClicked, true);
+	}
+
+	document.getElementById("b_replace").onclick = replaceClicked;
+	// document.getElementById("b_learn").onclick = learnClicked;
+	document.getElementById("b_replall").onclick = replaceAllClicked;
+	document.getElementById("b_ignore").onclick = ignoreClicked;
+	document.getElementById("b_ignall").onclick = ignoreAllClicked;
+	document.getElementById("b_recheck").onclick = recheckClicked;
+	document.getElementById("b_revert").onclick = revertClicked;
+	document.getElementById("b_info").onclick = displayInfo;
+
+	document.getElementById("b_ok").onclick = saveClicked;
+	document.getElementById("b_cancel").onclick = cancelClicked;
+
+	select = document.getElementById("v_dictionaries");
+	select.onchange = function() {
+		document.getElementById("f_dictionary").value = this.value;
+	};
+};
+
+function getAbsolutePos(el) {
+	var r = { x: el.offsetLeft, y: el.offsetTop };
+	if (el.offsetParent) {
+		var tmp = getAbsolutePos(el.offsetParent);
+		r.x += tmp.x;
+		r.y += tmp.y;
+	}
+	return r;
+};
+
+function wordClicked(scroll) {
+	var self = this;
+	if (scroll) (function() {
+		var pos = getAbsolutePos(self);
+		var ws = { x: frame.offsetWidth - 4,
+			   y: frame.offsetHeight - 4 };
+		var wp = { x: frame.contentWindow.document.body.scrollLeft,
+			   y: frame.contentWindow.document.body.scrollTop };
+		pos.x -= Math.round(ws.x/2);
+		if (pos.x < 0) pos.x = 0;
+		pos.y -= Math.round(ws.y/2);
+		if (pos.y < 0) pos.y = 0;
+		frame.contentWindow.scrollTo(pos.x, pos.y);
+	})();
+	if (currentElement) {
+		var a = allWords[currentElement.__msh_origWord];
+		currentElement.className = currentElement.className.replace(/\s*HA-spellcheck-current\s*/g, " ");
+		for (var i in a) {
+			var el = a[i];
+			if (el != currentElement) {
+				el.className = el.className.replace(/\s*HA-spellcheck-same\s*/g, " ");
+			}
+		}
+	}
+	currentElement = this;
+	this.className += " HA-spellcheck-current";
+	var a = allWords[currentElement.__msh_origWord];
+	for (var i in a) {
+		var el = a[i];
+		if (el != currentElement) {
+			el.className += " HA-spellcheck-same";
+		}
+	}
+	// document.getElementById("b_replall").disabled = (a.length <= 1);
+	// document.getElementById("b_ignall").disabled = (a.length <= 1);
+	var txt;
+	if (a.length == 1) {
+		txt = "one occurrence";
+	} else if (a.length == 2) {
+		txt = "two occurrences";
+	} else {
+		txt = a.length + " occurrences";
+	}
+	var suggestions = suggested_words[this.__msh_origWord];
+	if (suggestions)
+		suggestions = suggestions.split(/,/);
+	else
+		suggestions = [];
+	var select = document.getElementById("v_suggestions");
+	document.getElementById("statusbar").innerHTML = "Found " + txt +
+		' for word "<b>' + currentElement.__msh_origWord + '</b>"';
+	for (var i = select.length; --i >= 0;) {
+		select.remove(i);
+	}
+	for (var i = 0; i < suggestions.length; ++i) {
+		var txt = suggestions[i];
+		var option = document.createElement("option");
+		option.value = txt;
+		option.appendChild(document.createTextNode(txt));
+		select.appendChild(option);
+	}
+	document.getElementById("v_currentWord").innerHTML = this.__msh_origWord;
+	if (suggestions.length > 0) {
+		select.selectedIndex = 0;
+		select.onchange();
+	} else {
+		document.getElementById("v_replacement").value = this.innerHTML;
+	}
+	select.style.display = "none";
+	select.style.display = "block";
+	return false;
+};
+
+function wordMouseOver() {
+	this.className += " HA-spellcheck-hover";
+};
+
+function wordMouseOut() {
+	this.className = this.className.replace(/\s*HA-spellcheck-hover\s*/g, " ");
+};
+
+function displayInfo() {
+	var info = frame.contentWindow.spellcheck_info;
+	if (!info)
+		alert("No information available");
+	else {
+		var txt = "** Document information **";
+		for (var i in info) {
+			txt += "\n" + i + " : " + info[i];
+		}
+		alert(txt);
+	}
+	return false;
+};
+
+function finishedSpellChecking() {
+	// initialization of global variables
+	currentElement = null;
+	wrongWords = null;
+	allWords = {};
+	fixedWords = [];
+	suggested_words = frame.contentWindow.suggested_words;
+
+	document.getElementById("status").innerHTML = "HTMLArea Spell Checker (<a href='readme-tech.html' target='_blank' title='Technical information'>info</a>)";
+	var doc = frame.contentWindow.document;
+        var spans = doc.getElementsByTagName("span");
+        var sps = [];
+	var id = 0;
+        for (var i = 0; i < spans.length; ++i) {
+                var el = spans[i];
+                if (/HA-spellcheck-error/.test(el.className)) {
+                        sps.push(el);
+			el.__msh_wordClicked = wordClicked;
+			el.onclick = function(ev) {
+				ev || (ev = window.event);
+				ev && HTMLArea._stopEvent(ev);
+				return this.__msh_wordClicked(false);
+			};
+			el.onmouseover = wordMouseOver;
+			el.onmouseout = wordMouseOut;
+			el.__msh_id = id++;
+			var txt = (el.__msh_origWord = el.firstChild.data);
+			el.__msh_fixed = false;
+			if (typeof allWords[txt] == "undefined") {
+				allWords[txt] = [el];
+			} else {
+				allWords[txt].push(el);
+			}
+                } else if (/HA-spellcheck-fixed/.test(el.className)) {
+			fixedWords.push(el);
+		}
+        }
+	wrongWords = sps;
+	if (sps.length == 0) {
+		if (!modified) {
+			alert(i18n["NO_ERRORS_CLOSING"]);
+			window.close();
+		} else {
+			alert(i18n["NO_ERRORS"]);
+		}
+		return false;
+	}
+	(currentElement = sps[0]).__msh_wordClicked(true);
+	var as = doc.getElementsByTagName("a");
+	for (var i = as.length; --i >= 0;) {
+		var a = as[i];
+		a.onclick = function() {
+			if (confirm(i18n["CONFIRM_LINK_CLICK"] + ":\n" +
+				    this.href + "\n" + i18n["I will open it in a new page."])) {
+				window.open(this.href);
+			}
+			return false;
+		};
+	}
+	var dicts = doc.getElementById("HA-spellcheck-dictionaries");
+	if (dicts) {
+		dicts.parentNode.removeChild(dicts);
+		dicts = dicts.innerHTML.split(/,/);
+		var select = document.getElementById("v_dictionaries");
+		for (var i = select.length; --i >= 0;) {
+			select.remove(i);
+		}
+		for (var i = 0; i < dicts.length; ++i) {
+			var txt = dicts[i];
+			var option = document.createElement("option");
+			if (/^@(.*)$/.test(txt)) {
+				txt = RegExp.$1;
+				option.selected = true;
+			}
+			option.value = txt;
+			option.appendChild(document.createTextNode(txt));
+			select.appendChild(option);
+		}
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/en.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/en.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/en.js	(revision 1328)
@@ -0,0 +1,38 @@
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Please confirm that you want to open this link",
+	"Cancel"                                : "Cancel",
+	"Dictionary"                            : "Dictionary",
+	"Finished list of mispelled words"      : "Finished list of mispelled words",
+	"I will open it in a new page."         : "I will open it in a new page.",
+	"Ignore all"                            : "Ignore all",
+	"Ignore"                                : "Ignore",
+	"NO_ERRORS"                             : "No mispelled words found with the selected dictionary.",
+	"NO_ERRORS_CLOSING"                     : "Spell check complete, didn't find any mispelled words.  Closing now...",
+	"OK"                                    : "OK",
+	"Original word"                         : "Original word",
+	"Please wait.  Calling spell checker."  : "Please wait.  Calling spell checker.",
+	"Please wait: changing dictionary to"   : "Please wait: changing dictionary to",
+	"QUIT_CONFIRMATION"                     : "This will drop changes and quit spell checker.  Please confirm.",
+	"Re-check"                              : "Re-check",
+	"Replace all"                           : "Replace all",
+	"Replace with"                          : "Replace with",
+	"Replace"                               : "Replace",
+	"Revert"                                : "Revert",
+	"SC-spell-check"                        : "Spell-check",
+	"Suggestions"                           : "Suggestions",
+	"pliz weit ;-)"                         : "pliz weit ;-)"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/da.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/da.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/da.js	(revision 1328)
@@ -0,0 +1,37 @@
+﻿// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Steen Sønderup, <steen@soenderup.com>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Vil du følge dette link?",
+	"Cancel"                                : "Anuler",
+	"Dictionary"                            : "Ordbog",
+	"Finished list of mispelled words"      : "Listen med stavefejl er gennemgået",
+	"I will open it in a new page."         : "Jeg vil åbne det i en ny side.",
+	"Ignore all"                            : "Ignorer alle",
+	"Ignore"                                : "Ignorer",
+	"NO_ERRORS"                             : "Der blev ikke fundet nogle stavefejl med den valgte ordbog.",
+	"NO_ERRORS_CLOSING"                     : "Stavekontrollen er gennemført, der blev ikke fundet nogle stavefejl.  Lukker...",
+	"OK"                                    : "OK",
+	"Original word"                         : "Oprindeligt ord",
+	"Please wait.  Calling spell checker."  : "Vent venligst.  Henter stavekontrol.",
+	"Please wait: changing dictionary to"   : "Vent venligst: skifter ordbog til",
+	"QUIT_CONFIRMATION"                     : "Alle dine ændringer vil gå tabt, vil du fortsætte?",
+	"Re-check"                              : "Tjek igen",
+	"Replace all"                           : "Erstat alle",
+	"Replace with"                          : "Erstat med",
+	"Replace"                               : "Erstat",
+	"SC-spell-check"                        : "Stavekontrol",
+	"Suggestions"                           : "Forslag",
+	"pliz weit ;-)"                         : "Vent venligst"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/de.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/de.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/de.js	(revision 1328)
@@ -0,0 +1,28 @@
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Broxx, <broxx@broxx.com>
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Wollen Sie diesen Link oeffnen",
+	"Cancel"                                : "Abbrechen",
+	"Dictionary"                            : "Woerterbuch",
+	"Finished list of mispelled words"      : "Liste der nicht bekannten Woerter",
+	"I will open it in a new page."         : "Wird auf neuer Seite geoeffnet",
+	"Ignore all"                            : "Alle ignorieren",
+	"Ignore"                                : "Ignorieren",
+	"NO_ERRORS"                             : "Keine falschen Woerter mit gewaehlten Woerterbuch gefunden",
+	"NO_ERRORS_CLOSING"                     : "Rechtsschreibpruefung wurde ohne Fehler fertiggestellt.  Wird nun geschlossen...",
+	"OK"                                    : "OK",
+	"Original word"                         : "Original Wort",
+	"Please wait.  Calling spell checker."  : "Bitte warten.  Woerterbuch wird durchsucht.",
+	"Please wait: changing dictionary to"   : "Bitte warten: Woerterbuch wechseln zu",
+	"QUIT_CONFIRMATION"                     : "Aenderungen werden nicht uebernommen.  Bitte bestaettigen.",
+	"Re-check"                              : "Neuueberpruefung",
+	"Replace all"                           : "Alle ersetzen",
+	"Replace with"                          : "Ersetzen mit",
+	"Replace"                               : "Ersetzen",
+	"SC-spell-check"                        : "Ueberpruefung",
+	"Suggestions"                           : "Vorschlag",
+	"pliz weit ;-)"                         : "bittsche wartn ;-)"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/cz.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/cz.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/cz.js	(revision 1328)
@@ -0,0 +1,37 @@
+﻿// I18N constants
+
+// LANG: "cz", ENCODING: UTF-8 | ISO-8859-2
+// Author: Jiri Löw, <jirilow@jirilow.com>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Prosím potvrďte otevření tohoto odkazu",
+	"Cancel"                                : "Zrušit",
+	"Dictionary"                            : "Slovník",
+	"Finished list of mispelled words"      : "Dokončen seznam chybných slov",
+	"I will open it in a new page."         : "Bude otevřen jej v nové stránce.",
+	"Ignore all"                            : "Ignorovat vše",
+	"Ignore"                                : "Ignorovat",
+	"NO_ERRORS"                             : "Podle zvoleného slovníku nebyla nalezena žádná chybná slova.",
+	"NO_ERRORS_CLOSING"                     : "Kontrola správnosti slov dokončena, nebyla nalezena žádná chybná slova. Ukončování ...",
+	"OK"                                    : "OK",
+	"Original word"                         : "Původní slovo",
+	"Please wait.  Calling spell checker."  : "Prosím čekejte. Komunikuace s kontrolou správnosti slov.",
+	"Please wait: changing dictionary to"   : "Prosím čekejte: změna adresáře na",
+	"QUIT_CONFIRMATION"                     : "Změny budou zrušeny a kontrola správnosti slov ukončena. Prosím potvrďte.",
+	"Re-check"                              : "Překontrolovat",
+	"Replace all"                           : "Zaměnit všechno",
+	"Replace with"                          : "Zaměnit za",
+	"Replace"                               : "Zaměnit",
+	"SC-spell-check"                        : "Kontrola správnosti slov",
+	"Suggestions"                           : "Doporučení",
+	"pliz weit ;-)"                         : "strpení prosím ;-)"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/hu.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/hu.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/hu.js	(revision 1328)
@@ -0,0 +1,37 @@
+// I18N constants
+
+// LANG: "hu", ENCODING: UTF-8
+// Author: Miklós Somogyi, <somogyine@vnet.hu>
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Megerősítés",
+	"Cancel"                                : "Mégsem",
+	"Dictionary"                            : "Szótár",
+	"Finished list of mispelled words"      : "A tévesztett szavak listájának vége",
+	"I will open it in a new page."         : "Megnyitás új lapon",
+	"Ignore all"                            : "Minden elvetése",
+	"Ignore"                                : "Elvetés",
+	"NO_ERRORS"                             : "A választott szótár szerint nincs tévesztett szó.",
+	"NO_ERRORS_CLOSING"                     : "A helyesírásellenőrzés kész, tévesztett szó nem fordult elő. Bezárás...",
+	"OK"                                    : "Rendben",
+	"Original word"                         : "Eredeti szó",
+	"Please wait.  Calling spell checker."  : "Kis türelmet, a helyesírásellenőrző hívása folyamatban.",
+	"Please wait: changing dictionary to"   : "Kis türelmet, szótár cseréje",
+	"QUIT_CONFIRMATION"                     : "Kilépés a változások eldobásával. Jóváhagyja?",
+	"Re-check"                              : "Újraellenőrzés",
+	"Replace all"                           : "Mind cseréje",
+	"Replace with"                          : "Csere a következőre:",
+	"Replace"                               : "Csere",
+	"SC-spell-check"                        : "Helyesírásellenőrzés",
+	"Suggestions"                           : "Tippek",
+	"pliz weit ;-)"                         : "Kis türelmet ;-)"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/it.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/it.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/it.js	(revision 1328)
@@ -0,0 +1,28 @@
+// I18N constants
+
+// LANG: "it", ENCODING: UTF-8 | ISO-8859-1
+// Author: Fabio Rotondo, <fabio@rotondo.it>
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Devi confermare l'apertura di questo link",
+	"Cancel"                                : "Annulla",
+	"Dictionary"                            : "Dizionario",
+	"Finished list of mispelled words"      : "La lista delle parole scritte male è terminata",
+	"I will open it in a new page."         : "Lo aprirò in una nuova pagina.",
+	"Ignore all"                            : "Ignora sempre",
+	"Ignore"                                : "Ignora",
+	"NO_ERRORS"                             : "Non sono state trovate parole scritte male con il dizionario selezionato.",
+	"NO_ERRORS_CLOSING"                     : "Controllo completato, non sono state trovate parole scritte male. Sto chiudendo...",
+	"OK"                                    : "OK",
+	"Original word"                         : "Parola originale",
+	"Please wait.  Calling spell checker."  : "Attendere.  Sto invocando lo Spell Checker.",
+	"Please wait: changing dictionary to"   : "Attendere. Cambio il dizionario in",
+	"QUIT_CONFIRMATION"                     : "Questo annullerà le modifiche e chiuderà lo Spell Checker. Conferma.",
+	"Re-check"                              : "Ricontrolla",
+	"Replace all"                           : "Sostituisci sempre",
+	"Replace with"                          : "Stostituisci con",
+	"Replace"                               : "Sostituisci",
+	"SC-spell-check"                        : "Spell-check",
+	"Suggestions"                           : "Suggerimenti",
+	"pliz weit ;-)"                         : "Attendere Prego ;-)"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/ro.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/ro.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/lang/ro.js	(revision 1328)
@@ -0,0 +1,37 @@
+// I18N constants
+
+// LANG: "ro", ENCODING: UTF-8
+// Author: Mihai Bazon, http://dynarch.com/mishoo
+
+// FOR TRANSLATORS:
+//
+//   1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+//      (at least a valid email address)
+//
+//   2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+//      (if this is not possible, please include a comment
+//       that states what encoding is necessary.)
+
+SpellChecker.I18N = {
+	"CONFIRM_LINK_CLICK"                    : "Vă rog confirmaţi că vreţi să deschideţi acest link",
+	"Cancel"                                : "Anulează",
+	"Dictionary"                            : "Dicţionar",
+	"Finished list of mispelled words"      : "Am terminat lista de cuvinte greşite",
+	"I will open it in a new page."         : "O voi deschide într-o altă fereastră.",
+	"Ignore all"                            : "Ignoră toate",
+	"Ignore"                                : "Ignoră",
+	"NO_ERRORS"                             : "Nu am găsit nici un cuvânt greşit cu acest dicţionar.",
+	"NO_ERRORS_CLOSING"                     : "Am terminat, nu am detectat nici o greşeală.  Acum închid fereastra...",
+	"OK"                                    : "OK",
+	"Original word"                         : "Cuvântul original",
+	"Please wait.  Calling spell checker."  : "Vă rog aşteptaţi.  Apelez spell-checker-ul.",
+	"Please wait: changing dictionary to"   : "Vă rog aşteptaţi.  Schimb dicţionarul cu",
+	"QUIT_CONFIRMATION"                     : "Doriţi să renunţaţi la modificări şi să închid spell-checker-ul?",
+	"Re-check"                              : "Scanează",
+	"Replace all"                           : "Înlocuieşte toate",
+	"Replace with"                          : "Înlocuieşte cu",
+	"Replace"                               : "Înlocuieşte",
+	"SC-spell-check"                        : "Detectează greşeli",
+	"Suggestions"                           : "Sugestii",
+	"pliz weit ;-)"                         : "va rog ashteptatzi ;-)"
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/readme-tech.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/readme-tech.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/plugins/SpellChecker/readme-tech.html	(revision 1328)
@@ -0,0 +1,114 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
+<html>
+  <head>
+    <title>HTMLArea Spell Checker</title>
+  </head>
+
+  <body>
+    <h1>HTMLArea Spell Checker</h1>
+
+    <p>The HTMLArea Spell Checker subsystem consists of the following
+      files:</p>
+
+    <ul>
+
+      <li>spell-checker.js &mdash; the spell checker plugin interface for
+        HTMLArea</li>
+
+      <li>spell-checker-ui.html &mdash; the HTML code for the user
+        interface</li>
+
+      <li>spell-checker-ui.js &mdash; functionality of the user
+        interface</li>
+
+      <li>spell-checker-logic.cgi &mdash; Perl CGI script that checks a text
+        given through POST for spelling errors</li>
+
+      <li>spell-checker-style.css &mdash; style for mispelled words</li>
+
+      <li>lang/en.js &mdash; main language file (English).</li>
+
+    </ul>
+
+    <h2>Process overview</h2>
+
+    <p>
+      When an end-user clicks the "spell-check" button in the HTMLArea
+      editor, a new window is opened with the URL of "spell-check-ui.html".
+      This window initializes itself with the text found in the editor (uses
+      <tt>window.opener.SpellChecker.editor</tt> global variable) and it
+      submits the text to the server-side script "spell-check-logic.cgi".
+      The target of the FORM is an inline frame which is used both to
+      display the text and correcting.
+    </p>
+
+    <p>
+      Further, spell-check-logic.cgi calls Aspell for each portion of plain
+      text found in the given HTML.  It rebuilds an HTML file that contains
+      clear marks of which words are incorrect, along with suggestions for
+      each of them.  This file is then loaded in the inline frame.  Upon
+      loading, a JavaScript function from "spell-check-ui.js" is called.
+      This function will retrieve all mispelled words from the HTML of the
+      iframe and will setup the user interface so that it allows correction.
+    </p>
+
+    <h2>The server-side script (spell-check-logic.cgi)</h2>
+
+    <p>
+      <strong>Unicode safety</strong> &mdash; the program <em>is</em>
+      Unicode safe.  HTML entities are expanded into their corresponding
+      Unicode characters.  These characters will be matched as part of the
+      word passed to Aspell.  All texts passed to Aspell are in Unicode
+      (when appropriate).  <strike>However, Aspell seems to not support Unicode
+      yet (<a
+        href="http://mail.gnu.org/archive/html/aspell-user/2000-11/msg00007.html">thread concerning Aspell and Unicode</a>).
+      This mean that words containing Unicode
+      characters that are not in 0..255 are likely to be reported as "mispelled" by Aspell.</strike>
+    </p>
+
+    <p>
+      <strong style="font-variant: small-caps; color:
+      red;">Update:</strong> though I've never seen it mentioned
+      anywhere, it looks that Aspell <em>does</em>, in fact, speak
+      Unicode.  Or else, maybe <code>Text::Aspell</code> does
+      transparent conversion; anyway, this new version of our
+      SpellChecker plugin is, as tests show so far, fully
+      Unicode-safe... well, probably the <em>only</em> freeware
+      Web-based spell-checker which happens to have Unicode support.
+    </p>
+
+    <p>
+      The Perl Unicode manual (man perluniintro) states:
+    </p>
+
+    <blockquote>
+      <em>
+        Starting from Perl 5.6.0, Perl has had the capacity to handle Unicode
+        natively.  Perl 5.8.0, however, is the first recommended release for
+        serious Unicode work.  The maintenance release 5.6.1 fixed many of the
+        problems of the initial Unicode implementation, but for example regular
+        expressions still do not work with Unicode in 5.6.1.
+      </em>
+    </blockquote>
+
+    <p>In other words, do <em>not</em> assume that this script is
+      Unicode-safe on Perl interpreters older than 5.8.0.</p>
+
+    <p>The following Perl modules are required:</p>
+
+    <ul>
+      <li><a href="http://search.cpan.org/search?query=Text%3A%3AAspell&mode=all" target="_blank">Text::Aspell</a></li>
+      <li><a href="http://search.cpan.org/search?query=XML%3A%3ADOM&mode=all" target="_blank">XML::DOM</a></li>
+      <li><a href="http://search.cpan.org/search?query=CGI&mode=all" target="_blank">CGI</a></li>
+    </ul>
+
+    <p>Of these, only Text::Aspell might need to be installed manually.  The
+      others are likely to be available by default in most Perl distributions.</p>
+
+    <hr />
+    <address><a href="http://dynarch.com/mishoo/">Mihai Bazon</a></address>
+<!-- Created: Thu Jul 17 13:22:27 EEST 2003 -->
+<!-- hhmts start --> Last modified: Fri Jan 30 19:14:11 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+  </body>
+</html>
Index: /temp/trunk/html/test/nakatest/HTMLArea/popupdiv.js
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/popupdiv.js	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/popupdiv.js	(revision 1328)
@@ -0,0 +1,369 @@
+/** This file is derived from PopupDiv, developed by Mihai Bazon for
+ * SamWare.net.  Modifications were needed to make it usable in HTMLArea.
+ * HTMLArea is a free WYSIWYG online HTML editor from InteractiveTools.com.
+ *
+ * This file does not function standalone.  It is dependent of global functions
+ * defined in HTMLArea-3.0 (htmlarea.js).
+ *
+ * Please see file htmlarea.js for further details.
+ **/
+
+var is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) &&
+	      (navigator.userAgent.toLowerCase().indexOf("opera") == -1) );
+var is_compat = (document.compatMode == "BackCompat");
+
+function PopupDiv(editor, titleText, handler, initFunction) {
+	var self = this;
+
+	this.editor = editor;
+	this.doc = editor._mdoc;
+	this.handler = handler;
+
+	var el = this.doc.createElement("div");
+	el.className = "content";
+
+	var popup = this.doc.createElement("div");
+	popup.className = "dialog popupdiv";
+	this.element = popup;
+	var s = popup.style;
+	s.position = "absolute";
+	s.left = "0px";
+	s.top = "0px";
+
+	var title = this.doc.createElement("div");
+	title.className = "title";
+	this.title = title;
+	popup.appendChild(title);
+
+	HTMLArea._addEvent(title, "mousedown", function(ev) {
+		self._dragStart(is_ie ? window.event : ev);
+	});
+
+	var button = this.doc.createElement("div");
+	button.className = "button";
+	title.appendChild(button);
+	button.innerHTML = "&#x00d7;";
+	title.appendChild(this.doc.createTextNode(titleText));
+	this.titleText = titleText;
+
+	button.onmouseover = function() {
+		this.className += " button-hilite";
+	};
+	button.onmouseout = function() {
+		this.className = this.className.replace(/\s*button-hilite\s*/g, " ");
+	};
+	button.onclick = function() {
+		this.className = this.className.replace(/\s*button-hilite\s*/g, " ");
+		self.close();
+	};
+
+	popup.appendChild(el);
+	this.content = el;
+
+	this.doc.body.appendChild(popup);
+
+	this.dragging = false;
+	this.onShow = null;
+	this.onClose = null;
+	this.modal = false;
+
+	initFunction(this);
+};
+
+PopupDiv.currentPopup = null;
+
+PopupDiv.prototype.showAtElement = function(el, mode) {
+	this.defaultSize();
+	var pos, ew, eh;
+	var popup = this.element;
+	popup.style.display = "block";
+	var w = popup.offsetWidth;
+	var h = popup.offsetHeight;
+	popup.style.display = "none";
+	if (el != window) {
+		pos = PopupDiv.getAbsolutePos(el);
+		ew = el.offsetWidth;
+		eh = el.offsetHeight;
+	} else {
+		pos = {x:0, y:0};
+		var size = PopupDiv.getWindowSize();
+		ew = size.x;
+		eh = size.y;
+	}
+	var FX = false, FY = false;
+	if (mode.indexOf("l") != -1) {
+		pos.x -= w;
+		FX = true;
+	}
+	if (mode.indexOf("r") != -1) {
+		pos.x += ew;
+		FX = true;
+	}
+	if (mode.indexOf("t") != -1) {
+		pos.y -= h;
+		FY = true;
+	}
+	if (mode.indexOf("b") != -1) {
+		pos.y += eh;
+		FY = true;
+	}
+	if (mode.indexOf("c") != -1) {
+		FX || (pos.x += Math.round((ew - w) / 2));
+		FY || (pos.y += Math.round((eh - h) / 2));
+	}
+	this.showAt(pos.x, pos.y);
+};
+
+PopupDiv.prototype.defaultSize = function() {
+	var s = this.element.style;
+	var cs = this.element.currentStyle;
+	var addX = (is_ie && is_compat) ? (parseInt(cs.borderLeftWidth) +
+					   parseInt(cs.borderRightWidth) +
+					   parseInt(cs.paddingLeft) +
+					   parseInt(cs.paddingRight)) : 0;
+	var addY = (is_ie && is_compat) ? (parseInt(cs.borderTopWidth) +
+					   parseInt(cs.borderBottomWidth) +
+					   parseInt(cs.paddingTop) +
+					   parseInt(cs.paddingBottom)) : 0;
+	s.display = "block";
+	s.width = (this.content.offsetWidth + addX) + "px";
+	s.height = (this.content.offsetHeight + this.title.offsetHeight) + "px";
+	s.display = "none";
+};
+
+PopupDiv.prototype.showAt = function(x, y) {
+	this.defaultSize();
+	var s = this.element.style;
+	s.display = "block";
+	s.left = x + "px";
+	s.top = y + "px";
+	this.hideShowCovered();
+
+	PopupDiv.currentPopup = this;
+	HTMLArea._addEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+	HTMLArea._addEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+	if (is_ie && this.modal) {
+		this.doc.body.setCapture(false);
+		this.doc.body.onlosecapture = function() {
+			(PopupDiv.currentPopup) && (this.doc.body.setCapture(false));
+		};
+	}
+	window.event && HTMLArea._stopEvent(window.event);
+
+	if (typeof this.onShow == "function") {
+		this.onShow();
+	} else if (typeof this.onShow == "string") {
+		eval(this.onShow);
+	}
+
+	var field = this.element.getElementsByTagName("input")[0];
+	if (!field) {
+		field = this.element.getElementsByTagName("select")[0];
+	}
+	if (!field) {
+		field = this.element.getElementsByTagName("textarea")[0];
+	}
+	if (field) {
+		field.focus();
+	}
+};
+
+PopupDiv.prototype.close = function() {
+	this.element.style.display = "none";
+	PopupDiv.currentPopup = null;
+	this.hideShowCovered();
+	HTMLArea._removeEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+	HTMLArea._removeEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+	is_ie && this.modal && this.doc.body.releaseCapture();
+	if (typeof this.onClose == "function") {
+		this.onClose();
+	} else if (typeof this.onClose == "string") {
+		eval(this.onClose);
+	}
+	this.element.parentNode.removeChild(this.element);
+};
+
+PopupDiv.prototype.getForm = function() {
+	var forms = this.content.getElementsByTagName("form");
+	return (forms.length > 0) ? forms[0] : null;
+};
+
+PopupDiv.prototype.callHandler = function() {
+	var tags = ["input", "textarea", "select"];
+	var params = new Object();
+	for (var ti in tags) {
+		var tag = tags[ti];
+		var els = this.content.getElementsByTagName(tag);
+		for (var j = 0; j < els.length; ++j) {
+			var el = els[j];
+			params[el.name] = el.value;
+		}
+	}
+	this.handler(this, params);
+	return false;
+};
+
+PopupDiv.getAbsolutePos = function(el) {
+	var r = { x: el.offsetLeft, y: el.offsetTop };
+	if (el.offsetParent) {
+		var tmp = PopupDiv.getAbsolutePos(el.offsetParent);
+		r.x += tmp.x;
+		r.y += tmp.y;
+	}
+	return r;
+};
+
+PopupDiv.getWindowSize = function() {
+	if (window.innerHeight) {
+		return { y: window.innerHeight, x: window.innerWidth };
+	}
+	if (this.doc.body.clientHeight) {
+		return { y: this.doc.body.clientHeight, x: this.doc.body.clientWidth };
+	}
+	return { y: this.doc.documentElement.clientHeight, x: this.doc.documentElement.clientWidth };
+};
+
+PopupDiv.prototype.hideShowCovered = function () {
+	var self = this;
+	function isContained(el) {
+		while (el) {
+			if (el == self.element) {
+				return true;
+			}
+			el = el.parentNode;
+		}
+		return false;
+	};
+	var tags = new Array("applet", "select");
+	var el = this.element;
+
+	var p = PopupDiv.getAbsolutePos(el);
+	var EX1 = p.x;
+	var EX2 = el.offsetWidth + EX1;
+	var EY1 = p.y;
+	var EY2 = el.offsetHeight + EY1;
+
+	if (el.style.display == "none") {
+		EX1 = EX2 = EY1 = EY2 = 0;
+	}
+
+	for (var k = tags.length; k > 0; ) {
+		var ar = this.doc.getElementsByTagName(tags[--k]);
+		var cc = null;
+
+		for (var i = ar.length; i > 0;) {
+			cc = ar[--i];
+			if (isContained(cc)) {
+				cc.style.visibility = "visible";
+				continue;
+			}
+
+			p = PopupDiv.getAbsolutePos(cc);
+			var CX1 = p.x;
+			var CX2 = cc.offsetWidth + CX1;
+			var CY1 = p.y;
+			var CY2 = cc.offsetHeight + CY1;
+
+			if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
+				cc.style.visibility = "visible";
+			} else {
+				cc.style.visibility = "hidden";
+			}
+		}
+	}
+};
+
+PopupDiv.prototype._dragStart = function (ev) {
+	if (this.dragging) {
+		return false;
+	}
+	this.dragging = true;
+	PopupDiv.currentPopup = this;
+	var posX = ev.clientX;
+	var posY = ev.clientY;
+	if (is_ie) {
+		posY += this.doc.body.scrollTop;
+		posX += this.doc.body.scrollLeft;
+	} else {
+		posY += window.scrollY;
+		posX += window.scrollX;
+	}
+	var st = this.element.style;
+	this.xOffs = posX - parseInt(st.left);
+	this.yOffs = posY - parseInt(st.top);
+	HTMLArea._addEvent(this.doc, "mousemove", PopupDiv.dragIt);
+	HTMLArea._addEvent(this.doc, "mouseover", HTMLArea._stopEvent);
+	HTMLArea._addEvent(this.doc, "mouseup", PopupDiv.dragEnd);
+	HTMLArea._stopEvent(ev);
+};
+
+PopupDiv.dragIt = function (ev) {
+	var popup = PopupDiv.currentPopup;
+	if (!(popup && popup.dragging)) {
+		return false;
+	}
+	is_ie && (ev = window.event);
+	var posX = ev.clientX;
+	var posY = ev.clientY;
+	if (is_ie) {
+		posY += this.doc.body.scrollTop;
+		posX += this.doc.body.scrollLeft;
+	} else {
+		posY += window.scrollY;
+		posX += window.scrollX;
+	}
+	popup.hideShowCovered();
+	var st = popup.element.style;
+	st.left = (posX - popup.xOffs) + "px";
+	st.top = (posY - popup.yOffs) + "px";
+	HTMLArea._stopEvent(ev);
+};
+
+PopupDiv.dragEnd = function () {
+	var popup = PopupDiv.currentPopup;
+	if (!popup) {
+		return false;
+	}
+	popup.dragging = false;
+	HTMLArea._removeEvent(popup.doc, "mouseup", PopupDiv.dragEnd);
+	HTMLArea._removeEvent(popup.doc, "mouseover", HTMLArea._stopEvent);
+	HTMLArea._removeEvent(popup.doc, "mousemove", PopupDiv.dragIt);
+	popup.hideShowCovered();
+};
+
+PopupDiv.checkPopup = function (ev) {
+	is_ie && (ev = window.event);
+	var el = is_ie ? ev.srcElement : ev.target;
+	var cp = PopupDiv.currentPopup;
+	for (; (el != null) && (el != cp.element); el = el.parentNode);
+	if (el == null) {
+		cp.modal || ev.type == "mouseover" || cp.close();
+		HTMLArea._stopEvent(ev);
+	}
+};
+
+PopupDiv.prototype.addButtons = function() {
+	var self = this;
+	var div = this.doc.createElement("div");
+	this.content.appendChild(div);
+	div.className = "buttons";
+	for (var i = 0; i < arguments.length; ++i) {
+		var btn = arguments[i];
+		var button = this.doc.createElement("button");
+		div.appendChild(button);
+		button.innerHTML = HTMLArea.I18N.buttons[btn];
+		switch (btn) {
+		    case "ok":
+			button.onclick = function() {
+				self.callHandler();
+				self.close();
+			};
+			break;
+		    case "cancel":
+			button.onclick = function() {
+				self.close();
+			};
+			break;
+		}
+	}
+};
Index: /temp/trunk/html/test/nakatest/HTMLArea/reference.html
===================================================================
--- /temp/trunk/html/test/nakatest/HTMLArea/reference.html	(revision 1328)
+++ /temp/trunk/html/test/nakatest/HTMLArea/reference.html	(revision 1328)
@@ -0,0 +1,523 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
+<html> <head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>HTMLArea-3.0 Reference</title>
+
+<style type="text/css">
+  @import url(htmlarea.css);
+  body { font: 14px verdana,sans-serif; background: #fff; color: #000; }
+  h1, h2 { font-family:tahoma,sans-serif; }
+  h1 { border-bottom: 2px solid #000; }
+  h2 { border-bottom: 1px solid #aaa; }
+  h3, h4 { margin-bottom: 0px; font-family: Georgia,serif; font-style: italic; }
+  h4 { font-size: 90%; margin-left: 1em; }
+  acronym { border-bottom: 1px dotted #063; color: #063; }
+  p { margin-left: 2em; margin-top: 0.3em; }
+  li p { margin-left: 0px; }
+  .abstract { padding: 5px; margin: 0px 10em; font-size: 90%; border: 1px dashed #aaa; background: #eee;}
+  li { margin-left: 2em; }
+  em { color: #042; }
+  a { color: #00f; }
+  a:hover { color: #f00; }
+  a:active { color: #f80; }
+  span.browser { font-weight: bold; color: #864; }
+  .fixme { font-size: 20px; font-weight: bold; color: red; background: #fab;
+padding: 5px; text-align: center; }
+  .code {
+   background: #e4efff; padding: 5px; border: 1px dashed #abc; margin-left: 2em; margin-right: 2em;
+   font-family: fixed,"lucidux mono","andale mono","courier new",monospace;
+  }
+  .note, .warning { font-weight: bold; color: #0a0; font-variant: small-caps; }
+  .warning { color: #a00; }
+
+.string {
+  color: #06c;
+} /* font-lock-string-face */
+.comment {
+  color: #840;
+} /* font-lock-comment-face */
+.variable-name {
+  color: #000;
+} /* font-lock-variable-name-face */
+.type {
+  color: #008;
+  font-weight: bold;
+} /* font-lock-type-face */
+.reference {
+  color: #048;
+} /* font-lock-reference-face */
+.preprocessor {
+  color: #808;
+} /* font-lock-preprocessor-face */
+.keyword {
+  color: #00f;
+  font-weight: bold;
+} /* font-lock-keyword-face */
+.function-name {
+  color: #044;
+} /* font-lock-function-name-face */
+.html-tag {
+  font-weight: bold;
+} /* html-tag-face */
+.html-helper-italic {
+  font-style: italic;
+} /* html-helper-italic-face */
+.html-helper-bold {
+  font-weight: bold;
+} /* html-helper-bold-face */
+
+</style>
+
+<script type="text/javascript">
+  _editor_url = './';
+  _editor_lang = 'en';
+</script>
+<script type="text/javascript" src="htmlarea.js"></script>
+<script type="text/javascript" src="dialog.js"></script>
+<script tyle="text/javascript" src="lang/en.js"></script>
+
+</head>
+
+<body onload="HTMLArea.replace('TA')">
+
+
+<h1>HTMLArea-3.0 Documentation</h1>
+
+<div class="abstract" style="color: red; font-weight: bold">
+
+      This documentation contains valid information, but is outdated in the
+      terms that it does not covers all the features of HTMLArea.  A new
+      documentation project will be started, based on LaTeX.
+
+</div>
+
+
+<h2>Introduction</h2>
+
+<h3>What is HTMLArea?</h3>
+
+<p>HTMLArea is a free <acronym title="What You See Is What You Get"
+>WYSIWYG</acronym> editor replacement for <code>&lt;textarea&gt;</code>
+fields.  By adding a few simple lines of JavaScript code to your web page
+you can replace a regular textarea with a rich text editor that lets your
+users do the following:</p>
+
+<ul>
+  <li>Format text to be bold, italicized, or underlined.</li>
+  <li>Change the face, size, style and color.</li>
+  <li>Left, center, or right-justify paragraphs.</li>
+  <li>Make bulleted or numbered lists.</li>
+  <li>Indent or un-indent paragraphs.</li>
+  <li>Insert a horizontal line.</li>
+  <li>Insert hyperlinks and images.</li>
+  <li>View the raw HTML source of what they're editing.</li>
+  <li>and much more...</li>
+</ul>
+
+<p>Some of the interesting features of HTMLArea that set's it apart from
+other web based WYSIWYG editors are as follows:</p>
+
+<ul>
+  <li>It's lightweight, fast loading and can transform a regular textarea
+  into a rich-text editor with a single line of JavaScript.</li>
+  <li>Generates clean, valid HTML.</li>
+  <li>It degrades gracefully to older or non-supported browsers
+  (they get the original textarea field).</li>
+  <li>It's free and can be incorporated into any free or commercial
+  program.</li>
+  <li>It works with any server-side languages (ASP, PHP, Perl, Java,
+  etc).</li>
+  <li>It's written in JavaScript and can be easily viewed, modified or
+  extended.</li>
+  <li>It remembers entered content when a user navigates away and then hits
+  "back" in their browser.</li>
+  <li>Since it replaces existing textareas it doesn't require a lot of code
+  to add it to your pages (just one line).</li>
+  <li>Did we mention it was free? ;-)</li>
+</ul>
+
+<h3>Is it really free?  What's the catch?</h3>
+
+<p>Yes! It's really free. You can use it, modify it, distribute it with your
+software, or do just about anything you like with it.</p>
+
+<h3>What are the browser requirements?</h3>
+
+<p>HTMLArea requires <span class="browser"><a
+href="http://www.microsoft.com/ie">Internet Explorer</a> &gt;= 5.5</span>
+(Windows only), or <span class="browser"><a
+href="http://mozilla.org">Mozilla</a> &gt;= 1.3-Beta</span> on any platform.
+Any browser based on <a href="http://mozilla.org/newlayout">Gecko</a> will
+also work, provided that Gecko version is at least the one included in
+Mozilla-1.3-Beta (for example, <a
+href="http://galeon.sf.net">Galeon-1.2.8</a>).  However, it degrades
+gracefully to other browsers. They will get a regular textarea field
+instead of a WYSIWYG editor.</p>
+
+<h3>Can I see an example of what it looks like?</h3>
+
+<p>Just make sure you're using one of the browsers mentioned above and see
+below.</p>
+
+<form onsubmit="return false;">
+<textarea id="TA" style="width: 100%; height: 15em;">
+<p>Here is some sample text in textarea that's been transformed with <font
+color="#0000CC"><b>HTMLArea</b></font>.<br />
+You can make things <b>bold</b>, <i>italic</i>, <u>underline</u>.  You can change the
+<font size="3">size</font> and <b><font color="#0000CC">c</font><font color="#00CC00">o</font><font color="#00CCCC">l</font><font color="#CC0000">o</font><font color="#CC00CC">r</font><font color="#CCCC00">s</font><font color="#CCCCCC">!</font></b>
+And lots more...</p>
+
+<p align="center"><font size="4" color="#ff0000"><b><u>Try HTMLArea
+today!</u></b></font><br /></p>
+</textarea>
+</form>
+
+<h3>Where can I find out more info, download the latest version and talk to
+other HTMLArea users?</h3>
+
+<p>You can find out more about HTMLArea and download the latest version on
+the <a href="http://dynarch.com/htmlarea/">HTMLArea
+homepage</a> and you can talk to other HTMLArea users and post any comments
+or suggestions you have in the <a
+href="http://www.interactivetools.com/iforum/Open_Source_C3/htmlArea_v3.0_-_Alpha_Release_F14/"
+>HTMLArea forum</a>.</p>
+
+<h2>Keyboard shortcuts</h2>
+
+<p>The editor provides the following key combinations:</p>
+
+<ul>
+  <li>CTRL-A -- select all</li>
+  <li>CTRL-B -- bold</li>
+  <li>CTRL-I -- italic</li>
+  <li>CTRL-U -- underline</li>
+  <li>CTRL-S -- strikethrough</li>
+  <li>CTRL-L -- justify left</li>
+  <li>CTRL-E -- justify center</li>
+  <li>CTRL-R -- justify right</li>
+  <li>CTRL-J -- justify full</li>
+  <li>CTRL-1 .. CTRL-6 -- headings (&lt;h1&gt; .. &lt;h6&gt;)</li>
+  <li>CTRL-0 (zero) -- clean content pasted from Word</li>
+</ul>
+
+<h2>Installation</h2>
+
+<h3>How do I add HTMLArea to my web page?</h3>
+
+<p>It's easy.  First you need to upload HTMLArea files to your website.
+Just follow these steps.</p>
+
+<ol>
+  <li>Download the latest version from the <a
+  href="http://www.interactivetools.com/products/htmlarea/">htmlArea
+  homepage</a>.</li>
+  <li>Unzip the files onto your local computer (making sure to maintain the
+  directory structure contained in the zip).</li>
+  <li>Create a new folder on your website called /htmlarea/ (make sure it's
+  NOT inside the cgi-bin).</li>
+  <li>Transfer all the HTMLArea files from your local computer into the
+  /htmlarea/ folder on your website.</li>
+  <li>Open the example page /htmlarea/examples/core.html with your browser to make
+  sure everything works.</li>
+</ol>
+
+<p>Once htmlArea is on your website all you need to do is add some
+JavaScript to any pages that you want to add WYSIWYG editors to.  Here's how
+to do that.</p>
+
+<ol>
+
+  <li>Define some global variables.  "_editor_url" has to be the absolute
+  URL where HTMLArea resides within your
+  website; as we discussed, this would be “/htmlarea/”.  "_editor_lang" must
+  be the language code in which you want HTMLArea to appear.  This defaults
+  to "en" (English); for a list of supported languages, please look into
+  the "lang" subdirectory in the distribution.
+  <pre class="code"
+  ><span class="function-name">&lt;</span><span class="html-tag">script</span> <span class="variable-name">type=</span><span class="string">&quot;text/javascript&quot;</span><span class="function-name">&gt;</span>
+   _editor_url = <span class="string">&quot;/htmlarea/&quot;</span>;
+   _editor_lang = <span class="string">&quot;en&quot;</span>;
+<span class="function-name">&lt;</span><span class="html-tag">/script</span><span class="function-name">&gt;</span></pre>
+
+  <li>Include the "htmlarea.js" script:
+  <pre class="code"
+  ><span class="function-name">&lt;</span><span class="html-tag">script</span> <span class="variable-name">type=</span><span class="string">&quot;text/javascript&quot;</span> <span class="variable-name">src=</span><span class="string">&quot;/htmlarea/htmlarea.js&quot;</span><span class="function-name">&gt;</span><span class="paren-face-match">&lt;</span><span class="html-tag">/script</span><span class="paren-face-match">&gt;</span></pre>
+  </li>
+
+  <li><p>If you want to change all your &lt;textarea&gt;-s into
+  HTMLArea-s then you can use the simplest way to create HTMLArea:</p>
+  <pre class="code"
+  ><span class="function-name">&lt;</span><span class="html-tag">script</span> <span class="variable-name">type=</span><span class="string">&quot;text/javascript&quot;</span> <span class="variable-name">defer=</span><span class="string">&quot;1&quot;</span><span class="function-name">&gt;</span>
+    HTMLArea.replaceAll<span class="function-name">()</span>;
+<span class="paren-face-match">&lt;</span><span class="html-tag">/script</span><span class="paren-face-match">&gt;</span></pre>
+  <p><span class="note">Note:</span> you can also add the
+  <code>HTMLArea.replaceAll()</code> code to the <code>onload</code>
+  event handler for the <code>body</code> element, if you find it more appropriate.</p>
+
+  <p>A different approach, if you have more than one textarea and only want
+  to change one of them, is to use <code>HTMLArea.replace("id")</code> --
+  pass the <code>id</code> of your textarea.  Do not use the
+  <code>name</code> attribute anymore, it's not a standard solution!</p>
+
+</ol>
+
+<p>This section applies to HTMLArea-3.0 release candidate 1 or later; prior
+to this version, one needed to include more files; however, now HTMLArea is
+able to include other files too (such as stylesheet, language definition
+file, etc.) so you only need to define the editor path and load
+"htmlarea.js".  Nice, eh? ;-)</p>
+
+<h3>I want to change the editor settings, how do I do that?</h3>
+
+<p>While it's true that all you need is one line of JavaScript to create an
+htmlArea WYSIWYG editor, you can also specify more config settings in the
+code to control how the editor works and looks.  Here's an example of some of
+the available settings:</p>
+
+<pre class="code"
+><span class="keyword">var</span> <span class="variable-name">config</span> = <span class="keyword">new</span> HTMLArea.Config(); <span class="comment">// create a new configuration object
+</span>                                    <span class="comment">// having all the default values
+</span>config.width = '<span class="string">90%</span>';
+config.height = '<span class="string">200px</span>';
+
+<span class="comment">// the following sets a style for the page body (black text on yellow page)
+// and makes all paragraphs be bold by default
+</span>config.pageStyle =
+  '<span class="string">body { background-color: yellow; color: black; font-family: verdana,sans-serif } </span>' +
+  '<span class="string">p { font-width: bold; } </span>';
+
+<span class="comment">// the following replaces the textarea with the given id with a new
+// HTMLArea object having the specified configuration
+</span>HTMLArea.replace('<span class="string">id</span>', config);</pre>
+
+<p><span class="warning">Important:</span> It's recommended that you add
+custom features and configuration to a separate file.  This will ensure you
+that when we release a new official version of HTMLArea you'll have less
+trouble upgrading it.</p>
+
+<h3>How do I customize the toolbar?</h3>
+
+<p>Using the configuration object introduced above allows you to completely
+control what the toolbar contains.  Following is an example of a one-line,
+customized toolbar, much simpler than the default one:</p>
+
+<pre class="code"
+><span class="keyword">var</span> <span class="variable-name">config</span> = <span class="keyword">new</span> HTMLArea.Config();
+config.toolbar = [
+  ['<span class="string">fontname</span>', '<span class="string">space</span>',
+   '<span class="string">fontsize</span>', '<span class="string">space</span>',
+   '<span class="string">formatblock</span>', '<span class="string">space</span>',
+   '<span class="string">bold</span>', '<span class="string">italic</span>', '<span class="string">underline</span>']
+];
+HTMLArea.replace('<span class="string">id</span>', config);</pre>
+
+<p>The toolbar is an Array of Array objects.  Each array in the toolbar
+defines a new line.  The default toolbar looks like this:</p>
+
+<pre class="code"
+>config.toolbar = [
+[ &quot;<span class="string">fontname</span>&quot;, &quot;<span class="string">space</span>&quot;,
+  &quot;<span class="string">fontsize</span>&quot;, &quot;<span class="string">space</span>&quot;,
+  &quot;<span class="string">formatblock</span>&quot;, &quot;<span class="string">space</span>&quot;,
+  &quot;<span class="string">bold</span>&quot;, &quot;<span class="string">italic</span>&quot;, &quot;<span class="string">underline</span>&quot;, &quot;<span class="string">separator</span>&quot;,
+  &quot;<span class="string">strikethrough</span>&quot;, &quot;<span class="string">subscript</span>&quot;, &quot;<span class="string">superscript</span>&quot;, &quot;<span class="string">separator</span>&quot;,
+  &quot;<span class="string">copy</span>&quot;, &quot;<span class="string">cut</span>&quot;, &quot;<span class="string">paste</span>&quot;, &quot;<span class="string">space</span>&quot;, &quot;<span class="string">undo</span>&quot;, &quot;<span class="string">redo</span>&quot; ],
+		
+[ &quot;<span class="string">justifyleft</span>&quot;, &quot;<span class="string">justifycenter</span>&quot;, &quot;<span class="string">justifyright</span>&quot;, &quot;<span class="string">justifyfull</span>&quot;, &quot;<span class="string">separator</span>&quot;,
+  &quot;<span class="string">insertorderedlist</span>&quot;, &quot;<span class="string">insertunorderedlist</span>&quot;, &quot;<span class="string">outdent</span>&quot;, &quot;<span class="string">indent</span>&quot;, &quot;<span class="string">separator</span>&quot;,
+  &quot;<span class="string">forecolor</span>&quot;, &quot;<span class="string">hilitecolor</span>&quot;, &quot;<span class="string">textindicator</span>&quot;, &quot;<span class="string">separator</span>&quot;,
+  &quot;<span class="string">inserthorizontalrule</span>&quot;, &quot;<span class="string">createlink</span>&quot;, &quot;<span class="string">insertimage</span>&quot;, &quot;<span class="string">inserttable</span>&quot;, &quot;<span class="string">htmlmode</span>&quot;, &quot;<span class="string">separator</span>&quot;,
+  &quot;<span class="string">popupeditor</span>&quot;, &quot;<span class="string">separator</span>&quot;, &quot;<span class="string">showhelp</span>&quot;, &quot;<span class="string">about</span>&quot; ]
+];</pre>
+
+<p>Except three strings, all others in the examples above need to be defined
+in the <code>config.btnList</code> object (detailed a bit later in this
+document).  The three exceptions are: 'space', 'separator' and 'linebreak'.
+These three have the following meaning, and need not be present in
+<code>btnList</code>:</p>
+
+<ul>
+  <li>'space' -- Inserts a space of 5 pixels (the width is configurable by external
+  <acronym title="Cascading Style Sheets">CSS</acronym>) at the current
+  position in the toolbar.</li>
+  <li>'separator' -- Inserts a small vertical separator, for visually grouping related
+  buttons.</li>
+  <li>'linebreak' -- Starts a new line in the toolbar.  Subsequent controls will be
+  inserted on the new line.</li>
+</ul>
+
+<p><span class="warning">Important:</span> It's recommended that you add
+custom features and configuration to a separate file.  This will ensure you
+that when we release a new official version of HTMLArea you'll have less
+trouble upgrading it.</p>
+
+<h3>How do I create custom buttons?</h3>
+
+<p>By design, the toolbar is easily extensible.  For adding a custom button
+one needs to follow two steps.</p>
+
+<h4 id="regbtn">1. Register the button in <code>config.btnList</code>.</h4>
+
+<p>For each button in the toolbar, HTMLArea needs to know the following
+information:</p>
+<ul>
+  <li>a name for it (we call it the ID of the button);</li>
+  <li>the path to an image to be displayed in the toolbar;</li>
+  <li>a tooltip for it;</li>
+  <li>whether the button is enabled or not in text mode;</li>
+  <li>what to do when the button is clicked;</li>
+</ul>
+<p>You need to provide all this information for registering a new button
+too.  The button ID can be any string identifier and it's used when
+defining the toolbar, as you saw above.  We recommend starting
+it with "my-" so that it won't clash with the standard ID-s (those from
+the default toolbar).</p>
+
+<p class="note">Register button example #1</p>
+
+<pre class="code"
+><span class="comment">// get a default configuration
+</span><span class="keyword">var</span> <span class="variable-name">config</span> = <span class="keyword">new</span> HTMLArea.Config();
+<span class="comment">// register the new button using Config.registerButton.
+// parameters:        button ID,   tooltip,          image,           textMode,
+</span>config.registerButton(&quot;<span class="string">my-hilite</span>&quot;, &quot;<span class="string">Highlight text</span>&quot;, &quot;<span class="string">my-hilite.gif</span>&quot;, <span class="keyword">false</span>,
+<span class="comment">// function that gets called when the button is clicked
+</span>  <span class="keyword">function</span>(editor, id) {
+    editor.surroundHTML('<span class="string">&lt;span class=&quot;hilite&quot;&gt;</span>', '<span class="string">&lt;/span&gt;</span>');
+  }
+);</pre>
+
+<p>An alternate way of calling registerButton is exemplified above.  Though
+the code might be a little bit larger, using this form makes your code more
+maintainable.  It doesn't even needs comments as it's pretty clear.</p>
+
+<p class="note">Register button example #2</p>
+
+<pre class="code"
+><span class="keyword">var</span> <span class="variable-name">config</span> = <span class="keyword">new</span> HTMLArea.Config();
+config.registerButton({
+  id        : &quot;<span class="string">my-hilite</span>&quot;,
+  tooltip   : &quot;<span class="string">Highlight text</span>&quot;,
+  image     : &quot;<span class="string">my-hilite.gif</span>&quot;,
+  textMode  : <span class="keyword">false</span>,
+  action    : <span class="keyword">function</span>(editor, id) {
+                editor.surroundHTML('<span class="string">&lt;span class=&quot;hilite&quot;&gt;</span>', '<span class="string">&lt;/span&gt;</span>');
+              }
+});</pre>
+
+<p>You might notice that the "action" function receives two parameters:
+<b>editor</b> and <b>id</b>.  In the examples above we only used the
+<b>editor</b> parameter.  But it could be helpful for you to understand
+both:</p>
+
+<ul>
+  <li><b>editor</b> is a reference to the HTMLArea object.  Since our entire
+  code now has an <acronym title="Object Oriented Programming">OOP</acronym>-like
+  design, you need to have a reference to
+  the editor object in order to do things with it.  In previous versions of
+  HTMLArea, in order to identify the object an ID was used -- the ID of the
+  HTML element.  In this version ID-s are no longer necessary.</li>
+
+  <li><b>id</b> is the button ID.  Wondering why is this useful?  Well, you
+  could use the same handler function (presuming that it's not an anonymous
+  function like in the examples above) for more buttons.  You can <a
+  href="#btnex">see an example</a> a bit later in this document.</li>
+</ul>
+
+<h4>2. Inserting it into the toolbar</h4>
+
+<p>At this step you need to specify where in the toolbar to insert the
+button, or just create the whole toolbar again as you saw in the previous
+section.  You use the button ID, as shown in the examples of customizing the
+toolbar in the previous section.</p>
+
+<p>For the sake of completion, following there are another examples.</p>
+
+<p class="note">Append your button to the default toolbar</p>
+
+<pre class="code"
+>config.toolbar.push([ &quot;<span class="string">my-hilite</span>&quot; ]);</pre>
+
+<p class="note">Customized toolbar</p>
+
+<pre class="code"
+>config.toolbar = [
+  ['<span class="string">fontname</span>', '<span class="string">space</span>',
+   '<span class="string">fontsize</span>', '<span class="string">space</span>',
+   '<span class="string">formatblock</span>', '<span class="string">space</span>',
+   '<span class="string">separator</span>', '<span class="string">my-hilite</span>', '<span class="string">separator</span>', '<span class="string">space</span>', <span class="comment">// here's your button
+</span>   '<span class="string">bold</span>', '<span class="string">italic</span>', '<span class="string">underline</span>', '<span class="string">space</span>']
+];</pre>
+
+<p><span class="note">Note:</span> in the example above our new button is
+between two vertical separators.  But this is by no means required.  You can
+put it wherever you like.  Once registered in the btnList (<a
+href="#regbtn">step 1</a>) your custom button behaves just like a default
+button.</p>
+
+<p><span class="warning">Important:</span> It's recommended that you add
+custom features and configuration to a separate file.  This will ensure you
+that when we release a new official version of HTMLArea you'll have less
+trouble upgrading it.</p>
+
+<h4 id="btnex">A complete example</h4>
+
+<p>Please note that it is by no means necessary to include the following
+code into the htmlarea.js file.  On the contrary, it might not work there.
+The configuration system is designed such that you can always customize the
+editor <em>from outside files</em>, thus keeping the htmlarea.js file
+intact.  This will make it easy for you to upgrade your HTMLArea when we
+release a new official version.  OK, I promise it's the last time I said
+this. ;)</p>
+
+<pre class="code"
+><span class="comment">// All our custom buttons will call this function when clicked.
+// We use the <b>buttonId</b> parameter to determine what button
+// triggered the call.
+</span><span class="keyword">function</span> <span class="function-name">clickHandler</span>(editor, buttonId) {
+  <span class="keyword">switch</span> (buttonId) {
+    <span class="keyword">case</span> &quot;<span class="string">my-toc</span>&quot;:
+      editor.insertHTML(&quot;<span class="string">&lt;h1&gt;Table Of Contents&lt;/h1&gt;</span>&quot;);
+      <span class="keyword">break</span>;
+    <span class="keyword">case</span> &quot;<span class="string">my-date</span>&quot;:
+      editor.insertHTML((<span class="keyword">new</span> Date()).toString());
+      <span class="keyword">break</span>;
+    <span class="keyword">case</span> &quot;<span class="string">my-bold</span>&quot;:
+      editor.execCommand(&quot;<span class="string">bold</span>&quot;);
+      editor.execCommand(&quot;<span class="string">italic</span>&quot;);
+      <span class="keyword">break</span>;
+    <span class="keyword">case</span> &quot;<span class="string">my-hilite</span>&quot;:
+      editor.surroundHTML(&quot;<span class="string">&lt;span class=\&quot;hilite\&quot;&gt;</span>&quot;, &quot;<span class="string">&lt;/span&gt;</span>&quot;);
+      <span class="keyword">break</span>;
+  }
+};
+
+<span class="comment">// Create a new configuration object
+</span><span class="keyword">var</span> <span class="variable-name">config</span> = <span class="keyword">new</span> HTMLArea.Config();
+
+<span class="comment">// Register our custom buttons
+</span>config.registerButton(&quot;<span class="string">my-toc</span>&quot;,  &quot;<span class="string">Insert TOC</span>&quot;, &quot;<span class="string">my-toc.gif</span>&quot;, <span class="keyword">false</span>, clickHandler);
+config.registerButton(&quot;<span class="string">my-date</span>&quot;, &quot;<span class="string">Insert date/time</span>&quot;, &quot;<span class="string">my-date.gif</span>&quot;, <span class="keyword">false</span>, clickHandler);
+config.registerButton(&quot;<span class="string">my-bold</span>&quot;, &quot;<span class="string">Toggle bold/italic</span>&quot;, &quot;<span class="string">my-bold.gif</span>&quot;, <span class="keyword">false</span>, clickHandler);
+config.registerButton(&quot;<span class="string">my-hilite</span>&quot;, &quot;<span class="string">Hilite selection</span>&quot;, &quot;<span class="string">my-hilite.gif</span>&quot;, <span class="keyword">false</span>, clickHandler);
+
+<span class="comment">// Append the buttons to the default toolbar
+</span>config.toolbar.push([&quot;<span class="string">linebreak</span>&quot;, &quot;<span class="string">my-toc</span>&quot;, &quot;<span class="string">my-date</span>&quot;, &quot;<span class="string">my-bold</span>&quot;, &quot;<span class="string">my-hilite</span>&quot;]);
+
+<span class="comment">// Replace an existing textarea with an HTMLArea object having the above config.
+</span>HTMLArea.replace(&quot;<span class="string">textAreaID</span>&quot;, config);</pre>
+
+
+<hr />
+<address>&copy; <a href="http://interactivetools.com" title="Visit our website"
+>InteractiveTools.com</a> 2002-2004.
+<br />
+© <a href="http://dynarch.com">dynarch.com</a> 2003-2004<br />
+HTMLArea v3.0 developed by <a
+href="http://dynarch.com/mishoo/">Mihai Bazon</a>.
+<br />
+Documentation written by Mihai Bazon.
+</address>
+<!-- hhmts start --> Last modified: Wed Jan 28 12:18:23 EET 2004 <!-- hhmts end -->
+<!-- doc-lang: English -->
+</body> </html>
Index: /temp/trunk/html/test/nakatest/line.php
===================================================================
--- /temp/trunk/html/test/nakatest/line.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/line.php	(revision 1328)
@@ -0,0 +1,132 @@
+<?php
+require_once("./class/SC_GraphPie.php");
+require_once("./class/SC_GraphLine.php");
+
+$objGraphPie = new SC_GraphPie();
+$objGraphLine = new SC_GraphLine();
+
+$arrData1 = array(
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	23,
+	33,
+	58,
+	120,
+	3300,
+	4223,
+	5120,
+	2300,
+	3223,
+	100,
+	4250,
+	23,
+	100
+);
+
+$arrData2 = array(
+	3300,
+	4223,
+	5120,
+	2300,
+	3223,
+	100,
+	4250,
+	23,
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	23,
+	33,
+	58,
+	120,
+	100
+);
+
+$arrData3 = array(
+	6223,
+	6223,
+	6223,
+	6300,
+	3223,
+	2223,
+	6300,
+	6223,
+	5120,
+	2300,
+	3223,
+	6223,
+	6223,
+	3300,
+	4223,
+	5120,
+	6300,
+	3223,
+	2223,
+	3223,
+	2223,
+);
+
+$arrXLabel = array(
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',	
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î'
+);
+
+$arrLegend = array(
+	'»î¸³1',
+	'»î¸³2',
+	'»î¸³3'
+);
+
+// ¥°¥é¥ÕÉÁ²è
+$objGraphLine->setXLabel($arrXLabel);
+$objGraphLine->setXTitle("´ü´Ö(·î)");
+$objGraphLine->setYTitle("Çä¾å¤²(±ß)");
+$objGraphLine->setData($arrData1);
+//$objGraphLine->setData($arrData2);
+//$objGraphLine->setData($arrData3);
+// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+$objGraphLine->setLegend($arrLegend);
+$objGraphLine->drawGraph();
+$objGraphLine->outputGraph();
+
+?>
Index: /temp/trunk/html/test/nakatest/tool/file.php
===================================================================
--- /temp/trunk/html/test/nakatest/tool/file.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/tool/file.php	(revision 1328)
@@ -0,0 +1,24 @@
+<?php
+
+$fp = fopen("test.txt", 'r');
+while (!feof($fp)) {
+	$ret = fgets($fp, 1024);
+	$ret = ereg_replace("\n", "", $ret);
+	
+	if($ret != "" && !ereg("^-", $ret)) {
+		print("#$ret\n");
+		print("define host {\n");
+		print("\tuse\tgeneric-host\n");
+		print("\thost_name\t$ret\n");
+		print("\talias\t$ret\n");
+		print("\taddress\t$ret\n");
+		print("}\n");
+		print("\n");
+		$line.= $ret . ",";		
+	}
+}
+fclose($fp);
+
+print($line);
+
+?>
Index: /temp/trunk/html/test/nakatest/tool/test.txt
===================================================================
--- /temp/trunk/html/test/nakatest/tool/test.txt	(revision 1328)
+++ /temp/trunk/html/test/nakatest/tool/test.txt	(revision 1328)
@@ -0,0 +1,159 @@
+210.188.192.1
+210.188.192.2
+210.188.192.3
+210.188.192.4
+210.188.192.5
+210.188.192.6
+-
+210.188.192.7
+210.188.192.8
+210.188.192.9
+210.188.192.10
+210.188.192.11
+210.188.192.12
+210.188.192.13
+-
+-
+-210.188.192.14
+210.188.192.15
+210.188.192.16
+-210.188.192.17
+210.188.192.18
+210.188.192.19
+-210.188.192.20
+210.188.192.21
+210.188.192.22
+210.188.192.23
+210.188.192.24
+210.188.192.25
+-210.188.192.26
+210.188.192.27
+210.188.192.28
+-210.188.192.29
+-210.188.192.30
+-
+-
+-
+-
+-
+-
+-
+
+-
+-
+210.188.212.129
+210.188.212.130
+-210.188.212.131
+-210.188.212.132
+-210.188.212.133
+210.188.212.134
+-210.188.212.135
+210.188.212.136
+210.188.212.137
+210.188.212.138
+-210.188.212.139
+-210.188.212.140
+-210.188.212.141
+-210.188.212.142
+210.188.212.143
+210.188.212.144
+-210.188.212.145
+-
+-210.188.212.146
+210.188.212.147
+-210.188.212.148
+-210.188.212.149
+210.188.212.150
+-210.188.212.151
+-210.188.212.152
+-210.188.212.153
+-210.188.212.154
+-210.188.212.155
+-210.188.212.156
+-210.188.212.157
+-210.188.212.158
+-
+210.188.212.161
+210.188.212.162
+210.188.212.163
+-210.188.212.164
+210.188.212.165
+-
+-
+-
+-
+192.168.0.5
+192.168.0.145
+192.168.0.6
+192.168.0.7
+192.168.0.8
+192.168.0.9
+192.168.0.10
+192.168.0.210
+-
+192.168.0.211
+192.168.0.201
+192.168.0.13
+-
+-192.168.0.30
+-
+192.168.0.203
+192.168.0.18
+192.168.0.19
+-
+-
+-
+-
+-
+-
+-
+-
+-
+192.168.0.202
+-
+192.168.0.101
+192.168.0.102
+-192.168.0.103
+192.168.0.104
+192.168.0.105
+
+192.168.0.121
+
+192.168.0.149
+
+-
+-
+192.168.0.131
+
+-192.168.0.133
+192.168.0.134
+-
+-
+-
+-
+192.168.0.139
+-
+192.168.0.141
+192.168.0.142
+192.168.0.143
+192.168.0.144
+192.168.0.205
+192.168.0.206
+
+192.168.0.147
+192.168.0.148
+
+
+192.168.0.207
+192.168.0.208
+192.168.0.209
+
+
+
+
+-
+-
+-
+192.168.0.163
+192.168.0.164
+-192.168.0.165
Index: /temp/trunk/html/test/nakatest/info.php
===================================================================
--- /temp/trunk/html/test/nakatest/info.php	(revision 1328)
+++ /temp/trunk/html/test/nakatest/info.php	(revision 1328)
@@ -0,0 +1,3 @@
+<?php
+	phpinfo();
+?>
Index: /temp/trunk/html/tokado/freedom.php
===================================================================
--- /temp/trunk/html/tokado/freedom.php	(revision 1328)
+++ /temp/trunk/html/tokado/freedom.php	(revision 1328)
@@ -0,0 +1,20 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/tokado/freedom.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'tokado/freedom.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+$objView->assignobj($objPage);
+$objView->display('tokado/freedom.tpl');
+
+//-----------------------------------------------------------------------------------------------------------------------------------
Index: /temp/trunk/html/tokado/index.php
===================================================================
--- /temp/trunk/html/tokado/index.php	(revision 1328)
+++ /temp/trunk/html/tokado/index.php	(revision 1328)
@@ -0,0 +1,22 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/tokado/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'tokado/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¥È¡¼¥«Æ²¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/requirements/index.php
===================================================================
--- /temp/trunk/html/requirements/index.php	(revision 1328)
+++ /temp/trunk/html/requirements/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/movement/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'movement/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = "Æ°ºî´Ä¶­¤Ë¤Ä¤¤¤Æ";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
Index: /temp/trunk/html/requirements/browser/win_ie5.html
===================================================================
--- /temp/trunk/html/requirements/browser/win_ie5.html	(revision 1328)
+++ /temp/trunk/html/requirements/browser/win_ie5.html	(revision 1328)
@@ -0,0 +1,52 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../../css/sub.css" type="text/css" media="all" />
+<script type="text/javascript" src="../../js/css.js"></script>
+<script type="text/javascript" src="../../js/navi.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-¥«¡¼¥ÈÍøÍÑ»þ¤Î¥Ö¥é¥¦¥¶¤ÎÌäÂê¤Ë¤Ä¤¤¤Æ<</title>
+</head>
+
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../../css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr>
+		<td colspan="2" height="70"><img src="../../img/movement/win/wintitle.gif" width="278" height="55" alt="Windows¤ò¤´ÍøÍÑ¤ÎÊý"></td>
+	</tr>
+	<tr><td height="15"></td></tr>
+	<tr>
+		<td colspan="2" height="45"><img src="../../img/movement/win/ie5title.gif" width="550" height="37" alt="Internet Explorer5.x¥¿¥¤¥È¥ë"></td>
+	</tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/ie5_1.gif" width="300" height="250" alt="Internet Explorer5.x-1"></td>
+		<td width="235" valign="top" class="fs12"><br />¥Ö¥é¥¦¥¶¤Î¥á¥Ë¥å¡¼¤«¤é¡Ö¥Ä¡¼¥ë¡×¢ª¡Ö¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥ª¥×¥·¥ç¥ó¡×¤òÁª¤Ó¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="20"></td></tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/ie5_2.gif" width="300" height="266" alt="Internet Explorer5.x-2"></td>
+		<td width="235" valign="top" class="fs12"><br />¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥ª¥×¥·¥ç¥ó¤Î¥á¥Ë¥å¡¼¤ÎÃæ¤«¤é¡Ö¥»¥­¥å¥ê¥Æ¥£¥¿¥Ö¡×¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤Èº¸¤Î²èÌÌ¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£ ¤³¤³¤Ç¡Ö¥ì¥Ù¥ë¤Î¥«¥¹¥¿¥Þ¥¤¥º¥Ü¥¿¥ó¡×¤ò²¡¤·¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="20"></td></tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/ie5_3.gif" width="300" height="275" alt="Internet Explorer5.x-3"></td>
+		<td width="235" valign="top" class="fs12"><br />¥»¥­¥å¥ê¥Æ¥£ÀßÄê¤Î¾ÜºÙ²èÌÌ¤¬É½¼¨¤µ¤ì¤Þ¤¹¤Î¤Ç¡Ö¥»¥Ã¥·¥ç¥ó¤´¤È¤ÎCookie¤Î»ÈÍÑµö²Ä¡×¤È¤¤¤¦¹àÌÜ¤Î¡ÖÍ­¸ú¤Ë¤¹¤ë¡×¤Ë¥Á¥§¥Ã¥¯¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£OK¥Ü¥¿¥ó¤ò²¡¤·¤Æ²èÌÌ¤òÊÄ¤¸¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥ª¥×¥·¥ç¥ó²èÌÌ¤âÊÄ¤¸¤Þ¤¹¡£¤³¤ì¤ÇÀßÄê¤Ï´°Î»¤Ç¤¹¡£</td>
+	</tr>
+	<tr><td height="40"></td></tr>
+</table>
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr align="right">
+		<td height="65"><a href="javascript:window.close()" onmouseOver="chgImg('../../img/movement/mac/close_over.gif','close');" onmouseOut="chgImg('../../img/movement/mac/close.gif','close');"><img border="0" src="../../img/movement/mac/close.gif" width="64" height="14" alt="CLOSE" name="close" id="close" /></a></td>
+	</tr>
+</table>
+</div>
+</body>
+</html>
Index: /temp/trunk/html/requirements/browser/win_nn7.html
===================================================================
--- /temp/trunk/html/requirements/browser/win_nn7.html	(revision 1328)
+++ /temp/trunk/html/requirements/browser/win_nn7.html	(revision 1328)
@@ -0,0 +1,47 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../../css/sub.css" type="text/css" media="all" />
+<script type="text/javascript" src="../../js/css.js"></script>
+<script type="text/javascript" src="../../js/navi.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-¥«¡¼¥ÈÍøÍÑ»þ¤Î¥Ö¥é¥¦¥¶¤ÎÌäÂê¤Ë¤Ä¤¤¤Æ<</title>
+</head>
+
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../../css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr>
+		<td colspan="2" height="70"><img src="../../img/movement/win/wintitle.gif" width="278" height="55" alt="Windows¤ò¤´ÍøÍÑ¤ÎÊý"></td>
+	</tr>
+	<tr><td height="15"></td></tr>
+	<tr>
+		<td colspan="2" height="45"><img src="../../img/movement/win/nn7title.gif" width="550" height="37" alt="Netscape Communicator7.x¥¿¥¤¥È¥ë"></td>
+	</tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/nn7_1.gif" width="300" height="250" alt="Netscape Communicator7.x-1"></td>
+		<td width="235" valign="top" class="fs12"><br />¥Õ¥¡¥¤¥ë¥á¥Ë¥å¡¼¤Î¡ÖÊÔ½¸¡×¤«¤é¡ÖÀßÄê¡×¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="20"></td></tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/nn7_2.gif" width="300" height="240" alt="Netscape Communicator7.x-2"></td>
+		<td width="235" valign="top" class="fs12"><br />¥«¥Æ¥´¥ê¤Î¡Ö¾ÜºÙ¡×¡Ý¡ÖCookie¡×¤Ç¡¢¡Ö¥¹¥¯¥ê¥×¥È¤È¡¦¡¦¡¦¡×¤òÁªÂò¤·¡ÖCookie¤òºîÀ®¤Þ¤¿¤ÏÊÑ¹¹¤¹¤ë¡×¡ÖCookie¤òÆÉ¤à¡×¤Ë¥Á¥§¥Ã¥¯¤ò¤·OK¤ò²¡¤·¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="40"></td></tr>
+</table>
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr align="right">
+		<td height="65"><a href="javascript:window.close()" onmouseOver="chgImg('../../img/movement/mac/close_over.gif','close');" onmouseOut="chgImg('../../img/movement/mac/close.gif','close');"><img border="0" src="../../img/movement/mac/close.gif" width="64" height="14" alt="CLOSE" name="close" id="close" /></a></td>
+	</tr>
+</table>
+</div>
+</body>
+</html>
Index: /temp/trunk/html/requirements/browser/win_ie6.html
===================================================================
--- /temp/trunk/html/requirements/browser/win_ie6.html	(revision 1328)
+++ /temp/trunk/html/requirements/browser/win_ie6.html	(revision 1328)
@@ -0,0 +1,52 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../../css/sub.css" type="text/css" media="all" />
+<script type="text/javascript" src="../../js/css.js"></script>
+<script type="text/javascript" src="../../js/navi.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-¥«¡¼¥ÈÍøÍÑ»þ¤Î¥Ö¥é¥¦¥¶¤ÎÌäÂê¤Ë¤Ä¤¤¤Æ<</title>
+</head>
+
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../../css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr>
+		<td colspan="2" height="70"><img src="../../img/movement/win/wintitle.gif" width="278" height="55" alt="Windows¤ò¤´ÍøÍÑ¤ÎÊý"></td>
+	</tr>
+	<tr><td height="15"></td></tr>
+	<tr>
+		<td colspan="2" height="45"><img src="../../img/movement/win/ie6title.gif" width="550" height="37" alt="Internet Explorer6.x¥¿¥¤¥È¥ë"></td>
+	</tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/ie6_1.gif" width="300" height="250" alt="Internet Explorer6.x-1"></td>
+		<td width="235" valign="top" class="fs12"><br />¥Ö¥é¥¦¥¶¤Î¥á¥Ë¥å¡¼¤«¤é¡Ö¥Ä¡¼¥ë¡×¢ª¡Ö¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥ª¥×¥·¥ç¥ó¡×¤òÁª¤Ó¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="20"></td></tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/ie6_2.gif" width="300" height="266" alt="Internet Explorer6.x-2"></td>
+		<td width="235" valign="top" class="fs12"><br />¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥ª¥×¥·¥ç¥ó¤Î¥á¥Ë¥å¡¼¤ÎÃæ¤«¤é¡Ö¥×¥é¥¤¥Ð¥·¡¼¥¿¥Ö¡×¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤Èº¸¤Î²èÌÌ¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£ ¤³¤³¤Ç¡Ö¾ÜºÙÀßÄê¥Ü¥¿¥ó¡×¤ò²¡¤·¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="20"></td></tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/win/ie6_3.gif" width="300" height="186" alt="Internet Explorer6.x-3"></td>
+		<td width="235" valign="top" class="fs12"><br />¥×¥é¥¤¥Ð¥·¡¼ÀßÄê¤Î¾ÜºÙ²èÌÌ¤¬É½¼¨¤µ¤ì¤Þ¤¹¤Î¤Ç¡Ö¼«Æ°Cookie½èÍý¤ò¾å½ñ¤­¤¹¤ë¡×¤È¤¤¤¦¹àÌÜ¤Ë¥Á¥§¥Ã¥¯¤òÆþ¤ì¡¢Í­¸ú¤Ë¤·¤Æ²¼¤µ¤¤¡£OK¥Ü¥¿¥ó¤ò²¡¤·¤Æ²èÌÌ¤òÊÄ¤¸¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥ª¥×¥·¥ç¥ó²èÌÌ¤âÊÄ¤¸¤Þ¤¹¡£¤³¤ì¤ÇÀßÄê¤Ï´°Î»¤Ç¤¹¡£</td>
+	</tr>
+	<tr><td height="40"></td></tr>
+</table>
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr align="right">
+		<td height="65"><a href="javascript:window.close()" onmouseOver="chgImg('../../img/movement/mac/close_over.gif','close');" onmouseOut="chgImg('../../img/movement/mac/close.gif','close');"><img border="0" src="../../img/movement/mac/close.gif" width="64" height="14" alt="CLOSE" name="close" id="close" /></a></td>
+	</tr>
+</table>
+</div>
+</body>
+</html>
Index: /temp/trunk/html/requirements/browser/mac_nn7.html
===================================================================
--- /temp/trunk/html/requirements/browser/mac_nn7.html	(revision 1328)
+++ /temp/trunk/html/requirements/browser/mac_nn7.html	(revision 1328)
@@ -0,0 +1,47 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../../css/sub.css" type="text/css" media="all" />
+<script type="text/javascript" src="../../js/css.js"></script>
+<script type="text/javascript" src="../../js/navi.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-¥«¡¼¥ÈÍøÍÑ»þ¤Î¥Ö¥é¥¦¥¶¤ÎÌäÂê¤Ë¤Ä¤¤¤Æ<</title>
+</head>
+
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../../css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr>
+		<td colspan="2"><img src="../../img/movement/mac/mactitle.gif" width="298" height="75" alt="Macintosh¤ò¤´ÍøÍÑ¤ÎÊý" /></td>
+	</tr>
+	<tr><td height="15"></td></tr>
+	<tr>
+		<td colspan="2" height="45"><img src="../../img/movement/mac/nn7title.gif" width="550" height="37" alt="Netscape Communicator7.x¥¿¥¤¥È¥ë"></td>
+	</tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/mac/nn7_1.gif" width="300" height="256" alt="Netscape Communicator7.x-1"></td>
+		<td width="235" valign="top" class="fs12"><br />¥Õ¥¡¥¤¥ë¥á¥Ë¥å¡¼¤Î¡ÖÊÔ½¸¡×¤«¤é¡ÖÀßÄê¡×¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="20"></td></tr>
+	<tr>
+		<td width="315"><img src="../../img/movement/mac/nn7_2.gif" width="300" height="214" alt="Netscape Communicator7.x-2"></td>
+		<td width="235" valign="top" class="fs12"><br />¥«¥Æ¥´¥ê¤Î¡Ö¾ÜºÙ¡×¡Ý¡ÖCookie¡×¤Ç¡¢¡Ö¥¹¥¯¥ê¥×¥È¤È¡¦¡¦¡¦¡×¤òÁªÂò¤·¡ÖCookie¤òºîÀ®¤Þ¤¿¤ÏÊÑ¹¹¤¹¤ë¡×¡ÖCookie¤òÆÉ¤à¡×¤Ë¥Á¥§¥Ã¥¯¤ò¤·OK¤ò²¡¤·¤Þ¤¹¡£</td>
+	</tr>
+	<tr><td height="40"></td></tr>
+</table>
+<table width="550" border="0" cellspacing="0" cellpadding="0">
+	<tr align="right">
+		<td height="65"><a href="javascript:window.close()" onmouseOver="chgImg('../../img/movement/mac/close_over.gif','close');" onmouseOut="chgImg('../../img/movement/mac/close.gif','close');"><img border="0" src="../../img/movement/mac/close.gif" width="64" height="14" alt="CLOSE" name="close" id="close" /></a></td>
+	</tr>
+</table>
+</div>
+</body>
+</html>
Index: /temp/trunk/html/shopping/complete.php
===================================================================
--- /temp/trunk/html/shopping/complete.php	(revision 1328)
+++ /temp/trunk/html/shopping/complete.php	(revision 1328)
@@ -0,0 +1,487 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/complete.tpl';
+		$this->tpl_css = '/css/layout/shopping/complete.css';
+		$this->tpl_title = "¤´ÃíÊ¸´°Î»";
+		// ¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥¿¥°¤ÎÉ½¼¨
+		$this->conversion_tag = true;
+		global $arrCONVENIENCE;
+		$this->arrCONVENIENCE = $arrCONVENIENCE;
+		global $arrCONVENIMESSAGE;
+		$this->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+		global $arrCONVENIENCE;
+		global $arrCONVENIMESSAGE;
+		$objPage->arrCONVENIENCE = $arrCONVENIENCE;
+		$objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+$objCustomer = new SC_Customer();
+
+if($_GET['mode'] != 'reload') {
+	// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿¤«È½Äê
+	sfIsPrePage($objSiteSess);
+	// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+	$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+	if ($uniqid != "") {
+
+		// ´°Î»½èÍý
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		$order_id = lfDoComplete($objQuery, $uniqid);
+		$objQuery->commit();
+		
+		// ¥»¥Ã¥·¥ç¥ó¤ËÊÝ´É¤µ¤ì¤Æ¤¤¤ë¾ðÊó¤ò¹¹¿·¤¹¤ë
+		$objCustomer->updateSession();
+
+		// ´°Î»¥á¡¼¥ëÁ÷¿®
+		if($order_id != "") {
+			sfSendOrderMail($order_id, '1');
+		}
+		
+		//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó¤Î¼èÆÀ
+		$conveni_data = $objQuery->get("dtb_order", "conveni_data", "order_id = ? ", array($order_id));
+		if($conveni_data != "") {
+			$objPage->arrConv = unserialize($conveni_data);
+		}
+		
+		// ¥ê¥í¡¼¥É¤Ë¤è¤ëÆó½ÅÅÐÏ¿ËÉ»ß
+		sfReload("mode=reload"); 
+	}
+}
+
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+// ¥¨¥Ó¥¹¥¿¥°°úÅÏ¤·ÍÑ¥Ç¡¼¥¿¤òÀ¸À®¤¹¤ë
+function lfGetEbisData($order_id) {
+	$objQuery = new SC_Query();
+	$col = "customer_id, total, order_sex, order_job, to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) AS order_age";
+	$arrRet = $objQuery->select($col, "dtb_order", "order_id = ?", array($order_id));
+	
+	if($arrRet[0]['customer_id'] > 0) {
+		// ²ñ°÷ÈÖ¹æ
+		$arrEbis['m1id'] = $arrRet[0]['customer_id'];
+		// Èó²ñ°÷or²ñ°÷
+		$arrEbis['o5id'] = '1';
+	} else {
+		// ²ñ°÷ÈÖ¹æ
+		$arrEbis['m1id'] = '';
+		// Èó²ñ°÷or²ñ°÷
+		$arrEbis['o5id'] = '2';	
+	}
+	
+	// ¹ØÆþ¶â³Û
+	$arrEbis['a1id'] = $arrRet[0]['total'];
+	// À­ÊÌ
+	$arrEbis['o2id'] = $arrRet[0]['order_sex'];
+	// Ç¯Îð
+	$arrEbis['o3id'] = $arrRet[0]['order_age'];
+	// ¿¦¶È
+	$arrEbis['o4id'] = $arrRet[0]['order_job'];
+		
+	$objQuery->setgroupby("product_id");
+	$arrRet = $objQuery->select("product_id", "dtb_order_detail", "order_id = ?", array($order_id));
+	$arrProducts = sfSwapArray($arrRet);
+	
+	$line = "";
+	// ¾¦ÉÊID¤ò¥¢¥ó¥À¡¼¥Ð¡¼¤ÇÀÜÂ³¤¹¤ë¡£
+	foreach($arrProducts['product_id'] as $val) {
+		if($line != "") {
+			$line .= "_$val";		
+		} else {
+			$line .= "$val";
+		}
+	}
+	
+	// ¾¦ÉÊID	
+	$arrEbis['o1id'] = $line;
+	
+	return $arrEbis;
+}
+
+// ´°Î»½èÍý
+function lfDoComplete($objQuery, $uniqid) {
+	global $objCartSess;
+	global $objSiteSess;
+	global $objCustomer;
+	global $arrInfo;
+	
+	// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+	$arrData = sfGetOrderTemp($uniqid);
+	
+	// ²ñ°÷¾ðÊóÅÐÏ¿½èÍý
+	if ($objCustomer->isLoginSuccess()) {
+		// ¿·¤ªÆÏ¤±Àè¤ÎÅÐÏ¿
+		lfSetNewAddr($uniqid, $objCustomer->getValue('customer_id'));
+		// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+		lfSetCustomerPurchase($objCustomer->getValue('customer_id'), $arrData);
+	} else {
+		//¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿
+		switch(PURCHASE_CUSTOMER_REGIST) {
+		//Ìµ¸ú
+		case '0':
+			// ¹ØÆþ»þ²ñ°÷ÅÐÏ¿
+			if($arrData['member_check'] == '1') {
+				// ²¾²ñ°÷ÅÐÏ¿
+				$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+				// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+				lfSetCustomerPurchase($customer_id, $arrData);
+			}
+			break;
+		//Í­¸ú
+		case '1':
+			// ²¾²ñ°÷ÅÐÏ¿
+			$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+			// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+			lfSetCustomerPurchase($customer_id, $arrData);
+			break;
+		}
+		
+	}
+
+	// °ì»þ¥Æ¡¼¥Ö¥ë¤ò¼õÃí¥Æ¡¼¥Ö¥ë¤Ë³ÊÇ¼¤¹¤ë
+	$order_id = lfRegistOrder($objQuery, $arrData);
+	// ¥«¡¼¥È¾¦ÉÊ¤ò¼õÃí¾ÜºÙ¥Æ¡¼¥Ö¥ë¤Ë³ÊÇ¼¤¹¤ë
+	lfRegistOrderDetail($objQuery, $order_id, $objCartSess);
+	// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¾ðÊó¤òºï½ü¤¹¤ë¡£
+	lfDeleteTempOrder($objQuery, $uniqid);
+	
+	// ¥»¥Ã¥·¥ç¥ó¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ¤òºï½ü¤¹¤ë¡£
+	$objCartSess->delAllProducts();
+	// ÃíÊ¸°ì»þID¤ò²ò½ü¤¹¤ë¡£
+	$objSiteSess->unsetUniqId();
+	
+	return $order_id;
+}
+
+// ²ñ°÷ÅÐÏ¿¡Ê²¾ÅÐÏ¿¡Ë
+function lfRegistPreCustomer($arrData, $arrInfo) {
+	// ¹ØÆþ»þ¤Î²ñ°÷ÅÐÏ¿
+	$sqlval['name01'] = $arrData['order_name01'];
+	$sqlval['name02'] = $arrData['order_name02'];
+	$sqlval['kana01'] = $arrData['order_kana01'];
+	$sqlval['kana02'] = $arrData['order_kana02'];
+	$sqlval['zip01'] = $arrData['order_zip01'];
+	$sqlval['zip02'] = $arrData['order_zip02'];
+	$sqlval['pref'] = $arrData['order_pref'];
+	$sqlval['addr01'] = $arrData['order_addr01'];
+	$sqlval['addr02'] = $arrData['order_addr02'];
+	$sqlval['email'] = $arrData['order_email'];
+	$sqlval['tel01'] = $arrData['order_tel01'];
+	$sqlval['tel02'] = $arrData['order_tel02'];
+	$sqlval['tel03'] = $arrData['order_tel03'];
+	$sqlval['fax01'] = $arrData['order_fax01'];
+	$sqlval['fax02'] = $arrData['order_fax02'];
+	$sqlval['fax03'] = $arrData['order_fax03'];
+	$sqlval['sex'] = $arrData['order_sex'];
+	$sqlval['password'] = $arrData['password'];
+	$sqlval['reminder'] = $arrData['reminder'];
+	$sqlval['reminder_answer'] = $arrData['reminder_answer'];
+	// ²ñ°÷²¾ÅÐÏ¿
+	$sqlval['status'] = 1;
+	// URLÈ½ÄêÍÑ¥­¡¼
+	$sqlval['secret_key'] = sfGetUniqRandomId("t"); 
+	
+	$objQuery = new SC_Query();
+	$objQuery->insert("dtb_customer", $sqlval);
+	
+	// ¸ÜµÒID¤Î¼èÆÀ
+	$arrRet = $objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
+	$customer_id = $arrRet[0]['customer_id'];
+	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÑ¥Õ¥é¥°¤ÎÈ½Äê
+	switch($arrData['mail_flag']) {
+	case '1':	// HTML¥á¡¼¥ë
+		$mail_flag = 4;
+		break;
+	case '2':	// TEXT¥á¡¼¥ë
+		$mail_flag = 5;
+		break;
+	case '3':	// ´õË¾¤Ê¤·
+		$mail_flag = 6;
+		break;
+	default:
+		$mail_flag = 6;
+		break;
+	}
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÑ¥Æ¡¼¥Ö¥ëÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $mail_flag);
+	
+	//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+	$objMailPage = new LC_Page();
+	$objMailPage->to_name01 = $arrData['order_name01'];
+	$objMailPage->to_name02 = $arrData['order_name02'];
+	$objMailPage->CONF = $arrInfo;
+	$objMailPage->uniqid = $sqlval['secret_key'];
+	$objMailView = new SC_SiteView();
+	$objMailView->assignobj($objMailPage);
+	$body = $objMailView->fetch("mail_templates/customer_mail.tpl");
+	
+	$objMail = new GC_SendMail();
+	$objMail->setItem(
+						''										//¡¡°¸Àè
+						, sfMakeSubject("²ñ°÷ÅÐÏ¿¤Î¤´³ÎÇ§")		//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $body									//¡¡ËÜÊ¸
+						, $arrInfo['email03']					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $arrInfo['shop_name']					//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $arrInfo["email03"]					//¡¡reply_to
+						, $arrInfo["email04"]					//¡¡return_path
+						, $arrInfo["email04"]					//  Errors_to
+						, $arrInfo["email01"]					//  Bcc
+														);
+	// °¸Àè¤ÎÀßÄê
+	$name = $arrData['order_name01'] . $arrData['order_name02'] ." ÍÍ";
+	$objMail->setTo($arrData['order_email'], $name);			
+	$objMail->sendMail();
+	
+	return $customer_id;
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¤ªÆÏ¤±Àè¤ò¥³¥Ô¡¼¤¹¤ë
+function lfCopyDeliv($uniqid, $arrData) {
+	$objQuery = new SC_Query();
+	
+	// ÊÌ¤Î¤ªÆÏ¤±Àè¤ò»ØÄê¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
+	if($arrData["deliv_check"] != "1") {
+		$sqlval['deliv_name01'] = $arrData['order_name01'];
+		$sqlval['deliv_name02'] = $arrData['order_name02'];
+		$sqlval['deliv_kana01'] = $arrData['order_kana01'];
+		$sqlval['deliv_kana02'] = $arrData['order_kana02'];
+		$sqlval['deliv_pref'] = $arrData['order_pref'];
+		$sqlval['deliv_zip01'] = $arrData['order_zip01'];
+		$sqlval['deliv_zip02'] = $arrData['order_zip02'];
+		$sqlval['deliv_addr01'] = $arrData['order_addr01'];
+		$sqlval['deliv_addr02'] = $arrData['order_addr02'];
+		$sqlval['deliv_tel01'] = $arrData['order_tel01'];
+		$sqlval['deliv_tel02'] = $arrData['order_tel02'];
+		$sqlval['deliv_tel03'] = $arrData['order_tel03'];
+		$where = "order_temp_id = ?";
+		$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+	}
+}
+
+// ¼õÃí¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
+function lfRegistOrder($objQuery, $arrData) {
+	$sqlval = $arrData;
+
+	// ¼õÃí¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤Þ¤Ê¤¤Îó¤ò½üµî
+	unset($sqlval['mail_flag']);		// ¥á¥ë¥Þ¥¬¥Á¥§¥Ã¥¯
+	unset($sqlval['deliv_check']);		// ÊÌ¤Î¤ªÆÏ¤±Àè¥Á¥§¥Ã¥¯
+	unset($sqlval['point_check']);		// ¥Ý¥¤¥ó¥ÈÍøÍÑ¥Á¥§¥Ã¥¯
+	unset($sqlval['member_check']);		// ¹ØÆþ»þ²ñ°÷¥Á¥§¥Ã¥¯
+	unset($sqlval['password']);			// ¥í¥°¥¤¥ó¥Ñ¥¹¥ï¡¼¥É
+	unset($sqlval['reminder']);			// ¥ê¥Þ¥¤¥ó¥À¡¼¼ÁÌä
+	unset($sqlval['reminder_answer']);	// ¥ê¥Þ¥¤¥ó¥À¡¼Åú¤¨
+	
+	$order_id = $objQuery->nextval("dtb_order", "order_id");
+	$sqlval['order_id'] = $order_id;
+	$sqlval['status'] = '1';			// ÃíÊ¸¥¹¥Æ¡¼¥¿¥¹:¿·µ¬¼õÉÕ¤ËÀßÄê
+	
+	// ÊÌ¤Î¤ªÆÏ¤±Àè¤ò»ØÄê¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
+	if($arrData["deliv_check"] != "1") {
+		$sqlval['deliv_name01'] = $arrData['order_name01'];
+		$sqlval['deliv_name02'] = $arrData['order_name02'];
+		$sqlval['deliv_kana01'] = $arrData['order_kana01'];
+		$sqlval['deliv_kana02'] = $arrData['order_kana02'];
+		$sqlval['deliv_pref'] = $arrData['order_pref'];
+		$sqlval['deliv_zip01'] = $arrData['order_zip01'];
+		$sqlval['deliv_zip02'] = $arrData['order_zip02'];
+		$sqlval['deliv_addr01'] = $arrData['order_addr01'];
+		$sqlval['deliv_addr02'] = $arrData['order_addr02'];
+		$sqlval['deliv_tel01'] = $arrData['order_tel01'];
+		$sqlval['deliv_tel02'] = $arrData['order_tel02'];
+		$sqlval['deliv_tel03'] = $arrData['order_tel03'];
+	}
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_order", $sqlval);
+	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®´õË¾¾ðÊó¤ÎÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $arrData['mail_flag']);
+	
+	return $order_id;
+}
+
+// ¼õÃí¾ÜºÙ¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
+function lfRegistOrderDetail($objQuery, $order_id, $objCartSess) {
+	// ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
+	$arrCart = $objCartSess->getCartList();
+	$max = count($arrCart);
+	
+	// ´û¤ËÂ¸ºß¤¹¤ë¾ÜºÙ¥ì¥³¡¼¥É¤ò¾Ã¤·¤Æ¤ª¤¯¡£
+	$objQuery->delete("dtb_order_detail", "order_id = ?", $order_id);
+
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+			
+	for ($i = 0; $i < $max; $i++) {
+		// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+		$arrData = sfGetProductsClass($arrCart[$i]['id']);
+		
+		// Â¸ºß¤¹¤ë¾¦ÉÊ¤Î¤ßÉ½¼¨¤¹¤ë¡£
+		if($arrData != "") {
+			$sqlval['order_id'] = $order_id;
+			$sqlval['product_id'] = $arrCart[$i]['id'][0];
+			$sqlval['classcategory_id1'] = $arrCart[$i]['id'][1];
+			$sqlval['classcategory_id2'] = $arrCart[$i]['id'][2];
+			$sqlval['product_name'] = $arrData['name'];
+			$sqlval['product_code'] = $arrData['product_code'];
+			$sqlval['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
+			$sqlval['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
+			$sqlval['point_rate'] = $arrCart[$i]['point_rate'];			
+			$sqlval['price'] = $arrCart[$i]['price'];
+			$sqlval['quantity'] = $arrCart[$i]['quantity'];
+			lfReduceStock($objQuery, $arrCart[$i]['id'], $arrCart[$i]['quantity']);
+			// INSERT¤Î¼Â¹Ô
+			$objQuery->insert("dtb_order_detail", $sqlval);
+		} else {
+			sfDispSiteError(CART_NOT_FOUND);
+		}
+	}
+}
+
+/* ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Îºï½ü */
+function lfDeleteTempOrder($objQuery, $uniqid) {
+	$where = "order_temp_id = ?";
+	$sqlval['delete'] = 1;
+	$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+	// $objQuery->delete("dtb_order_temp", $where, array($uniqid));
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î½»½ê¤¬ÅÐÏ¿ºÑ¤ß¥Æ¡¼¥Ö¥ë¤È°Û¤Ê¤ë¾ì¹ç¤Ï¡¢ÊÌ¤Î¤ªÆÏ¤±Àè¤ËÄÉ²Ã¤¹¤ë
+function lfSetNewAddr($uniqid, $customer_id) {
+	$objQuery = new SC_Query();
+	$diff = false;
+	$find_same = false;
+	
+	$col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
+	
+	// Í×ÁÇÌ¾¤Îdeliv_¤òºï½ü¤¹¤ë¡£
+	foreach($arrRet[0] as $key => $val) {
+		$keyname = ereg_replace("^deliv_", "", $key);
+		$arrNew[$keyname] = $val;
+	}
+	
+	// ²ñ°÷¾ðÊó¥Æ¡¼¥Ö¥ë¤È¤ÎÈæ³Ó
+	$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
+	$where = "customer_id = ?";
+	$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
+	
+	// ²ñ°÷¾ðÊó¤Î½»½ê¤È°Û¤Ê¤ë¾ì¹ç
+	if($arrNew != $arrCustomerAddr[0]) {
+		// ÊÌ¤Î¤ªÆÏ¤±Àè¥Æ¡¼¥Ö¥ë¤Î½»½ê¤ÈÈæ³Ó¤¹¤ë
+		$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
+		$where = "customer_id = ?";
+		$arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
+
+		foreach($arrOtherAddr as $arrval) {
+			if($arrNew == $arrval) {
+				// ¤¹¤Ç¤ËÆ±¤¸½»½ê¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë
+				$find_same = true;
+			}
+		}
+		
+		if(!$find_same) {
+			$diff = true;
+		}
+	}
+	
+	// ¿·¤·¤¤¤ªÆÏ¤±Àè¤¬ÅÐÏ¿ºÑ¤ß¤Î¤â¤Î¤È°Û¤Ê¤ë¾ì¹ç¤ÏÊÌ¤Î¤ªÆÏ¤±Àè¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë
+	if($diff) {
+		$sqlval = $arrNew;
+		$sqlval['customer_id'] = $customer_id;
+		$objQuery->insert("dtb_other_deliv", $sqlval);
+	}
+}
+
+/* ¹ØÆþ¾ðÊó¤ò²ñ°÷¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë */
+function lfSetCustomerPurchase($customer_id, $arrData) {
+	$objQuery = new SC_Query();
+	$col = "first_buy_date, last_buy_date, buy_times, buy_total, point";
+	$where = "customer_id = ?";
+	$arrRet = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
+	$sqlval = $arrRet[0];
+	
+	if($sqlval['first_buy_date'] == "") {
+		$sqlval['first_buy_date'] = "Now()";
+	}
+	$sqlval['last_buy_date'] = "Now()";
+	$sqlval['buy_times']++;
+	$sqlval['buy_total']+= $arrData['total'];
+	$sqlval['point'] = ($sqlval['point'] + $arrData['add_point'] - $arrData['use_point']);
+	
+	// ¥Ý¥¤¥ó¥È¤¬ÉÔÂ­¤·¤Æ¤¤¤ë¾ì¹ç
+	if($sqlval['point'] < 0) {
+		$objQuery->rollback();
+		sfDispSiteError(LACK_POINT);
+	}
+	
+	$objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
+}
+
+/* Èó²ñ°÷¤Î¥á¥ë¥Þ¥¬¥Æ¡¼¥Ö¥ë¤Ø¤ÎÅÐÏ¿ */
+function lfRegistNonCustomer($email, $mail_flag) {
+	$objQuery = new SC_Query();
+	$objQuery->begin();	
+	// ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+	if(!sfCheckCustomerMailMaga($email)) {
+		$where = "email = ?";
+		$objQuery->delete("dtb_customer_mail", $where, array($email));
+		$sqlval['email'] = $email;
+		$sqlval['mail_flag'] = $mail_flag;
+		$objQuery->insert("dtb_customer_mail", $sqlval);
+	}
+	$objQuery->commit();
+}
+
+// ºß¸Ë¤ò¸º¤é¤¹½èÍý
+function lfReduceStock($objQuery, $arrID, $quantity) {
+	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+	$arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
+	
+	// Çä¤êÀÚ¤ì¥¨¥é¡¼
+	if(($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
+		$objQuery->rollback();
+		sfDispSiteError(SOLD_OUT);
+	// ÌµÀ©¸Â¤Î¾ì¹ç¡¢ºß¸Ë¤ÏNULL
+	} elseif($arrRet[0]['stock_unlimited'] == '1') {
+		$sqlval['stock'] = null;
+		$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+		$ret = $objQuery->getLastQuery();
+	// ºß¸Ë¤ò¸º¤é¤¹
+	} else {
+		$sqlval['stock'] = ($arrRet[0]['stock'] - $quantity);
+		if($sqlval['stock'] == "") {
+			$sqlval['stock'] = '0';
+		}		
+		$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+		$ret = $objQuery->getLastQuery();
+	}
+}
+?>
Index: /temp/trunk/html/shopping/card.php
===================================================================
--- /temp/trunk/html/shopping/card.php	(revision 1328)
+++ /temp/trunk/html/shopping/card.php	(revision 1328)
@@ -0,0 +1,145 @@
+<?php
+require_once("../require.php");
+
+$arrJPO_INFO['10'] = "°ì³çÊ§¤¤";
+$arrJPO_INFO['21'] = "¥Ü¡¼¥Ê¥¹°ì³çÊ§¤¤";
+$arrJPO_INFO['80'] = "¥ê¥ÜÊ§¤¤";
+$arrJPO_INFO['61C02'] = "Ê¬³ä2²óÊ§¤¤";
+$arrJPO_INFO['61C03'] = "Ê¬³ä3²óÊ§¤¤";
+$arrJPO_INFO['61C05'] = "Ê¬³ä5²óÊ§¤¤";
+$arrJPO_INFO['61C06'] = "Ê¬³ä6²óÊ§¤¤";
+$arrJPO_INFO['61C10'] = "Ê¬³ä10²óÊ§¤¤";
+$arrJPO_INFO['61C12'] = "Ê¬³ä12²óÊ§¤¤";
+$arrJPO_INFO['61C15'] = "Ê¬³ä15²óÊ§¤¤";
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/shopping/card.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'shopping/card.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		global $arrJPO_INFO;
+		$this->arrJPO_INFO = $arrJPO_INFO;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥¢¥¯¥»¥¹¤ÎÀµÅöÀ­¤ÎÈ½Äê
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+switch($_POST['mode']) {
+// ÅÐÏ¿
+case 'regist':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç
+	if(count($objPage->arrErr) == 0) {
+		// ¥«¡¼¥È½¸·×½èÍý
+		$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+		// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+		$arrData = sfGetOrderTemp($uniqid);
+		// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+		$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+		
+		// ¥«¡¼¥É¤ÎÇ§¾Ú¤ò¹Ô¤¦
+		$arrVal = $objFormParam->getHashArray();
+		$card_no = $arrVal['card_no01'].$arrVal['card_no02'].$arrVal['card_no03'].$arrVal['card_no04'];
+		$card_exp = $arrVal['card_month']. "/" . $arrVal['card_year']; // MM/DD
+		$result = sfGetAuthonlyResult(CGI_DIR, CGI_FILE, $arrVal['name01'], $arrVal['name02'], $card_no, $card_exp, $arrData['payment_total'], $uniqid, $arrVal['jpo_info']);
+		
+		// ±þÅúÆâÍÆ¤Îµ­Ï¿
+		$sqlval['credit_result'] = $result['action-code'];
+		$sqlval['credit_msg'] = $result['aux-msg'].$result['MErrMsg'];
+		$objQuery = new SC_Query();
+		$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
+				
+		// Í¿¿®½èÍýÀ®¸ù¤Î¾ì¹ç
+		if($result['action-code'] == '000') {
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			// ½èÍý´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: " . URL_SHOP_COMPLETE);
+		} else {
+			switch($result['action-code']) {
+			case '115':
+				$objPage->tpl_error = "¢¨ ¥«¡¼¥É¤ÎÍ­¸ú´ü¸Â¤¬ÀÚ¤ì¤Æ¤¤¤Þ¤¹¡£";
+				break;
+			case '212':
+				$objPage->tpl_error = "¢¨ ¥«¡¼¥ÉÈÖ¹æ¤Ë¸í¤ê¤¬¤¢¤ê¤Þ¤¹¡£";
+				break;
+			case '100':
+				$objPage->tpl_error = "¢¨ ¥«¡¼¥É²ñ¼Ò¤Ç¤ª¼è°ú¤¬¾µÇ§¤µ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£";
+				break;
+			default:
+				$objPage->tpl_error = "¢¨ ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤Î¾È¹ç¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+				break;
+			}
+		}
+	}
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+}
+
+$objDate = new SC_Date();
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(RELEASE_YEAR + CREDIT_ADD_YEAR);
+$objPage->arrYear = $objDate->getZeroYear();
+$objPage->arrMonth = $objDate->getZeroMonth();
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ1", "card_no01", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ2", "card_no02", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ3", "card_no03", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ4", "card_no04", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥É´ü¸ÂÇ¯", "card_year", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥É´ü¸Â·î", "card_month", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("À«", "card_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
+	$objFormParam->addParam("Ì¾", "card_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
+	$objFormParam->addParam("¤ª»ÙÊ§¤¤ÊýË¡", "jpo_info", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALNUM_CHECK"));
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/shopping/loan.php
===================================================================
--- /temp/trunk/html/shopping/loan.php	(revision 1328)
+++ /temp/trunk/html/shopping/loan.php	(revision 1328)
@@ -0,0 +1,85 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/loan.tpl';
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		// ¥Û¡¼¥à¥¢¥É¥ì¥¹
+		$this->tpl_homeaddr = CF_HOMEADDR;
+		// ¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·
+		$this->tpl_simulate = CF_SIMULATE;
+		// ²ÃÌÁÅ¹¥³¡¼¥É
+		$this->tpl_storecode = CF_STORECODE;
+		// Ìá¤êÀè
+		$this->tpl_returnurl = CF_RETURNURL;
+		// ¸Æ¤Ó½Ð¤·¶èÊ¬(0:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¤Î¤ß¡¢1:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó+¿½¹þ)
+		$this->tpl_continue = CF_CONTINUE;
+		// ÌòÌ³Í­Ìµ¶èÊ¬(0:Ìµ¡¢1:Í­)
+		$this->tpl_labor = CF_LABOR;
+		// ·ë²Ì±þÅú(1:·ë²Ì¤¢¤ê¡¢2:·ë²Ì¤Ê¤·)
+		$this->tpl_result = CF_RESULT;
+		// ¥­¥ã¥ó¥»¥ëURL
+		$this->tpl_cancelurl = CF_CANCELURL;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ÃíÊ¸°ì»þID¤Î¼èÆÀ
+$uniqid = $objSiteSess->getUniqId();
+
+// ¥í¡¼¥ó·èºÑ¤ÎÌá¤êÃÍ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+if($_GET['tranno'] == $uniqid) {
+	// ¥í¡¼¥ó·èºÑ¼õÉÕÈÖ¹æ¤òDB¤Ë½ñ¤­¹þ¤à
+	$sqlval['loan_result'] = $_GET['receiptno'];
+	$objQuery = new SC_Query();
+	$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	// ½èÍý´°Î»¥Ú¡¼¥¸¤Ø
+	header("Location: " . URL_SHOP_COMPLETE);
+}
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+default:
+	break;
+}
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+// »ÙÊ§¤¤Áí³Û
+$objPage->tpl_amount = $arrData['payment_total'];
+// ¼õÃí²¾ÈÖ¹æ
+$objPage->tpl_tranno = $uniqid;
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/shopping/convenience.php
===================================================================
--- /temp/trunk/html/shopping/convenience.php	(revision 1328)
+++ /temp/trunk/html/shopping/convenience.php	(revision 1328)
@@ -0,0 +1,213 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = "shopping/convenience.tpl";
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		global $arrCONVENIENCE;
+		$this->arrCONVENIENCE = $arrCONVENIENCE;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page;
+$objView = new SC_SiteView;
+$objSiteSess = new SC_SiteSession;
+$objCartSess = new SC_CartSession;
+$objSiteInfo = new SC_SiteInfo;
+$objCustomer = new SC_Customer;
+
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥¢¥¯¥»¥¹¤ÎÀµÅöÀ­¤ÎÈ½Äê
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+//¥³¥ó¥Ó¥Ë¤Î¼ïÎà¤Ç½èÍý¥Õ¥¡¥¤¥ë¤òÀÚ¤êÂØ¤¨¤ë
+switch($_POST['mode']) {
+//´°Î»
+case 'complete':
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+	if($objPage->arrErr == "") {
+		// ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+		//require("merchant.ini");
+		// ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+		require_once(ROOT_DIR . "data/vtcvsmdk/mdk/lib/BSCVS/Transaction.php");
+		require_once(ROOT_DIR . "data/vtcvsmdk/mdk/lib/BSCVS/Config.php");
+		require_once(ROOT_DIR . "data/vtcvsmdk/mdk/lib/BSCVS/Log.php");
+	
+		// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+		$objTran = new Transaction;
+		
+		// ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+		$objTran->setServer(ROOT_DIR . "data/vtcvsmdk/mdk/conf/cvsgwlib.conf");
+		
+		// ¥«¡¼¥È½¸·×½èÍý
+		$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+		// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+		$arrData = sfGetOrderTemp($uniqid);
+		// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+		$arrPrice = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
+		
+		// ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+		$logger = $objTran->getLogger();
+		
+		// ¥í¥°½ÐÎÏ(¤³¤³¤«¤é)
+		$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ½èÍý³«»Ï... >>>');
+		
+		//¥³¥ó¥Ó¥Ë¤Î¼ïÎà¤«¤éCVS¥¿¥¤¥×¤ò·èÄê¤¹¤ë
+		switch($_POST['convenience']) {
+		//¥»¥Ö¥ó¥¤¥ì¥Ö¥ó
+		case '1':
+			$cvs_type = '01';
+			break;
+		//¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È
+		case '2':
+			$cvs_type = '03';
+			break;
+		//¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹
+		case '3':
+			$cvs_type = '04';
+			break;
+		//¤½¤ÎÂ¾
+		case '4':
+		case '5':
+			$cvs_type = '02';
+			break;
+		default:
+			sfDispSiteError(PAGE_ERROR);
+			break;
+		}
+	
+		//¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸
+		$arrRequest = array(
+			// ¼è°ú ID
+		    REQ_ORDER_ID => $uniqid,		
+		    // CVS¥¿¥¤¥×
+		    REQ_CVS_TYPE => $cvs_type,
+		    // ¶â³Û
+		    REQ_AMOUNT => $arrPrice['payment_total'],
+		    // »ÙÊ§´ü¸Â
+		    REQ_PAY_LIMIT => lfGetPayLimit(),
+		    // »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+		    // ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+		    REQ_NAME1 => $objTran->jCode($arrData['order_name01'], ENCODE_UTF8),
+		    REQ_NAME2 => $objTran->jCode($arrData['order_name02'], ENCODE_UTF8),
+			REQ_KANA => $objTran->jCode($arrData['order_kana01'].$arrData['order_kana02'], ENCODE_UTF8),
+		    // ÅÅÏÃÈÖ¹æ
+		    REQ_TEL_NO => $arrData['order_tel01']."-".$arrData['order_tel02']."-".$arrData['order_tel03']
+		);
+
+		//¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤òÅê¤²¡¢¼è°ú·ë²Ì¤ò³ÊÇ¼
+		$arrResult = $objTran->doTransaction(CMD_ENTRY, $arrRequest);
+		//¼è°úÀ®¸ù
+		if($arrResult[RES_ACTION_CODE] = '010') {
+			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+			switch($_POST['convenience']) {
+			//¥»¥Ö¥ó¥¤¥ì¥Ö¥ó
+			case '1':
+				$arrRet['cv_type'] = '1';										//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_payment_url'] = $arrResult[RES_HARAIKOMI_URL];		//Ê§¹þÉ¼URL(PC)
+				$arrRet['cv_receipt_no'] = $arrResult[RES_RECEIPT_NO];			//Ê§¹þÉ¼ÈÖ¹æ
+				break;
+			//¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È
+			case '2':
+				$company_code = substr($arrResult[RES_RECEIPT_NO], 0, 5);
+				$order_no = substr($arrResult[RES_RECEIPT_NO], 6, 12);
+				$arrRet['cv_type'] = '2';						//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_company_code'] = $company_code;	//´ë¶È¥³¡¼¥É
+				$arrRet['cv_order_no'] = $order_no;			//¼õÉÕÈÖ¹æ
+				break;
+			//¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹
+			case '3':
+				$mobile_url = preg_replace("/https:\/\/.+?\/JLPcon/","https://w2.kessai.info/JLM/JLMcon", $arrResult[RES_HARAIKOMI_URL]);
+				$arrRet['cv_type'] = '3';										//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_payment_url'] = $arrResult[RES_HARAIKOMI_URL];		//Ê§¹þÉ¼URL
+				$arrRet['cv_payment_mobile_url'] = $mobile_url;					//Ê§¹þÉ¼URL(¥â¥Ð¥¤¥ë)
+				break;
+			//¥í¡¼¥½¥ó¡¢¥»¥¤¥³¡¼¥Þ¡¼¥È
+			case '4':
+				$arrRet['cv_type'] = '4';									//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_receipt_no'] = $arrResult[RES_RECEIPT_NO];		//Ê§¹þÉ¼ÈÖ¹æ
+				break;
+			//¥ß¥Ë¥¹¥È¥Ã¥×¡¢¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¢¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢
+			case '5':
+				$arrRet['cv_type'] = '5';										//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_payment_url'] = $arrResult[RES_HARAIKOMI_URL];		//Ê§¹þÉ¼URL(PC)
+				break;
+			}
+			//»ÙÊ§´ü¸Â
+			$arrRet['cv_payment_limit'] = lfGetPayLimit();
+			//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó¤ò³ÊÇ¼
+			$sqlval['conveni_data'] = serialize($arrRet);
+			$objQuery = new SC_Query;
+			$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ? ", array($uniqid));
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			//¹ØÆþ´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: " . URL_SHOP_COMPLETE);
+		//¼ºÇÔ
+		} else {
+			$objPage->arrErr = '¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£';
+		}
+		
+		# ¥í¥°½ÐÎÏ(¤³¤³¤Þ¤Ç)
+		$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ½èÍý½ªÎ». >>>');
+	
+	}
+	break;
+//Ìá¤ë
+case 'return':
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------
+
+//»ÙÊ§´ü¸Â¤ÎÀ¸À®
+function lfGetPayLimit() {
+    $date = sprintf("%10s",
+                    date("Y/m/d",mktime(0,0,0,date("m"),
+                    date("d")+CV_PAYMENT_LIMIT,date("Y"))));
+    return $date;
+}
+
+//¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥³¥ó¥Ó¥Ë¤Î¼ïÎà", "convenience", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+}
+	
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/shopping/confirm.php
===================================================================
--- /temp/trunk/html/shopping/confirm.php	(revision 1328)
+++ /temp/trunk/html/shopping/confirm.php	(revision 1328)
@@ -0,0 +1,98 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $tpl_total_deliv_fee;
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/confirm.tpl';
+		$this->tpl_css = '/css/layout/shopping/confirm.css';
+		$this->tpl_title = "¤´ÆþÎÏÆâÍÆ¤Î¤´³ÎÇ§";
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+		global $arrMAILMAGATYPE;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		global $arrReminder;
+		$this->arrReminder = $arrReminder;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = new SC_SiteInfo();
+$objSiteSess = new SC_SiteSession();
+$objCustomer = new SC_Customer();
+$arrInfo = $objSiteInfo->data;
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿µ­Ï¿¤¬¤¢¤ë¤«È½Äê
+sfIsPrePage($objSiteSess);
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+$objPage->tpl_uniqid = $uniqid;
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
+
+// ²ñ°÷¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = '1';
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+}
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_PAYMENT);
+	exit;
+	break;
+case 'confirm':
+	// ½¸·×·ë²Ì¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+	sfRegistTempOrder($uniqid, $arrData);
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	
+	// ·èºÑÊýË¡¤Ë¤è¤ê²èÌÌÀÚÂØ
+	switch($arrData['payment_id']) {
+	case PAYMENT_CREDIT_ID:
+		header("Location: " . URL_SHOP_CREDIT);
+		break;
+	case PAYMENT_LOAN_ID:
+		header("Location: " . URL_SHOP_LOAN);
+		break;
+	case PAYMENT_CONVENIENCE_ID:
+		header("Location: " . URL_SHOP_CONVENIENCE);
+		break;
+	default:
+		header("Location: " . URL_SHOP_COMPLETE);
+		break;
+	}
+	break;
+default:
+	break;
+}
+
+$objPage->arrData = $arrData;
+$objPage->arrInfo = $arrInfo;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/shopping/payment.php
===================================================================
--- /temp/trunk/html/shopping/payment.php	(revision 1328)
+++ /temp/trunk/html/shopping/payment.php	(revision 1328)
@@ -0,0 +1,329 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		$this->tpl_mainpage = 'shopping/payment.tpl';
+		$this->tpl_onload = 'fnCheckInputPoint();';
+		$this->tpl_title = "¤ª»ÙÊ§ÊýË¡¡¦¤ªÆÏ¤±»þ´ÖÅù¤Î»ØÄê";
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+// ¥æ¥Ë¡¼¥¯ID¤ò°ú¤­·Ñ¤°
+$objPage->tpl_uniqid = $uniqid;
+
+// ²ñ°÷¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = '1';
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+}
+
+// ¶â³Û¤Î¼èÆÀ
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+switch($_POST['mode']) {
+case 'confirm':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($objPage->arrData );
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
+		lfRegistData($uniqid);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_CONFIRM);
+		exit;
+	}else{
+		// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+		$uniqid = $objSiteSess->getUniqId();
+		// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
+		lfSetOrderTempData($uniqid);
+	}
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Èó²ñ°÷¤Î¾ì¹ç
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_TOP);
+	exit;
+	break;
+// »ÙÊ§¤¤ÊýË¡¤¬ÊÑ¹¹¤µ¤ì¤¿¾ì¹ç
+case 'payment':
+	// ¤³¤³¤Îbreak¤Ï¡¢°ÕÌ£¤¬¤¢¤ë¤Î¤Ç³°¤µ¤Ê¤¤¤Ç²¼¤µ¤¤¡£
+	break;
+default:
+	// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
+	lfSetOrderTempData($uniqid);
+	break;
+}
+
+// Å¹ÊÞ¾ðÊó¤Î¼èÆÀ
+$arrInfo = $objSiteInfo->data;
+// ¹ØÆþ¶â³Û¤Î¼èÆÀÆÀ
+$total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = lfGetPayment($total_pretax);
+// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+$arrRet = sfGetDelivTime($objFormParam->getValue('payment_id'));
+$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'time');
+$objPage->objCustomer = $objCustomer;
+//¡¡ÇÛÁ÷Æü°ìÍ÷¤Î¼èÆÀ
+$objPage->arrDelivDate = lfGetDelivDate();
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ª»ÙÊ§¤¤ÊýË¡", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥È", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START"));
+	$objFormParam->addParam("ÇÛÃ£»þ´Ö", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤´¼ÁÌä", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥È¤ò»ÈÍÑ¤¹¤ë", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2');
+	$objFormParam->addParam("ÇÛÃ£Æü", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+}
+
+function lfGetPayment($total_pretax) {
+	$objQuery = new SC_Query();
+	$objQuery->setorder("fix,rank DESC");
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤»ÙÊ§ÊýË¡¤ò¼èÆÀ
+	$arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "delete = 0 ");
+	//ÍøÍÑ¾ò·ï¤«¤é»ÙÊ§²ÄÇ½ÊýË¡¤òÈ½Äê
+	foreach($arrRet as $data) {
+		//²¼¸Â¤È¾å¸Â¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+		if($data['rule'] > 0 && $data['upper_rule'] > 0) {
+			if($data['rule'] <= $total_pretax && $data['upper_rule'] >= $total_pretax) {
+				$arrPayment[] = $data;
+			}
+		//²¼¸Â¤Î¤ßÀßÄê¤µ¤ì¤Æ¤¤¤ë
+		} elseif($data['rule'] > 0) {	
+			if($data['rule'] <= $total_pretax) {
+				$arrPayment[] = $data;
+			}
+		//¾å¸Â¤Î¤ßÀßÄê¤µ¤ì¤Æ¤¤¤ë
+		} elseif($data['upper_rule'] > 0) {
+			if($data['upper_rule'] >= $total_pretax) {
+				$arrPayment[] = $data;
+			}
+		//ÀßÄê¤Ê¤·
+		} else {
+			$arrPayment[] = $data;
+		}	
+	}
+	return $arrPayment;	
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError($arrData) {
+	global $objFormParam;
+	global $objCustomer;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if($_POST['point_check'] == '1') {
+		$objErr->doFunc(array("¥Ý¥¤¥ó¥È¤ò»ÈÍÑ¤¹¤ë", "point_check"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥Ý¥¤¥ó¥È", "use_point"), array("EXIST_CHECK"));
+		$max_point = $objCustomer->getValue('point');
+		if($max_point == "") {
+			$max_point = 0;
+		}
+		if($arrRet['use_point'] > $max_point) {
+			$objErr->arrErr['use_point'] = "¢¨ ¤´ÍøÍÑ¥Ý¥¤¥ó¥È¤¬½ê»ý¥Ý¥¤¥ó¥È¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£<br />";
+		}
+		if(($arrRet['use_point'] * POINT_VALUE) > $arrData['subtotal']) {
+			$objErr->arrErr['use_point'] = "¢¨ ¤´ÍøÍÑ¥Ý¥¤¥ó¥È¤¬¤´¹ØÆþ¶â³Û¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£<br />";
+		}
+	}
+	return $objErr->arrErr;
+}
+
+/* »ÙÊ§¤¤ÊýË¡Ê¸»úÎó¤Î¼èÆÀ */
+function lfGetPaymentInfo($payment_id) {
+	$objQuery = new SC_Query();
+	$where = "payment_id = ?";
+	$arrRet = $objQuery->select("payment_method, charge", "dtb_payment", $where, array($payment_id));
+	return (array($arrRet[0]['payment_method'], $arrRet[0]['charge']));
+}
+
+/* ÇÛÁ÷»þ´ÖÊ¸»úÎó¤Î¼èÆÀ */
+function lfGetDelivTimeInfo($time_id) {
+	$objQuery = new SC_Query();
+	$where = "time_id = ?";
+	$arrRet = $objQuery->select("deliv_id, time", "dtb_delivtime", $where, array($time_id));
+	return (array($arrRet[0]['deliv_id'], $arrRet[0]['time']));
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
+function lfRegistData($uniqid) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$sqlval = $objFormParam->getDbArray();
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	
+	if($sqlval['payment_id'] != "") {
+		list($sqlval['payment_method'], $sqlval['charge']) = lfGetPaymentInfo($sqlval['payment_id']);
+	} else {
+		$sqlval['payment_id'] = '0';
+		$sqlval['payment_method'] = "";
+	}
+	
+	if($sqlval['deliv_time_id'] != "") {
+		list($sqlval['deliv_id'], $sqlval['deliv_time']) = lfGetDelivTimeInfo($sqlval['deliv_time_id']);
+	} else {
+		$sqlval['deliv_time_id'] = '0';
+		$sqlval['deliv_id'] = '0';
+		$sqlval['deliv_time'] = "";
+	}
+	
+	// »ÈÍÑ¥Ý¥¤¥ó¥È¤ÎÀßÄê
+	if($sqlval['point_check'] != '1') {
+		$sqlval['use_point'] = 0;
+	}
+	
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ÇÛÃ£Æü°ìÍ÷¤ò¼èÆÀ¤¹¤ë */
+function lfGetDelivDate() {
+	$objCartSess = new SC_CartSession();
+	$objQuery = new SC_Query();
+	// ¾¦ÉÊID¤Î¼èÆÀ
+	$max = $objCartSess->getMax();
+	for($i = 1; $i <= $max; $i++) {
+		if($_SESSION[$objCartSess->key][$i]['id'][0] != "") {
+			$arrID['product_id'][$i] = $_SESSION[$objCartSess->key][$i]['id'][0];
+		}
+	}
+	if(count($arrID['product_id']) > 0) {
+		$id = implode(",", $arrID['product_id']);
+		//¾¦ÉÊ¤«¤éÈ¯Á÷ÌÜ°Â¤Î¼èÆÀ
+		$deliv_date = $objQuery->get("dtb_products", "MAX(deliv_date_id)", "product_id IN (".$id.")");
+		//È¯Á÷ÌÜ°Â
+		switch($deliv_date) {
+		//Â¨ÆüÈ¯Á÷
+		case '1':
+			$start_day = 1;
+			break;
+		//1-2Æü¸å
+		case '2':
+			$start_day = 3;
+			break;
+		//3-4Æü¸å
+		case '3':
+			/* 
+				2006/06/13 Nakagawa
+				¥È¡¼¥«Æ²ÍÍ±¿ÍÑ¾å3-4Æü¸å¤Ï¡¢¸½ºßÆü+6Æü¤È¤¹¤ë¡£
+			*/
+			$start_day = 6;
+			break;
+		//1½µ´Ö°ÊÆâ
+		case '4':
+			$start_day = 8;
+			break;
+		//2½µ´Ö°ÊÆâ
+		case '5':
+			$start_day = 15;
+			break;
+		//3½µ´Ö°ÊÆâ
+		case '6':
+			$start_day = 22;
+			break;
+		//1¥ö·î°ÊÆâ
+		case '7':
+			$start_day = 32;
+			break;
+		//2¥ö·î°Ê¹ß
+		case '8':
+			$start_day = 62;			
+			break;
+		//¤ª¼è¤ê´ó¤»(¾¦ÉÊÆþ²Ù¸å)
+		case '9':
+			$start_day = "";
+			break;
+		default:
+			//¤ªÆÏ¤±Æü¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			$start_day = "";
+			break;
+		}
+		//ÇÛÃ£²ÄÇ½Æü¤Î¥¹¥¿¡¼¥ÈÃÍ¤«¤é¡¢ÇÛÃ£Æü¤ÎÇÛÎó¤ò¼èÆÀ¤¹¤ë
+		$arrDelivDate = lfGetDateArray($start_day, DELIV_DATE_END_MAX);
+	}
+	return $arrDelivDate;
+}
+
+//ÇÛÃ£²ÄÇ½Æü¤Î¥¹¥¿¡¼¥ÈÃÍ¤«¤é¡¢ÇÛÃ£Æü¤ÎÇÛÎó¤ò¼èÆÀ¤¹¤ë
+function lfGetDateArray($start_day, $end_day) {
+	global $arrWDAY;
+	//ÇÛÃ£²ÄÇ½Æü¤Î¥¹¥¿¡¼¥ÈÃÍ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ì¤Ð
+	if($start_day >= 1) {
+		$now_time = time();
+		$max_day = $start_day + $end_day;
+		// ½¸·×
+		for ($i = $start_day; $i < $max_day; $i++) {
+			// ´ðËÜ»þ´Ö¤«¤éÆü¿ô¤òÄÉ²Ã¤·¤Æ¤¤¤¯
+			$tmp_time = $now_time + ($i * 24 * 3600);
+			list($y, $m, $d, $w) = split(" ", date("y m d w", $tmp_time));	
+			$val = sprintf("%02d/%02d/%02d(%s)", $y, $m, $d, $arrWDAY[$w]);
+			$arrDate[$val] = $val;
+		}
+	} else {
+		$arrDate = false;
+	}
+	return $arrDate;
+}
+
+//°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼¤¹¤ë
+function lfSetOrderTempData($uniqid) {
+	global $objQuery;
+	global $objFormParam;
+	
+	$objQuery = new SC_Query();
+	$col = "payment_id, use_point, deliv_time_id, message, point_check, deliv_date";
+	$from = "dtb_order_temp";
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select($col, $from, $where, array($uniqid));
+	// DBÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+	return $objFormParam;
+}
+
+
+?>
Index: /temp/trunk/html/shopping/loan_cancel.php
===================================================================
--- /temp/trunk/html/shopping/loan_cancel.php	(revision 1328)
+++ /temp/trunk/html/shopping/loan_cancel.php	(revision 1328)
@@ -0,0 +1,84 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/loan.tpl';
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		// ¥Û¡¼¥à¥¢¥É¥ì¥¹
+		$this->tpl_homeaddr = CF_HOMEADDR;
+		// ¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·
+		$this->tpl_simulate = CF_SIMULATE;
+		// ²ÃÌÁÅ¹¥³¡¼¥É
+		$this->tpl_storecode = CF_STORECODE;
+		// Ìá¤êÀè
+		$this->tpl_returnurl = CF_RETURNURL;
+		// ¸Æ¤Ó½Ð¤·¶èÊ¬(0:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¤Î¤ß¡¢1:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó+¿½¹þ)
+		$this->tpl_continue = CF_CONTINUE;
+		// ÌòÌ³Í­Ìµ¶èÊ¬(0:Ìµ¡¢1:Í­)
+		$this->tpl_labor = CF_LABOR;
+		// ·ë²Ì±þÅú(1:·ë²Ì¤¢¤ê¡¢2:·ë²Ì¤Ê¤·)
+		$this->tpl_result = CF_RESULT;
+		// ¥­¥ã¥ó¥»¥ëURL
+		$this->tpl_cancelurl = CF_CANCELURL;
+		
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ÃíÊ¸°ì»þID¤Î¼èÆÀ
+$uniqid = $objSiteSess->getUniqId();
+
+// ¥í¡¼¥ó·èºÑ¤ÎÌá¤êÃÍ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+if($_GET['tranno'] == $uniqid) {
+	// ¥í¡¼¥ó·èºÑ¼õÉÕÈÖ¹æ¤òDB¤Ë½ñ¤­¹þ¤à
+	$sqlval['loan_result'] = $_GET['receiptno'];
+	$objQuery = new SC_Query();
+	$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
+	
+	$objPage->tpl_message = "¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó¤Î¼êÂ³¤­¤Ï¡¢¥­¥ã¥ó¥»¥ë¤µ¤ì¤Þ¤·¤¿¡£";	
+}
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+default:
+	break;
+}
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+// »ÙÊ§¤¤Áí³Û
+$objPage->tpl_amount = $arrData['payment_total'];
+// ¼õÃí²¾ÈÖ¹æ
+$objPage->tpl_tranno = $uniqid;
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/shopping/deliv.php
===================================================================
--- /temp/trunk/html/shopping/deliv.php	(revision 1328)
+++ /temp/trunk/html/shopping/deliv.php	(revision 1328)
@@ -0,0 +1,297 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $arrAddr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/deliv.tpl';
+		$this->tpl_css = '/css/layout/shopping/index.css';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		$this->tpl_title = "¤ªÆÏ¤±Àè»ØÄê";		// ¥¿¥¤¥È¥ë
+
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = new SC_SiteInfo();
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+$objLoginFormParam = new SC_FormParam();	// ¥í¥°¥¤¥ó¥Õ¥©¡¼¥àÍÑ
+lfInitLoginFormParam();						// ½é´üÀßÄê
+$objLoginFormParam->setParam($_POST);		// POSTÃÍ¤Î¼èÆÀ
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+$objPage->tpl_uniqid = $uniqid;
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess()) {
+	// ÉÔÀµ¥¢¥¯¥»¥¹¤È¤ß¤Ê¤¹
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+switch($_POST['mode']) {
+case 'login':
+	$objLoginFormParam->toLower('login_email');
+	$objPage->arrErr = $objLoginFormParam->checkError();
+	$arrForm =  $objLoginFormParam->getHashArray();
+	// ¥¯¥Ã¥­¡¼ÊÝÂ¸È½Äê
+	if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
+		$objCookie->setCookie('login_email', $_POST['login_email']);
+	} else {
+		$objCookie->setCookie('login_email', '');
+	}
+
+	if(count($objPage->arrErr) == 0) {
+		// ¥í¥°¥¤¥óÈ½Äê
+		if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
+			// ²¾ÅÐÏ¿¤ÎÈ½Äê
+			$objQuery = new SC_Query;
+			$where = "email = ? AND status = 1 AND delete = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		} 
+	} else {
+		// ¥í¥°¥¤¥ó¥Ú¡¼¥¸¤ËÌá¤ë
+		header("Location: " . URL_SHOP_TOP);
+		exit;	
+	}
+	break;
+// ºï½ü
+case 'delete':
+	if (sfIsInt($_POST['other_deliv_id'])) {
+		$objQuery = new SC_Query();
+		$where = "other_deliv_id = ?";
+		$arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
+		$objFormParam->setValue('select_addr_id', '');
+	}
+	break;
+// ²ñ°÷ÅÐÏ¿½»½ê¤ËÁ÷¤ë
+case 'customer_addr':
+	// ¤ªÆÏ¤±Àè¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¹¹¿·½èÍý¤ò¹Ô¤¦
+	if ($_POST['deli'] != "") {
+		// ²ñ°÷¾ðÊó¤Î½»½ê¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
+		lfRegistDelivData($uniqid, $objCustomer);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_PAYMENT);
+		exit;
+	}else{
+		// ¥¨¥é¡¼¤òÊÖ¤¹
+		$arrErr['deli'] = '¢¨ ¤ªÆÏ¤±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
+	}
+	break;
+	
+// ÅÐÏ¿ºÑ¤ß¤ÎÊÌ¤Î¤ªÆÏ¤±Àè¤ËÁ÷¤ë
+case 'other_addr':
+	// ¤ªÆÏ¤±Àè¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¹¹¿·½èÍý¤ò¹Ô¤¦
+	if ($_POST['deli'] != "") {
+		if (sfIsInt($_POST['other_deliv_id'])) {
+			// ÅÐÏ¿ºÑ¤ß¤ÎÊÌ¤Î¤ªÆÏ¤±Àè¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
+			lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']);
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+			header("Location: " . URL_SHOP_PAYMENT);
+			exit;
+		}
+	}else{
+		// ¥¨¥é¡¼¤òÊÖ¤¹
+		$arrErr['deli'] = '¢¨ ¤ªÆÏ¤±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
+	}
+	break;
+
+/*
+// ÊÌ¤Î¤ªÆÏ¤±Àè¤ò»ØÄê
+case 'new_addr':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤ªÆÏ¤±Àè¤òÅÐÏ¿
+		lfRegistNewAddrData($uniqid, $objCustomer);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_PAYMENT);
+		exit;		
+	}
+	break;
+*/
+
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_CART_TOP);
+	exit;
+	break;
+default:
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
+	$objFormParam->setParam($arrRet[0]);
+	break;
+}
+
+/** É½¼¨½èÍý **/
+
+// ²ñ°÷ÅÐÏ¿½»½ê¤Î¼èÆÀ
+$col = "name01, name02, pref, addr01, addr02";
+$where = "customer_id = ?";
+$objQuery = new SC_Query();
+$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
+// ÊÌ¤Î¤ªÆÏ¤±Àè½»½ê¤Î¼èÆÀ
+$col = "other_deliv_id, name01, name02, pref, addr01, addr02";
+$objQuery->setorder("other_deliv_id DESC");
+$objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
+$objPage->arrAddr = $arrCustomerAddr;
+$cnt = 1;
+foreach($objOtherAddr as $val) {
+	$objPage->arrAddr[$cnt] = $val;
+	$cnt++;
+}
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objPage->arrErr = $arrErr;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ªÌ¾Á°1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+}
+
+function lfInitLoginFormParam() {
+	global $objLoginFormParam;
+	$objLoginFormParam->addParam("µ­²±¤¹¤ë", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objLoginFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objLoginFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
+function lfRegistNewAddrData($uniqid, $objCustomer) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$sqlval = $objFormParam->getDbArray();
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['deliv_check'] = '1';
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+	$sqlval['order_birth'] = $objCustomer->getValue('birth');
+	
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ²ñ°÷¾ðÊó¤Î½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+function lfRegistDelivData($uniqid, $objCustomer) {
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+    $sqlval['deliv_check'] = '1';
+	$sqlval['deliv_name01'] = $objCustomer->getValue('name01');
+    $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
+    $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
+    $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
+    $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
+    $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
+    $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
+    $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
+    $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
+    $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
+    $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
+	$sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
+
+    $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
+    $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
+	$sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
+
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ÊÌ¤Î¤ªÆÏ¤±Àè½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+	$sqlval['order_birth'] = $objCustomer->getValue('birth');
+		
+	$objQuery = new SC_Query();
+	$where = "other_deliv_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
+	
+	$sqlval['deliv_check'] = '1';
+    $sqlval['deliv_name01'] = $arrRet[0]['name01'];
+    $sqlval['deliv_name02'] = $arrRet[0]['name02'];
+    $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
+    $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
+    $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
+    $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
+    $sqlval['deliv_pref'] = $arrRet[0]['pref'];
+    $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
+    $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
+    $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
+    $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
+	$sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	if ($_POST['mode'] == 'login'){
+	$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
+	}
+	$objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/shopping/index.php
===================================================================
--- /temp/trunk/html/shopping/index.php	(revision 1328)
+++ /temp/trunk/html/shopping/index.php	(revision 1328)
@@ -0,0 +1,228 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $tpl_login_email;
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/index.tpl';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+		global $arrJob;
+		$this->arrJob = $arrJob;
+		$this->tpl_onload = 'fnCheckInputDeliv();';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objCookie = new SC_Cookie();
+$objFormParam = new SC_FormParam();			// ¥Õ¥©¡¼¥àÍÑ
+lfInitParam();								// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+$objFormParam->setParam($_POST);			// POSTÃÍ¤Î¼èÆÀ
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+$objPage->tpl_uniqid = $uniqid;
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	// ¤¹¤Ç¤Ë¥í¥°¥¤¥ó¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤ªÆÏ¤±ÀèÀßÄê²èÌÌ¤ËÅ¾Á÷
+	header("Location: ./deliv.php");
+	exit;
+}
+
+switch($_POST['mode']) {
+case 'nonmember_confirm':
+	$objPage = lfSetNonMember($objPage);
+	// ¢¨break¤Ê¤·
+case 'confirm':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objFormParam->toLower('order_mail');
+	$objFormParam->toLower('order_mail_check');
+	
+	$objPage->arrErr = lfCheckError();
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
+		lfRegistData($uniqid);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_PAYMENT);
+		exit;		
+	}
+	
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_CART_TOP);
+	exit;
+	break;
+case 'nonmember':
+	$objPage = lfSetNonMember($objPage);
+	// ¢¨break¤Ê¤·
+default:
+	if($_GET['from'] == 'nonmember') {
+		$objPage = lfSetNonMember($objPage);
+	}
+	// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+	$uniqid = $objSiteSess->getUniqId();
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
+	// DBÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+	$objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
+	$objFormParam->setDBDate($arrRet[0]['order_birth']);
+	break;
+}
+
+// ¥¯¥Ã¥­¡¼È½Äê
+$objPage->tpl_login_email = $objCookie->getCookie('login_email');
+if($objPage->tpl_login_email != "") {
+	$objPage->tpl_login_memory = "1";
+}
+
+// ÁªÂòÍÑÆüÉÕ¤Î¼èÆÀ
+$objDate = new SC_Date(START_BIRTH_YEAR);
+$objPage->arrYear = $objDate->getYear('', 1950);	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+if($objPage->year == '') {
+	$objPage->year = '----';
+}
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+/* Èó²ñ°÷ÆþÎÏ¥Ú¡¼¥¸¤Î¥»¥Ã¥È */
+function lfSetNonMember($objPage) {
+	$objPage->tpl_mainpage = 'shopping/nonmember_input.tpl';
+	$objPage->tpl_css = array();
+	$objPage->tpl_css[] = '/css/layout/login/nonmember.css';
+	return $objPage;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÌ¾¡Ë", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³ÎÇ§¡Ë", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
+	$objFormParam->addParam("Ç¯", "year", INT_LEN, "n", array("EXIST_CHECK"), "", false);
+	$objFormParam->addParam("·î", "month", INT_LEN, "n", array("EXIST_CHECK"), "", false);
+	$objFormParam->addParam("Æü", "day", INT_LEN, "n", array("EXIST_CHECK"), "", false);
+	$objFormParam->addParam("À­ÊÌ", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¿¦¶È", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÊÌ¤Î¤ªÆÏ¤±Àè", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÌ¾¡Ë", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
+function lfRegistData($uniqid) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$sqlval = $objFormParam->getDbArray();
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = '0';
+	
+	// ´ûÂ¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
+	// ´ûÂ¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
+	if ($cnt == 0) {
+		$objQuery->insert("dtb_order_temp", $sqlval);
+	} else {
+		$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+	}
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+		
+	// ÊÌ¤Î¤ªÆÏ¤±Àè¥Á¥§¥Ã¥¯
+	if($_POST['deliv_check'] == "1") { 
+		$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", "deliv_name02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "deliv_zip01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "deliv_zip02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "deliv_pref"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("½»½ê1", "deliv_addr01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("½»½ê2", "deliv_addr02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", "deliv_tel01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", "deliv_tel02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", "deliv_tel03"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag"), array("EXIST_CHECK"));
+	}
+	
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("TEL", "order_tel01", "order_tel02", "order_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "order_fax01", "order_fax02", "order_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "order_zip01", "order_zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³ÎÇ§¡Ë", "order_email", "order_email_check"), array("EQUAL_CHECK"));
+	
+	// ¤¹¤Ç¤Ë¥á¥ë¥Þ¥¬¥Æ¡¼¥Ö¥ë¤Ë²ñ°÷¤È¤·¤Æ¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if(sfCheckCustomerMailMaga($arrRet['order_email'])) {
+		$objErr->arrErr['order_email'] = "¤³¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ï¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br />";
+	}
+		
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/point/index.php
===================================================================
--- /temp/trunk/html/point/index.php	(revision 1328)
+++ /temp/trunk/html/point/index.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/point/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'point/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'point';				
+		$this->tpl_title = '¥Ý¥¤¥ó¥ÈÀ©ÅÙ¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+$arrInfo =$objQuery->select("*","dtb_baseinfo");
+$objPage->arrPoint = $arrInfo[0]['point_rate'];
+
+if ($arrInfo[0]['welcome_point'] != 0){
+	$kome = "¢¨";
+	$mes = "²ñ°÷ÅÐÏ¿¤¹¤ë¤À¤±¤Ç¤â¤ì¤Ê¤¯".$arrInfo[0]['welcome_point']."¥Ý¥¤¥ó¥ÈÉÕÍ¿¤µ¤ì¤Þ¤¹¡£";
+	$objPage->mes = $mes;
+	$objPage->kome = $kome;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/mailmagazine/index.php
===================================================================
--- /temp/trunk/html/mailmagazine/index.php	(revision 1328)
+++ /temp/trunk/html/mailmagazine/index.php	(revision 1328)
@@ -0,0 +1,257 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/mailmagazine/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'mailmagazine/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'mailmagazine';
+		$this->tpl_title = '¥á¥ë¥Þ¥¬ÅÐÏ¿¥²ò½ü';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+$entry_email = strtolower($_POST['entry']);			//ÅÐÏ¿¡¦¹¹¿·¥á¡¼¥ë¥¢¥É¥ì¥¹¥Õ¥©¡¼¥àÆþÎÏ¥Õ¥©¡¼¥àÃÍ
+$stop_email = strtolower($_POST['stop']);			//ºï½ü¥á¡¼¥ë¥¢¥É¥ì¥¹¥Õ¥©¡¼¥àÆþÎÏÃÍ
+$checkbox = $_POST['kind'];							//ÅÐÏ¿¡¦¹¹¿·¥á¥ë¥Þ¥¬·Á¼°¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹
+
+$arrErr = lfErrorCheck();
+$objPage->arrErr = $arrErr;
+
+$entry_email_subject = sfMakeSubject('¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+$stop_email_subject = sfMakeSubject('¥á¥ë¥Þ¥¬²¾²ò½ü¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+
+//ÅÐÏ¿½ÅÊ£¥Á¥§¥Ã¥¯¡Ê½ÅÊ£¤Ê¤·¡§0  ½ÅÊ£¤¢¤ê:1)
+$ent_flag = $objQuery->count("dtb_customer_mail", "email = ? AND mail_flag=? " ,array($entry_email,$checkbox));
+
+//¹¹¿·³ÎÇ§¡Ê¹¹¿·É¬Í×:1¡¡¹¹¿·ÉÔÉ¬Í×:2)
+$update_flag = $objQuery->count("dtb_customer_mail", "email = ? AND NOT mail_flag = ? ",array($entry_email,$checkbox));
+
+//²ò½üPOSTÃÍ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+$stop_email_flag = $objQuery->count("dtb_customer_mail", "email = ? ",array($stop_email));
+//²¾ÅÐÏ¿¥Æ¡¼¥Ö¥ë¥Á¥§¥Ã¥¯
+$ent_temp_flag = $objQuery->count("dtb_customer_mail_temp", "email = ? " ,array($entry_email));
+$stop_temp_flag = $objQuery->count("dtb_customer_mail_temp", "email = ? " ,array($stop_email));
+//ËÜ¥Æ¡¼¥Ö¥ë¤«¤éÅÐÏ¿POSTÃÍ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¼èÆÀ
+$arrRetEnt = $objQuery->select("*","dtb_customer_mail","email = ?",array($entry_email));
+$arrEmailEnt = $arrRetEnt[0]['email'];
+
+//ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«
+$email_flag = $objQuery->count("dtb_customer_mail","email = ?",array($entry_email));
+
+//ËÜ¥Æ¡¼¥Ö¥ë¤«¤é²ò½üPOSTÃÍ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¼èÆÀ
+$arrRetStop = $objQuery->select("*","dtb_customer_mail" , " email = ? ",array($stop_email));
+$arrEmailStop = $arrRetStop[0]['email'];
+
+//´°Î»¥á¥Ã¥»¡¼¥¸¤Î½é´ü²½
+$mes1="";
+$mes2="";
+
+//¥é¥ó¥À¥àIDÀ¸À®		
+$randomid = sfGetUniqRandomId();
+
+foreach($_POST as $key => $val) {
+	
+	switch ($key) {
+	case 'entry':
+	if (count($arrErr) == ""){
+		//ÅÐÏ¿¤¬¤Ê¤±¤ì¤Ð¡¢²¾ÅÐÏ¿¼Â¹Ô
+		if ($email_flag == 0){
+			$objPage->tpl_css = '/css/layout/mailmagazine/complete.css';
+			$objPage->tpl_mainpage =  "mailmagazine/complete.tpl";
+				switch ($checkbox){
+					case '1':
+					$objPage->tpl_kindname = "HTML";
+					break;
+					case '2':
+					$objPage->tpl_kindname = "¥Æ¥­¥¹¥È";
+					break;
+				}
+			$objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=$randomid";
+			$objPage->tpl_name = "ÅÐÏ¿";
+			$objPage->tpl_email = $entry_email;
+			$objPage->tpl_mailtitle = "¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+			sfSendTplMail($entry_email, $entry_email_subject, "mail_templates/mailmagazine_temp.tpl", $objPage);
+			
+			if ($ent_temp_flag == 0){				
+			$sql = "INSERT INTO dtb_customer_mail_temp";
+			$sql.= "(email,mail_flag,temp_id,end_flag) VALUES ('$entry_email' , '$checkbox' ,'$randomid','0')";
+			$objQuery->exec($sql);
+			}else{
+			$sql = "UPDATE dtb_customer_mail_temp SET temp_id = '$randomid' , mail_flag='$checkbox' , end_flag='0'";
+			$sql.= "WHERE email = ?";
+			$objQuery->exec($sql,array($entry_email));
+			}
+			//²¾²ñ°÷¤Î¾ì¹ç
+		}elseif (($email_flag == 1) && ($arrRetEnt[0]['mail_flag'] >= 4)){
+			$objPage->arrErr['entry'] = "¢¨¡¡²ñ°÷ÅÐÏ¿¤¬½ªÎ»¤·¤Æ¤¤¤Þ¤»¤ó¡£Àè¤ËËÜ²ñ°÷ÅÐÏ¿¤òºÑ¤Þ¤»¤Æ¤¯¤À¤µ¤¤¡£";
+		
+		//Àµ²ñ°÷¤Ç¡¢´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹µÚ¤ÓÇÛ¿®·Á¼°¤Î¾ì¹ç
+		}elseif ($ent_flag == 1){
+			$objPage->arrErr['entry']= "¢¨¡¡´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹µÚ¤ÓÇÛ¿®·Á¼°¤Ç¤¹¡£";
+			
+		//Àµ²ñ°÷¤Ç¡¢´û¤Ë¥á¥ë¥Þ¥¬ÇÛ¿®¤òÊÑ¹¹¤·¤¿¤³¤È¤¬¤¢¤ê¡¢ÇÛ¿®·Á¼°¤¬Æó½Å¤Ç¤Ê¤±¤ì¤Ð¡¢ÇÛ¿®·Á¼°ÊÑ¹¹¡¦ºÆÇÛ¿®¼Â¹Ô¡Ê²¾¥Æ¡¼¥Ö¥ë¹¹¿·¡Ë
+		}else{
+			if (($email_flag == 1) && ($update_flag == 1)  && ($arrRetEnt[0]['mail_flag'] <= 3) && ($ent_temp_flag != 0)){
+			$sql = "UPDATE dtb_customer_mail_temp SET temp_id = '$randomid' , mail_flag='$checkbox' , end_flag='0'";
+			$sql.= "WHERE email = ?";
+			$objQuery->exec($sql,array($entry_email));
+			}else{
+				//  Àµ²ñ°÷¤Ç¡¢°ìÅÙ¤â¥á¥ë¥Þ¥¬ÇÛ¿®¤òÊÑ¹¹¤·¤¿¤³¤È¤¬¤Ê¤¯¡¢ÇÛ¿®·Á¼°¤¬Æó½Å¤Ç¤Ê¤±¤ì¤Ð¡¢ÇÛ¿®·Á¼°ÊÑ¹¹¡¦ºÆÇÛ¿®¼Â¹Ô¡Ê²¾¥Æ¡¼¥Ö¥ëÅÐÏ¿¡Ë
+				if (($email_flag ==1) && ($update_flag == 1) && ($arrRetEnt[0]['mail_flag'] <= 3) && ($ent_temp_flag == 0)){
+					$sql = "INSERT INTO dtb_customer_mail_temp";
+					$sql.= "(email,mail_flag,temp_id,end_flag) VALUES ('$entry_email' , '$checkbox' ,'$randomid','0')";
+					$objQuery->exec($sql);
+				}
+			}
+			$objPage->tpl_css = '/css/layout/mailmagazine/complete.css';
+			$objPage->tpl_mainpage =  "mailmagazine/complete.tpl";
+			
+			switch($arrRetEnt[0]['mail_flag']){
+				
+			case '1':
+			$objPage->tpl_kindname = "HTML¢ª¥Æ¥­¥¹¥È";
+			break;
+			
+			case '2':
+			$objPage->tpl_kindname = "¥Æ¥­¥¹¥È¢ªHTML";
+			
+			break;
+			
+			case '3':
+				switch($checkbox){
+					case '1':
+					$objPage->tpl_kindname = "HTML";
+					break;	
+					case '2':
+					$objPage->tpl_kindname = "¥Æ¥­¥¹¥È";
+					break;
+				}	
+			break;
+			
+			}
+			$objPage->tpl_email = $entry_email;
+			$objPage->tpl_name = "ÅÐÏ¿";
+			$objPage->tpl_mailtitle = "¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+			$objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=$randomid";
+			sfSendTplMail($entry_email, $entry_email_subject, "mail_templates/mailmagazine_temp.tpl", $objPage);
+		}
+			$mes1.="¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+			$mes2.="³ÎÇ§¥á¡¼¥ë¤òÁ÷ÉÕ¤·¤Þ¤·¤¿¤Î¤Ç¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+	}
+		break;
+		
+	case 'stop':
+	if (count($arrErr) == ""){									
+		if ($stop_email_flag == 1){					//ËÜÅÐÏ¿¤µ¤ì¤Æ¤¤¤ì¤Ð
+			if ($arrRetStop[0]['mail_flag'] <= 2){
+				switch ($stop_temp_flag){
+					case '0':	//¡¡ËÜ²ñ°÷ÅÐÏ¿¸å¡¢½é¤á¤Æ¥á¥ë¥Þ¥¬ÇÛ¿®Ää»ß¤ò´õË¾¤·¤¿¤È¤­
+					$sql= "INSERT INTO dtb_customer_mail_temp";
+					$sql.="(email,mail_flag,temp_id,end_flag) VALUES ('$stop_email','3','$randomid','0')";
+					$objQuery->exec($sql);
+					break;
+					
+					case '1':	// ²áµî¤Ë¥á¥ë¥Þ¥¬ÍúÎò¤òÊÑ¹¹¤·¤¿¤³¤È¤¬¤¢¤ë¤È¤­
+					$sql = "UPDATE dtb_customer_mail_temp SET temp_id='$randomid' , mail_flag='3' , end_flag='0' ";
+					$sql.= "WHERE email = ? ";
+					$objQuery->exec($sql,array($stop_email));
+					break;
+				}
+						//ºï½ü
+				$mes1.="¥á¥ë¥Þ¥¬²¾²ò½ü¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+				$mes2.="³ÎÇ§¥á¡¼¥ë¤òÁ÷ÉÕ¤·¤Þ¤·¤¿¤Î¤Ç¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+				$objPage->tpl_css = '/css/layout/mailmagazine/complete.css';
+				$objPage->tpl_mainpage =  "mailmagazine/complete.tpl";
+				switch ($arrRetStop[0]['mail_flag']){
+					case '1':
+					$objPage->tpl_kindname = "HTML";
+					break;
+					case '2':
+					$objPage->tpl_kindname = "¥Æ¥­¥¹¥È";
+					break;
+				}
+				$objPage->tpl_mailtitle = "¥á¥ë¥Þ¥¬²¾²ò½ü¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+				$objPage->tpl_email = $stop_email;
+				$objPage->tpl_name = "²ò½ü";
+				$objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=$randomid";
+				sfSendTplMail($stop_email, $stop_email_subject, "mail_templates/mailmagazine_temp.tpl", $objPage);
+			}elseif ($arrRetStop[0]['mail_flag'] >= 4){
+				$objPage->arrErr['stop']= "¢¨¡¡²ñ°÷ÅÐÏ¿¤¬½ªÎ»¤·¤Æ¤¤¤Þ¤»¤ó¡£Àè¤ËËÜ²ñ°÷ÅÐÏ¿¤òºÑ¤Þ¤»¤Æ¤¯¤À¤µ¤¤¡£";
+			}else{
+				$objPage->arrErr['stop']= "¢¨¡¡´û¤ËÇÛ¿®Ää»ß¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+			}
+		}else{
+				$objPage->arrErr['stop']= "¢¨¡¡ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+		}
+	}
+		break;
+}
+
+}
+
+$objPage->mes1 = $mes1;
+$objPage->mes2 = $mes2;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);					
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+		switch ($_POST['mode']) {
+			case 'entry':
+			$objErr->doFunc(array("ÅÐÏ¿¥á¡¼¥ë¥¢¥É¥ì¥¹", "entry", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "MAX_LENGTH_CHECK"));
+			break;
+	
+			case 'stop':
+			$objErr->doFunc(array("ÇÛ¿®Ää»ß¥á¡¼¥ë¥¢¥É¥ì¥¹", "stop", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "MAX_LENGTH_CHECK"));
+			break;
+		}
+	return $objErr->arrErr;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	// ¿ÍÊª´ðËÜ¾ðÊó
+	
+	// ¥¹¥Ý¥Ã¥È¾¦ÉÊ
+	$arrConvList['name'] = "KVa";
+	$arrConvList['main_list_comment'] = "KVa";
+	$arrConvList['price01'] = "n";
+	$arrConvList['price02'] = "n";
+	$arrConvList['stock'] = "n";
+	$arrConvList['sale_limit'] = "n";
+	$arrConvList['point_rate'] = "n";
+	$arrConvList['product_code'] = "KVna";
+	$arrConvList['deliv_fee'] = "n";
+
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	
+	global $arrSTATUS;
+	$array['product_flag'] = sfMergeCheckBoxes($array['product_flag'], count($arrSTATUS));
+	
+	return $array;
+}
+?>
Index: /temp/trunk/html/mailmagazine/regist.php
===================================================================
--- /temp/trunk/html/mailmagazine/regist.php	(revision 1328)
+++ /temp/trunk/html/mailmagazine/regist.php	(revision 1328)
@@ -0,0 +1,127 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/mailmagazine/complete.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'mailmagazine/complete.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¥á¥ë¥Þ¥¬ÅÐÏ¿¥²ò½ü';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+//GET¤Ç»ØÄê¤·¤¿id¤ËÂÐ±þ¤¹¤ë¥Ç¡¼¥¿¤ò¼èÆÀ
+$arrtmpdata = $objQuery->select("*", "dtb_customer_mail_temp", "temp_id = ?", array($_GET['temp_id']));
+
+//ÉÔÀµ¤ÊURL»þ¤Î¥¨¥é¡¼½èÍý(count = 0 ¤ÇÉÔÀµ¤ÊÆþÎÏ)
+$arrcount = $objQuery->count("dtb_customer_mail_temp","temp_id = ?", array($_GET['temp_id']));
+
+//²¾¥Æ¡¼¥Ö¥ë¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¼èÆÀ $arremail
+$arremail = $arrtmpdata[0]['email'];			
+//²¾¥Æ¡¼¥Ö¥ë¤Î¥Õ¥é¥°¡¡$arrflag¡¡(1:HTML 2:¥Æ¥­¥¹¥È 3:ÇÛ¿®Ää»ß)
+$arrflag = $arrtmpdata[0]['mail_flag'];
+//ËÜ¥Æ¡¼¥Ö¥ë¤Ç¡¢¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÎÅÐÏ¿¥Á¥§¥Ã¥¯
+$arrcnt = $objQuery->count("dtb_customer_mail" ,"email=?",array($arremail));
+//ËÜ¥Æ¡¼¥Ö¥ë¤Î¥Õ¥é¥°
+$arrsel = $objQuery->select("*", "dtb_customer_mail", "email LIKE ?", array($arremail));
+			
+//½èÍý¥á¥Ã¥»¡¼¥¸½é´ü²½
+$mes1="";			
+$mes2="";
+
+//·ïÌ¾¤Î¥Æ¥ó¥×¥ì¡¼¥È¤ËÅÏ¤¹¥á¥Ã¥»¡¼¥¸
+$ent_subject = sfMakeSubject('¥á¥ë¥Þ¥¬ËÜÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+$stop_subject= sfMakeSubject('¥á¥ë¥Þ¥¬²ò½ü¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+
+if ($arrcount == 0){
+	$mes1 = "Ç§¾Ú¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+	$mes2 = "³ÎÇ§¥á¡¼¥ë¤ÎURL¤ò¤ª³Î¤«¤á²¼¤µ¤¤¡£";
+}elseif ($arremail != "" && $arrtmpdata[0]['end_flag'] == 1 && $arrflag <= 2){
+	$mes1 = "´û¤Ë¥á¥ë¥Þ¥¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+	$mes2 = "ÆâÍÆ¤òÊÑ¹¹¤µ¤ì¤ë¾ì¹ç¤Ï¡¢¡Ö¥á¥ë¥Þ¥¬ÅÐÏ¿¡¦²ò½ü¡×¥Õ¥©¡¼¥à¤è¤ê¤ª´ê¤¤Ã×¤·¤Þ¤¹¡£";
+}elseif ($arremail != "" && $arrtmpdata[0]['end_flag'] == 1 && $arrflag == 3){
+	$mes1 = "´û¤Ë¥á¥ë¥Þ¥¬²ò½ü¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+	$mes2 = "ÆâÍÆ¤òÊÑ¹¹¤µ¤ì¤ë¾ì¹ç¤Ï¡¢¡Ö¥á¥ë¥Þ¥¬ÅÐÏ¿¡¦²ò½ü¡×¥Õ¥©¡¼¥à¤è¤ê¤ª´ê¤¤Ã×¤·¤Þ¤¹¡£";
+}else{
+
+//²¾¥Æ¡¼¥Ö¥ë¤ÎÆâÍÆ¥Á¥§¥Ã¥¯
+
+ switch ($arrflag){
+	case '1':
+	if ($arrcnt == 0){
+		$entry_sql = "INSERT INTO dtb_customer_mail (email,mail_flag) VALUES ('$arremail' , '1')";
+		$flag_sql = "UPDATE dtb_customer_mail_temp SET end_flag='1' WHERE email = ?";
+		$objQuery->exec($entry_sql);
+		$objQuery->exec($flag_sql,array($arremail));
+	}else{
+		$change_sql= "UPDATE dtb_customer_mail SET mail_flag='1' WHERE email = ?";
+		$flag_sql = "UPDATE dtb_customer_mail_temp SET end_flag='1' , update_date=now() WHERE email = ? ";
+		$objQuery->exec($change_sql,array($arremail));
+		$objQuery->exec($flag_sql,array($arremail));
+	}
+		$mes1.="¥á¥ë¥Þ¥¬ËÜÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+		$mes2.="´°Î»¥á¡¼¥ë¤òÁ÷ÉÕ¤·¤Þ¤·¤¿¤Î¤Ç¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+		$objPage->tpl_mailtitle = "¥á¥ë¥Þ¥¬ËÜÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+		$objPage->tpl_email = $arremail;
+		$objPage->tpl_name = "ÅÐÏ¿";
+		$objPage->tpl_kindname = "¥Æ¥­¥¹¥È¢ªHTML";
+		sfSendTplMail($arremail, $ent_subject, "mail_templates/mailmagazine_comp.tpl" , $objPage);
+	break;
+
+	case '2':
+	if ($arrcnt == 0){
+		$entry_sql = "INSERT INTO dtb_customer_mail (email,mail_flag) VALUES ('$arremail' , '2')";
+		$flag_sql = "UPDATE dtb_customer_mail_temp SET end_flag='1' WHERE email = ?";
+		$objQuery->exec($entry_sql);
+		$objQuery->exec($flag_sql,array($arremail));
+	}else{
+		$change_sql= "UPDATE dtb_customer_mail SET mail_flag='2' WHERE email = ?";
+		$flag_sql = "UPDATE dtb_customer_mail_temp SET end_flag='1' , update_date=now() WHERE email = ? ";
+		$objQuery->exec($change_sql,array($arremail));
+		$objQuery->exec($flag_sql,array($arremail));
+	}
+		$objPage->tpl_mailtitle = "¥á¥ë¥Þ¥¬ËÜÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+		$objPage->tpl_name = "ÅÐÏ¿";
+		$objPage->tpl_email = $arremail;
+		$objPage->tpl_kindname = "HTML¢ª¥Æ¥­¥¹¥È";
+		$mes1.="¥á¥ë¥Þ¥¬ËÜÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+		$mes2.="´°Î»¥á¡¼¥ë¤òÁ÷ÉÕ¤·¤Þ¤·¤¿¤Î¤Ç¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+		sfSendTplMail($arremail, $ent_subject, "mail_templates/mailmagazine_comp.tpl" , $objPage);
+	break;
+	
+	case '3':
+	switch ($arrsel[0]['mail_flag']){
+			case '1':
+			$objPage->tpl_kindname = "HTML";
+			break;
+			case '2':
+			$objPage->tpl_kindname = "¥Æ¥­¥¹¥È";
+			break;
+		}
+		$stop_sql = "UPDATE dtb_customer_mail SET mail_flag='3' WHERE email = ?";
+		$flag_sql = "UPDATE dtb_customer_mail_temp SET end_flag='1' , update_date=now() WHERE email = ?";
+		$objQuery->exec($stop_sql,array($arremail));
+		$objQuery->exec($flag_sql,array($arremail));
+		$objPage->tpl_mailtitle = "¥á¥ë¥Þ¥¬²ò½ü¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+		$objPage->tpl_name = "²ò½ü";
+		$objPage->tpl_email = $arremail;
+		sfSendTplMail($arremail,$stop_subject, "mail_templates/mailmagazine_comp.tpl" , $objPage);
+		$mes1.="¥á¥ë¥Þ¥¬²ò½ü¤¬´°Î»¤·¤Þ¤·¤¿¡£";
+		$mes2.="´°Î»¥á¡¼¥ë¤òÁ÷ÉÕ¤·¤Þ¤·¤¿¤Î¤Ç¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+		break;
+ }
+
+}
+
+$objPage->mes1 = $mes1;
+$objPage->mes2 = $mes2;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
+
Index: /temp/trunk/html/answer/index.php
===================================================================
--- /temp/trunk/html/answer/index.php	(revision 1328)
+++ /temp/trunk/html/answer/index.php	(revision 1328)
@@ -0,0 +1,19 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/answer/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'answer/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display('answer/index.tpl');
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/forgot/index.php
===================================================================
--- /temp/trunk/html/forgot/index.php	(revision 1328)
+++ /temp/trunk/html/forgot/index.php	(revision 1328)
@@ -0,0 +1,143 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $errmsg;
+	var $arrReminder;
+	var $temp_password;
+		
+	function LC_Page() {
+		$this->tpl_mainpage = 'forgot/index.tpl';
+		$this->tpl_mainno = '';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+$CONF = sf_getBasisData();					// Å¹ÊÞ´ðËÜ¾ðÊó
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+if ( $_POST['mode'] == 'mail_check' ){
+	//¥á¥¢¥ÉÆþÎÏ»þ
+	$_POST['email'] = strtolower($_POST['email']);
+	$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND status = 2 AND delete = 0";
+	$result = $conn->getAll($sql, array($_POST['email']) );
+	
+	if ( $result[0]['reminder'] ){		// ËÜ²ñ°÷ÅÐÏ¿ºÑ¤ß¤Î¾ì¹ç
+		// ÆþÎÏemail¤¬Â¸ºß¤¹¤ë		
+		$_SESSION['forgot']['email'] = $_POST['email'];
+		$_SESSION['forgot']['reminder'] = $result[0]['reminder'];
+		// ¥Ò¥ß¥Ä¤ÎÅú¤¨ÆþÎÏ²èÌÌ
+		$objPage->Reminder = $arrReminder[$_SESSION['forgot']['reminder']];
+		$objPage->tpl_mainpage = 'forgot/secret.tpl';
+	} else {
+		$sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? AND status = 1 AND delete = 0";	//²¾ÅÐÏ¿Ãæ¤Î³ÎÇ§
+		$result = $conn->getAll($sql, array($_POST['email']) );
+		if ($result) {
+			$objPage->errmsg = "¤´ÆþÎÏ¤Îemail¥¢¥É¥ì¥¹¤Ï¸½ºß²¾ÅÐÏ¿Ãæ¤Ç¤¹¡£<br>ÅÐÏ¿¤ÎºÝ¤Ë¤ªÁ÷¤ê¤·¤¿¥á¡¼¥ë¤ÎURL¤Ë¥¢¥¯¥»¥¹¤·¡¢<br>ËÜ²ñ°÷ÅÐÏ¿¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£";
+		} else {		//¡¡ÅÐÏ¿¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+			$objPage->errmsg = "¤´ÆþÎÏ¤Îemail¥¢¥É¥ì¥¹¤ÏÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó";
+		}
+	}
+	
+} elseif( $_POST['mode'] == 'secret_check' ){
+	//¥Ò¥ß¥Ä¤ÎÅú¤¨ÆþÎÏ»þ
+	
+	if ( $_SESSION['forgot']['email'] ) {
+		// ¥Ò¥ß¥Ä¤ÎÅú¤¨¤Î²óÅú¤¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯
+		
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND delete = 0";
+		$result = $conn->getAll($sql, array($_SESSION['forgot']['email']) );
+		$data = $result[0];
+		
+		if ( $data['reminder_answer'] == $_POST['input_reminder'] ){
+			// ¥Ò¥ß¥Ä¤ÎÅú¤¨¤¬Àµ¤·¤¤
+						
+			// ¿·¤·¤¤¥Ñ¥¹¥ï¡¼¥É¤òÀßÄê¤¹¤ë
+			$objPage->temp_password = gfMakePassword(8);
+						
+			if(FORGOT_MAIL == 1) {
+				// ¥á¡¼¥ë¤ÇÊÑ¹¹ÄÌÃÎ¤ò¤¹¤ë
+				lfSendMail($CONF, $_SESSION['forgot']['email'], $data['name01'], $objPage->temp_password);
+			}
+			
+			// DB¤ò½ñ¤­´¹¤¨¤ë
+			$sql = "UPDATE dtb_customer SET password = ?, update_date = now() WHERE customer_id = ?";
+			$conn->query( $sql, array( crypt($objPage->temp_password) ,$data['customer_id']) );
+			
+			// ´°Î»²èÌÌ¤ÎÉ½¼¨
+			$objPage->tpl_mainpage = 'forgot/complete.tpl';
+			
+			// ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤Î²òÊü
+			$_SESSION['forgot'] = array();
+			unset($_SESSION['forgot']);
+			
+		} else {
+			// ¥Ò¥ß¥Ä¤ÎÅú¤¨¤¬Àµ¤·¤¯¤Ê¤¤
+			
+			$objPage->Reminder = $arrReminder[$_SESSION['forgot']['reminder']];
+			$objPage->errmsg = "¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¼ÁÌä¤ËÂÐ¤¹¤ë²óÅú¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó";
+			$objPage->tpl_mainpage = 'forgot/secret.tpl';
+
+		}
+	
+		
+	} else {
+		// ¥¢¥¯¥»¥¹¸µ¤¬ÉÔÀµ¤Þ¤¿¤Ï¡¢¥»¥Ã¥·¥ç¥óÊÝ»ý´ü´Ö¤¬ÀÚ¤ì¤Æ¤¤¤ë
+		$objPage->errmsg = "email¥¢¥É¥ì¥¹¤òºÆÅÙÅÐÏ¿¤·¤Æ¤¯¤À¤µ¤¤¡£<br />Á°²ó¤ÎÆþÎÏ¤«¤é»þ´Ö¤¬·Ð¤Ã¤Æ¤¤¤Þ¤¹¤È¡¢ËÜ¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤ë²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+	}
+}
+
+// ¥Ç¥Õ¥©¥ë¥ÈÆþÎÏ
+if($_POST['email'] != "") {
+	// POSTÃÍ¤òÆþÎÏ
+	$objPage->tpl_login_email = $_POST['email'];
+} else {
+	// ¥¯¥Ã¥­¡¼ÃÍ¤òÆþÎÏ
+	$objPage->tpl_login_email = $objCookie->getCookie('login_email');
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+// ---------------------------------------------------------------------------------------------------------------
+
+
+function lfSendMail($CONF, $email, $customer_name, $temp_password){
+	//¡¡¥Ñ¥¹¥ï¡¼¥ÉÊÑ¹¹¤ªÃÎ¤é¤»¥á¡¼¥ëÁ÷¿®
+	
+	$objPage = new LC_Page();
+	$objPage->customer_name = $customer_name;
+	$objPage->temp_password = $temp_password;
+	$objMailText = new SC_SiteView();
+	$objMailText->assignobj($objPage);
+	
+	$toCustomerMail = $objMailText->fetch("mail_templates/forgot_mail.tpl");
+	$objMail = new GC_SendMail();
+	
+	$objMail->setItem(
+						  ''								//¡¡°¸Àè
+						, "¥Ñ¥¹¥ï¡¼¥É¤¬ÊÑ¹¹¤µ¤ì¤Þ¤·¤¿" ."¡Ú" .$CONF["shop_name"]. "¡Û"		//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $CONF["email03"]					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+
+														);
+	$objMail->setTo($email, $customer_name ." ÍÍ");
+	$objMail->sendMail();	
+	
+}
+
+
+?>
+
Index: /temp/trunk/html/products/detail_image.php
===================================================================
--- /temp/trunk/html/products/detail_image.php	(revision 1328)
+++ /temp/trunk/html/products/detail_image.php	(revision 1328)
@@ -0,0 +1,51 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/detail_image.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ´ÉÍý¥Ú¡¼¥¸¤«¤é¤Î³ÎÇ§¤Î¾ì¹ç¤Ï¡¢Èó¸ø³«¤Î¾¦ÉÊ¤âÉ½¼¨¤¹¤ë¡£
+if($_GET['admin'] == 'on') {
+	$where = "delete = 0";
+} else {
+	$where = "delete = 0 AND status = 1";
+}
+
+// ÃÍ¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
+if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $_GET['product_id'], $where)) {
+	sfDispSiteError(PRODUCT_NOT_FOUND);
+}
+
+
+$image_key = $_GET['image'];
+
+$objQuery = new SC_Query();
+$col = "name, $image_key";
+$arrRet = $objQuery->select($col, "dtb_products", "product_id = ?", array($_GET['product_id']));
+
+if (sfIsInt($_GET['width']) && sfIsInt($_GET['height'])) {
+	$objPage->tpl_width = $_GET['width'];
+	$objPage->tpl_height = $_GET['height']; 	
+} else {
+	$objPage->tpl_width = LARGE_IMAGE_WIDTH;
+	$objPage->tpl_height = LARGE_IMAGE_HEIGHT;
+}
+
+$objPage->tpl_table_width = $objPage->tpl_width + 20;
+$objPage->tpl_table_height = $objPage->tpl_height + 20;
+
+$objPage->tpl_image = $arrRet[0][$image_key];
+$objPage->tpl_name = $arrRet[0]['name'];
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/products/format.php
===================================================================
--- /temp/trunk/html/products/format.php	(revision 1328)
+++ /temp/trunk/html/products/format.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/product/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/top.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+
+
+
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/products/userdata.php
===================================================================
--- /temp/trunk/html/products/userdata.php	(revision 1328)
+++ /temp/trunk/html/products/userdata.php	(revision 1328)
@@ -0,0 +1,13 @@
+<?php
+
+/*¡¡¾¦ÉÊ¾ÜºÙ¥Ú¡¼¥¸¤ÎHTML³«ÊüÉôÊ¬¥Æ¥ó¥×¥ì¡¼¥ÈÉ½¼¨ÍÑ¥Õ¥¡¥¤¥ë */
+
+$objUserView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR);
+//HTML³«ÊüÍÑ¤Î¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÌ¾
+$tpl_name = "products_detail_share.tpl";
+//¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+if(file_exists(TEMPLATE_FTP_DIR . $tpl_name)) {
+	$objUserView->display($tpl_name);
+}
+
+?>
Index: /temp/trunk/html/products/review_complete.php
===================================================================
--- /temp/trunk/html/products/review_complete.php	(revision 1328)
+++ /temp/trunk/html/products/review_complete.php	(revision 1328)
@@ -0,0 +1,16 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/review_complete.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);					
+
+?>
Index: /temp/trunk/html/products/list.php
===================================================================
--- /temp/trunk/html/products/list.php	(revision 1328)
+++ /temp/trunk/html/products/list.php	(revision 1328)
@@ -0,0 +1,416 @@
+<?php
+$LIST_PHP_DIR = realpath(dirname( __FILE__));
+require_once($LIST_PHP_DIR  . "/../../data/lib/slib.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_View.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_Query.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_Customer.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_Cookie.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_SiteInfo.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_PageNavi.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_CheckError.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_CartSession.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	function LC_Page() {
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrSTATUS_IMAGE;
+		$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
+		global $arrDELIVERYDATE;
+		$this->arrDELIVERYDATE = $arrDELIVERYDATE;
+		global $arrPRODUCTLISTMAX;
+		$this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX;		
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objSiteInfo = new SC_SiteInfo();
+$conn = new SC_DBConn();
+
+//É½¼¨·ï¿ô¤ÎÁªÂò
+if(sfIsInt($_POST['disp_number'])) {
+	$objPage->disp_number = $_POST['disp_number'];
+} else {
+	//ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò
+	$objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX));
+}
+
+//É½¼¨½ç½ø¤ÎÊÝÂ¸
+$objPage->orderby = $_POST['orderby'];
+
+// GET¤Î¥«¥Æ¥´¥êID¤ò¸µ¤ËÀµ¤·¤¤¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë¡£
+$category_id = sfGetCategoryId("", $_GET['category_id']);
+
+// ¥¿¥¤¥È¥ëÊÔ½¸
+$tpl_subtitle = "";
+if($_GET['mode'] == 'search'){
+	$tpl_subtitle = "¸¡º÷·ë²Ì";
+}elseif ($category_id == "" ) {
+	$tpl_subtitle = "Á´¾¦ÉÊ";
+}else{
+	$arrFirstCat = GetFirstCat($category_id);
+	$tpl_subtitle = $arrFirstCat['name'];
+}
+
+$objQuery = new SC_Query();
+$count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id));
+
+// °Ê²¼¤Î¾ò·ï¤ÇBEST¾¦ÉÊ¤òÉ½¼¨¤¹¤ë
+// ¡¦BESTºÇÂç¿ô¤Î¾¦ÉÊ¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¡£
+// ¡¦¥«¥Æ¥´¥êID¤¬¥ë¡¼¥ÈID¤Ç¤¢¤ë¡£
+// ¡¦¸¡º÷¥â¡¼¥É¤Ç¤Ê¤¤¡£
+if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) {
+	// ¾¦ÉÊTOP¤ÎÉ½¼¨½èÍý
+	/** É¬¤º»ØÄê¤¹¤ë **/
+	$objPage->tpl_css = '/css/layout/product/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+	/** É¬¤º»ØÄê¤¹¤ë **/
+	$objPage->tpl_mainpage = ROOT_DIR . 'html/user_data/templates/list.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È	
+	$objPage->arrBestItems = sfGetBestProducts($conn, $category_id);
+	$objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2);
+} else {
+	if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){
+		// ¸¡º÷»þ¤Ëcategory_id¤¬GET¤ËÂ¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌá¤¹
+		$category_id = '';	
+	}
+	
+	// ¾¦ÉÊ°ìÍ÷¤ÎÉ½¼¨½èÍý
+	$objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']);
+	
+	// ¸¡º÷¾ò·ï¤ò²èÌÌ¤ËÉ½¼¨
+	// ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï
+	if (strlen($_GET['category_id']) == 0) {
+		$arrSearch['category'] = "»ØÄê¤Ê¤·";
+	}else{
+		$arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));
+		$arrSearch['category'] = $arrCat;
+	}
+	
+	// ¾¦ÉÊÌ¾¸¡º÷¾ò·ï
+	if ($_GET['name'] === "") {
+		$arrSearch['name'] = "»ØÄê¤Ê¤·";
+	}else{
+		$arrSearch['name'] = $_GET['name'];
+	}
+
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "products/list.php");
+
+if($_POST['mode'] == "cart" && $_POST['product_id'] != "") {
+	// ÃÍ¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
+	if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "delete = 0 AND status = 1")) {
+		sfDispSiteError(PRODUCT_NOT_FOUND);
+	} else {
+		// ÆþÎÏÃÍ¤ÎÊÑ´¹
+		$objPage->arrErr = lfCheckError($_POST['product_id']);
+		if(count($objPage->arrErr) == 0) {
+			$objCartSess = new SC_CartSession();
+			$classcategory_id = "classcategory_id". $_POST['product_id'];
+			$classcategory_id1 = $_POST[$classcategory_id. '_1'];
+			$classcategory_id2 = $_POST[$classcategory_id. '_2'];
+			$quantity = "quantity". $_POST['product_id'];
+			// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) {
+				$classcategory_id1 = '0';
+			}
+			// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) {
+				$classcategory_id2 = '0';
+			}
+			$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
+			header("Location: /cart/index.php");
+			exit;
+		}
+	}
+}
+
+
+$objPage->tpl_subtitle = $tpl_subtitle;
+
+// »ÙÊ§ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = lfGetPayment();
+// ÆþÎÏ¾ðÊó¤òÅÏ¤¹
+$objPage->arrForm = $_POST;
+
+$objPage->arrInfo = $objSiteInfo->data;
+$objPage->category_id = $category_id;
+$objPage->arrSearch = $arrSearch;
+
+sfCustomDisplay($objPage);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥«¥Æ¥´¥êID¤¬¥ë¡¼¥È¤«¤É¤¦¤«¤ÎÈ½Äê */
+function lfIsRootCategory($category_id) {
+	$objQuery = new SC_Query();
+	$level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id));
+	if($level == 1) {
+		return true;
+	}
+	return false;
+}
+
+/* ¾¦ÉÊ°ìÍ÷¤ÎÉ½¼¨ */
+function lfDispProductsList($category_id, $name, $disp_num, $orderby) {
+	global $objPage;
+	$objQuery = new SC_Query();	
+	$objPage->tpl_pageno = $_POST['pageno'];
+	$objPage->tpl_css = '/css/layout/product/list.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+	
+	//É½¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤ë
+	$objPage->tpl_mainpage = ROOT_DIR . 'html/user_data/templates/list.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È		
+	//É½¼¨½ç½ø
+	switch($orderby) {
+	//²Á³Ê½ç
+	case 'price':
+		$order = "price02_min ASC";
+		break;
+	//¿·Ãå½ç
+	case 'date':
+		$order = "create_date DESC";
+		break;
+	default:
+		$order = "rank DESC, category_rank DESC";
+		break;
+	}
+	
+	// ¾¦ÉÊ¸¡º÷¾ò·ï¤ÎºîÀ®¡ÊÌ¤ºï½ü¡¢É½¼¨¡Ë
+	$where = "delete = 0 AND status = 1 ";
+	// ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREÊ¸»úÎó¼èÆÀ
+	if ( $category_id ) {
+		list($tmp_where, $arrval) = sfGetCatWhere($category_id);
+		if($tmp_where != "") {
+			$where.= " AND $tmp_where";
+		}
+	}
+		
+	// ¾¦ÉÊÌ¾¤òwhereÊ¸¤Ë
+	$name = ereg_replace(",", "", $name);
+	if ( strlen($name) > 0 ){
+		$where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";
+		$ret = sfManualEscape($name);		
+		$arrval[] = "%$ret%";
+		$arrval[] = "%$ret%";
+	}
+			
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count("vw_products_allclass", $where, $arrval);
+	$objPage->tpl_linemax = $linemax;	// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;					// ³«»Ï¹Ô
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($disp_num, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select("*", "vw_products_allclass", $where, $arrval);
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	// ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê
+	if($disp_num == 15) {
+		for($i = 0; $i < count($objPage->arrProducts); $i++) {
+			$objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
+			// ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ
+			$objPage = lfGetSaleLimit($objPage->arrProducts[$i]);
+		}
+	}
+
+	// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+	$objPage->arrInfo = $objSiteInfo->data;
+		
+	return $objPage;
+}
+
+/* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */
+function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) {
+	global $objPage;
+	
+	$classcat_find1 = false;
+	$classcat_find2 = false;
+	// ºß¸Ë¤¢¤ê¤Î¾¦ÉÊ¤ÎÍ­Ìµ
+	$stock_find = false;
+	
+	// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+	$arrProductsClass = lfGetProductsClass($product_id);
+	
+	// µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']];
+	// µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']];
+	
+	// ¤¹¤Ù¤Æ¤ÎÁÈ¤ß¹ç¤ï¤»¿ô	
+	$count = count($arrProductsClass);
+	
+	$classcat_id1 = "";
+	
+	$arrSele = array();
+	$arrList = array();
+	
+	$list_id = 0;
+	$arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";
+	$arrVal[0] = "\tval". $product_id. "_0 = new Array(''";
+	
+	for ($i = 0; $i < $count; $i++) {
+		// ºß¸Ë¤Î¥Á¥§¥Ã¥¯
+		if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
+			continue;
+		}
+		
+		$stock_find = true;
+		
+		// µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
+			$arrList[$list_id].=");\n";
+			$arrVal[$list_id].=");\n";
+			$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
+			$arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
+			$list_id++;
+		}
+		
+		// µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ
+		if($arrList[$list_id] == "") {
+			$arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'";
+		} else {
+			$arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ
+		if($arrVal[$list_id] == "") {
+			$arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";
+		} else {
+			$arrVal[$list_id].= ", '".$classcat_id2."'";
+		}
+	}	
+	
+	$arrList[$list_id].=");\n";
+	$arrVal[$list_id].=");\n";
+		
+	// µ¬³Ê1
+	$objPage->arrClassCat1[$product_id] = $arrSele;
+	
+	$lists = "\tlists".$product_id. " = new Array(";
+	$no = 0;
+	foreach($arrList as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$lists.= ",list". $product_id. "_". $no;
+		} else {
+			$lists.= "list". $product_id. "_". $no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.= $lists.");\n";
+	
+	$vals = "\tvals".$product_id. " = new Array(";
+	$no = 0;
+	foreach($arrVal as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$vals.= ",val". $product_id. "_". $no;
+		} else {
+			$vals.= "val". $product_id. "_". $no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.= $vals.");\n";
+	
+	// ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID
+	$classcategory_id = "classcategory_id". $product_id;
+	$objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); ";
+
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id1'] != '0') {
+		$classcat_find1 = true;
+	}
+	
+	// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id2'] != '0') {
+		$classcat_find2 = true;
+	}
+		
+	$objPage->tpl_classcat_find1[$product_id] = $classcat_find1;
+	$objPage->tpl_classcat_find2[$product_id] = $classcat_find2;
+	$objPage->tpl_stock_find[$product_id] = $stock_find;
+		
+	return $objPage;
+}
+/* ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ */
+function lfGetProductsClass($product_id) {
+	$arrRet = array();
+	if(sfIsInt($product_id)) {
+		// ¾¦ÉÊµ¬³Ê¼èÆÀ
+		$objQuery = new SC_Query();
+		$col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
+		$table = "vw_product_class";
+		$where = "product_id = ?";
+		$objQuery->setorder("rank1 DESC, rank2 DESC");
+		$arrRet = $objQuery->select($col, $table, $where, array($product_id));
+	}
+	return $arrRet;
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError($id) {
+	global $objPage;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$objErr = new SC_CheckError();
+	
+	$classcategory_id1 = "classcategory_id". $id. "_1";
+	$classcategory_id2 = "classcategory_id". $id. "_2";
+	$quantity = "quantity". $id;
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	if ($objPage->tpl_classcat_find1[$id]) {
+		$objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	}
+	if ($objPage->tpl_classcat_find2[$id]) {
+		$objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	}
+	$objErr->doFunc(array("¿ôÎÌ", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+			
+	return $objErr->arrErr;
+}
+
+// ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê
+function lfGetSaleLimit($product) {
+	global $objPage;
+	//ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃÍ¤¬ÀßÄêÃÍ¤è¤êÂç¤­¤¤¾ì¹ç
+	if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {
+		$objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;
+	} else {
+		$objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];
+	}
+	
+	return $objPage;
+}
+
+//»ÙÊ§ÊýË¡¤Î¼èÆÀ
+//payment_id	1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñÎ±
+function lfGetPayment() {
+	$objQuery = new SC_Query;
+	$col = "payment_id, rule, payment_method";
+	$from = "dtb_payment";
+	$where = "delete = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /temp/trunk/html/products/batch_relate.php
===================================================================
--- /temp/trunk/html/products/batch_relate.php	(revision 1328)
+++ /temp/trunk/html/products/batch_relate.php	(revision 1328)
@@ -0,0 +1,38 @@
+<?php
+
+/*¡¡¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹¡£½¸·×¥Õ¥¡¥¤¥ë  */
+
+$BATCH_DIR = realpath(dirname( __FILE__));
+require_once($BATCH_DIR  . "/../../data/lib/slib.php");
+require_once($BATCH_DIR  . "/../../data/lib/glib.php");
+require_once($BATCH_DIR  . "/../../data/class/SC_Query.php");
+require_once($BATCH_DIR  . "/../../data/class/SC_DbConn.php");
+		
+$objQuery = new SC_Query();
+
+$objQuery->begin();
+$objQuery->delete("dtb_bat_relate_products");
+$arrCID = $objQuery->select("customer_id", "dtb_order", "delete = 0");
+foreach($arrCID as $cdata) {
+	$where = "order_id IN (SELECT order_id FROM dtb_order WHERE customer_id = ? )";
+	//¸ÜµÒ¤¬¹ØÆþ¤·¤¿¾¦ÉÊ£É£Ä¤ò¼èÆÀ¤¹¤ë
+	$arrPID = $objQuery->select("product_id", "dtb_order_detail", $where, array($cdata['customer_id']));
+	//¸ÜµÒ¤¬¾¦ÉÊ¤òÊ£¿ô¹ØÆþ¤·¤Æ¤¤¤ì¤Ð
+	if(count($arrPID) > 1) {
+		foreach($arrPID as $pdata1) {
+			//¤³¤Î¾¦ÉÊID
+			$sqlval['product_id'] = $pdata1['product_id'];
+			foreach($arrPID as $pdata2) {
+				if($pdata2['product_id'] != $pdata1['product_id']) {
+					//¤³¤ó¤Ê¾¦ÉÊID
+					$sqlval['relate_product_id'] = $pdata2['product_id'];
+					//¥Ç¡¼¥¿ÁÞÆþ
+					$objQuery->insert("dtb_bat_relate_products", $sqlval);
+				}
+			}
+		}
+	}
+}
+$objQuery->commit();
+
+?>
Index: /temp/trunk/html/products/favorite.php
===================================================================
--- /temp/trunk/html/products/favorite.php	(revision 1328)
+++ /temp/trunk/html/products/favorite.php	(revision 1328)
@@ -0,0 +1,31 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "products/favorite.tpl";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}else{
+	switch($_POST['mode']){
+		case 'favorite':
+		$col= "'".$_SESSION['customer']['customer_id']."','".$_POST['product_id']."','1','now()','now()' ";
+		$objQuery->exec("INSERT INTO dtb_customer_favorite VALUES (".$col.")");
+		$objQuery->getLastQuery(true);
+		break;
+	}
+}
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/products/review.php
===================================================================
--- /temp/trunk/html/products/review.php	(revision 1328)
+++ /temp/trunk/html/products/review.php	(revision 1328)
@@ -0,0 +1,167 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/review.tpl';
+		global $arrRECOMMEND;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "review_id", "convert" => "aKV" ),
+							 array(  "column" => "product_id", "convert" => "aKV" ),
+							 array(  "column" => "reviewer_name", "convert" => "aKV" ),
+							 array(  "column" => "reviewer_url", "convert" => "a"),
+							 array(  "column" => "sex", "convert" => "n" ),
+							 array(  "column" => "email", "convert" => "a" ),
+							 array(  "column" => "recommend_level", "convert" => "n" ),
+							 array(  "column" => "title", "convert" => "aKV" ),
+							 array(  "column" => "comment", "convert" => "aKV" ),
+
+						);
+switch ($_POST['mode']){
+case 'confirm':
+	$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+	$objPage->arrErr = lfErrorCheck($arrForm);
+	//½ÅÊ£¥á¥Ã¥»¡¼¥¸¤ÎÈ½Äê
+	$flag = $objQuery->count("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
+
+	if ($flag > 0){
+		$objPage->arrErr['title'] .= "½ÅÊ£¤·¤¿¥¿¥¤¥È¥ë¤ÏÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+	}
+		
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	if($objPage->arrErr == ""){
+		//½ÅÊ£¥¿¥¤¥È¥ë¤Ç¤Ê¤¤
+		if($flag == 0){
+			//¾¦ÉÊÌ¾¤Î¼èÆÀ
+			$arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($arrForm['product_id']));
+			$objPage->arrForm = $arrForm;
+			$objPage->tpl_mainpage = 'products/review_confirm.tpl';
+		}
+	} else {
+		//¾¦ÉÊÌ¾¤Î¼èÆÀ
+		$arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($arrForm['product_id']));	
+		$objPage->arrForm = $arrForm;
+	}
+	break;
+
+case 'return':
+	foreach($_POST as $key => $val){
+		$objPage->arrForm[ $key ] = $val;
+	}
+	
+	//¾¦ÉÊÌ¾¤Î¼èÆÀ
+	$objPage->arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($objPage->arrForm['product_id']));
+	if(empty($objPage->arrForm['name'])) {
+		sfDispSiteError(PAGE_ERROR);
+	}
+	break;
+
+case 'complete':
+	$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+	$arrErr = lfErrorCheck($arrForm);
+	//½ÅÊ£¥á¥Ã¥»¡¼¥¸¤ÎÈ½Äê
+	$flag = $objQuery->count("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	if ($arrErr == ""){
+		//½ÅÊ£¥¿¥¤¥È¥ë¤Ç¤Ê¤¤
+		if($flag == 0) {
+			//ÅÐÏ¿¼Â¹Ô
+			lfRegistRecommendData($arrForm, $arrRegistColumn);
+			//¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ß´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: ./review_complete.php");
+			exit;
+		}
+	} else {
+		if($flag > 0) {
+			sfDispSiteError(PAGE_ERROR);
+		}
+	}
+	break;
+
+default:
+	if(sfIsInt($_GET['product_id'])) {
+		//¾¦ÉÊ¾ðÊó¤Î¼èÆÀ
+		$arrForm = $objQuery->select("product_id, name", "dtb_products", "delete = 0 AND status = 1 AND product_id=?", array($_GET['product_id']));
+		if(empty($arrForm)) {
+			sfDispSiteError(PAGE_ERROR);
+		}
+		$objPage->arrForm = $arrForm[0];
+	}
+	break;
+
+}
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);					
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("¾¦ÉÊID", "product_id", INT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));			
+	$objErr->doFunc(array("Åê¹Æ¼ÔÌ¾", "reviewer_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("URL", "reviewer_url", MTEXT_LEN), array("MAX_LENGTH_CHECK", "URL_CHECK"));
+	$objErr->doFunc(array("¤ª¤¹¤¹¤á¥ì¥Ù¥ë", "recommend_level"), array("SELECT_CHECK"));
+	$objErr->doFunc(array("¥¿¥¤¥È¥ë", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//ÅÐÏ¿¼Â¹Ô
+function lfRegistRecommendData ($array, $arrRegistColumn) {
+	global $objQuery;
+	
+	// ²¾ÅÐÏ¿
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0 ) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+	}
+	$arrRegist['create_date'] = 'now()';
+	$arrRegist['creator_id'] = '0';
+	//-- ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->insert("dtb_review", $arrRegist);
+	$objQuery->commit();
+}
+
+?>
Index: /temp/trunk/html/products/detail.php
===================================================================
--- /temp/trunk/html/products/detail.php	(revision 1328)
+++ /temp/trunk/html/products/detail.php	(revision 1328)
@@ -0,0 +1,431 @@
+<?php
+$DETAIL_PHP_DIR = realpath(dirname( __FILE__));
+require_once($DETAIL_PHP_DIR  . "/../../data/lib/slib.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_View.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_Query.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_Customer.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_Cookie.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_SiteInfo.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_PageNavi.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_CheckError.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_CartSession.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_FormParam.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_UploadFile.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/product/detail.css';	// ¥á¥¤¥óCSS
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrSTATUS_IMAGE;
+		$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
+		global $arrDELIVERYDATE;
+		$this->arrDELIVERYDATE = $arrDELIVERYDATE;
+		global $arrRECOMMEND;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = new SC_SiteInfo();
+$objCustomer = new SC_Customer();
+$objQuery = new SC_Query();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "products/detail.php");
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+
+// ´ÉÍý¥Ú¡¼¥¸¤«¤é¤Î³ÎÇ§¤Î¾ì¹ç¤Ï¡¢Èó¸ø³«¤Î¾¦ÉÊ¤âÉ½¼¨¤¹¤ë¡£
+if($_GET['admin'] == 'on') {
+	$where = "delete = 0";
+} else {
+	$where = "delete = 0 AND status = 1";
+}
+
+if($_POST['mode'] != "") {
+	$tmp_id = $_POST['product_id'];
+} else {
+	$tmp_id = $_GET['product_id'];
+}
+
+// ÃÍ¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
+if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {
+	sfDispSiteError(PRODUCT_NOT_FOUND);
+}
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	//¤ªµ¤¤ËÆþ¤ê¥Ü¥¿¥óÉ½¼¨
+	$objPage->tpl_login = true;
+	
+	$table = "dtb_customer_reading";
+	$where = "customer_id = ? ";
+	$arrval[] = $objCustomer->getValue('customer_id');
+	//¸ÜµÒ¤Î±ÜÍ÷¾¦ÉÊ¿ô
+	$rpcnt = $objQuery->count($table, $where, $arrval);
+
+	//±ÜÍ÷¿ô¤¬ÀßÄê¿ô°Ê²¼
+	if ($rpcnt < CUSTOMER_READING_MAX){
+		//±ÜÍ÷ÍúÎò¤Ë¿·µ¬ÄÉ²Ã
+		lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+	} else {
+		//±ÜÍ÷ÍúÎò¤ÎÃæ¤Ç°ìÈÖ¸Å¤¤¤â¤Î¤òºï½ü¤·¤Æ¿·µ¬ÄÉ²Ã
+		$where = "customer_id = ? AND update_date = (SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ? ) ";
+		$arrval = array($objCustomer->getValue("customer_id"), $objCustomer->getValue("customer_id"));
+		//ºï½ü
+		$objQuery->delete($table, $where, $arrval);
+		//ÄÉ²Ã
+		lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+	}
+}
+
+
+// µ¬³ÊÁªÂò¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ®
+$objPage = lfMakeSelect($objPage, $tmp_id);
+
+// ¾¦ÉÊID¤òFORMÆâ¤ËÊÝ»ý¤¹¤ë¡£
+$objPage->tpl_product_id = $tmp_id;
+
+switch($_POST['mode']) {
+case 'cart':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError();
+	if(count($objPage->arrErr) == 0) {
+		$objCartSess = new SC_CartSession();
+		$classcategory_id1 = $_POST['classcategory_id1'];
+		$classcategory_id2 = $_POST['classcategory_id2'];
+				
+		// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if(!$objPage->tpl_classcat_find1) {
+			$classcategory_id1 = '0';
+		}
+		
+		// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if(!$objPage->tpl_classcat_find2) {
+			$classcategory_id2 = '0';
+		}
+
+		$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity'));
+		header("Location: /cart/index.php");
+
+		exit;
+	}
+	break;
+		
+default:
+	break;
+}
+
+$objQuery = new SC_Query();
+// DB¤«¤é¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+$arrRet = $objQuery->select("*", "vw_products_allclass_detail", "product_id = ?", array($tmp_id));
+$objPage->arrProduct = $arrRet[0];
+
+// ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ
+if($objPage->arrProduct['sale_unlimited'] == 1 || $objPage->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+  $objPage->tpl_sale_limit = SALE_LIMIT_MAX;
+} else {
+  $objPage->tpl_sale_limit = $objPage->arrProduct['sale_limit'];
+}
+
+// ¥µ¥Ö¥¿¥¤¥È¥ë¤ò¼èÆÀ
+$arrFirstCat = GetFirstCat($arrRet[0]['category_id']);
+$tpl_subtitle = $arrFirstCat['name'];
+$objPage->tpl_subtitle = $tpl_subtitle;
+
+// DB¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setDBFileList($objPage->arrProduct);
+// ¥Õ¥¡¥¤¥ëÉ½¼¨ÍÑÇÛÎó¤òÅÏ¤¹
+$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $objSiteInfo->data;
+// »ÙÊ§ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = lfGetPayment();
+// ÆþÎÏ¾ðÊó¤òÅÏ¤¹
+$objPage->arrForm = $objFormParam->getFormParamList();
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¼èÆÀ
+$objPage->arrReview = lfGetReviewData($tmp_id);
+// ¥¿¥¤¥È¥ë¤Ë¾¦ÉÊÌ¾¤òÆþ¤ì¤ë
+$objPage->tpl_title = "¾¦ÉÊ¾ÜºÙ ". $objPage->arrProduct["name"];
+//¥ª¥¹¥¹¥á¾¦ÉÊ¾ðÊóÉ½¼¨
+$objPage->arrRecommend = lfPreGetRecommendProducts($tmp_id);
+//¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹
+$objPage->arrRelateProducts = lfGetRelateProducts($tmp_id);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("°ìÍ÷-¥á¥¤¥ó²èÁü", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó²èÁü", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó³ÈÂç²èÁü", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö²èÁü$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);	
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
+	}
+	$objUpFile->addFile("¾¦ÉÊÈæ³Ó²èÁü", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false);
+}
+
+/* µ¬³ÊÁªÂò¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */
+function lfMakeSelect($objPage, $product_id) {
+	global $objPage;
+	$classcat_find1 = false;
+	$classcat_find2 = false;
+	// ºß¸Ë¤¢¤ê¤Î¾¦ÉÊ¤ÎÍ­Ìµ
+	$stock_find = false;
+	
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+	$arrProductsClass = lfGetProductsClass($product_id);
+	
+	// µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
+	// µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];
+	
+	// ¤¹¤Ù¤Æ¤ÎÁÈ¤ß¹ç¤ï¤»¿ô	
+	$count = count($arrProductsClass);
+	
+	$classcat_id1 = "";
+	
+	$arrSele = array();
+	$arrList = array();
+	
+	$list_id = 0;
+	$arrList[0] = "\tlist0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";
+	$arrVal[0] = "\tval0 = new Array(''";
+	
+	for ($i = 0; $i < $count; $i++) {
+		// ºß¸Ë¤Î¥Á¥§¥Ã¥¯
+		if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
+			continue;
+		}
+		
+		$stock_find = true;
+		
+		// µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
+			$arrList[$list_id].=");\n";
+			$arrVal[$list_id].=");\n";
+			$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
+			$arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
+			$list_id++;
+		}
+		
+		// µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ
+		if($arrList[$list_id] == "") {
+			$arrList[$list_id] = "\tlist".$list_id." = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '".$arrClassCatName[$classcat_id2]."'";
+		} else {
+			$arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ
+		if($arrVal[$list_id] == "") {
+			$arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'";
+		} else {
+			$arrVal[$list_id].= ", '".$classcat_id2."'";
+		}
+	}	
+	
+	$arrList[$list_id].=");\n";
+	$arrVal[$list_id].=");\n";
+		
+	// µ¬³Ê1
+	$objPage->arrClassCat1 = $arrSele;
+	
+	$lists = "\tlists = new Array(";
+	$no = 0;
+	
+	foreach($arrList as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$lists.= ",list".$no;
+		} else {
+			$lists.= "list".$no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.=$lists.");\n";
+	
+	$vals = "\tvals = new Array(";
+	$no = 0;
+	
+	foreach($arrVal as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$vals.= ",val".$no;
+		} else {
+			$vals.= "val".$no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.=$vals.");\n";
+	
+	// ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID
+	$objPage->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . $_POST['classcategory_id2'] . "');";
+
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id1'] != '0') {
+		$classcat_find1 = true;
+	}
+	
+	// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id2'] != '0') {
+		$classcat_find2 = true;
+	}
+		
+	$objPage->tpl_classcat_find1 = $classcat_find1;
+	$objPage->tpl_classcat_find2 = $classcat_find2;
+	$objPage->tpl_stock_find = $stock_find;
+		
+	return $objPage;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+
+	$objFormParam->addParam("µ¬³Ê1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("µ¬³Ê2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸Ä¿ô", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+/* ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ */
+function lfGetProductsClass($product_id) {
+	$arrRet = array();
+	if(sfIsInt($product_id)) {
+		// ¾¦ÉÊµ¬³Ê¼èÆÀ
+		$objQuery = new SC_Query();
+		$col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
+		$table = "vw_product_class";
+		$where = "product_id = ?";
+		$objQuery->setorder("rank1 DESC, rank2 DESC");
+		$arrRet = $objQuery->select($col, $table, $where, array($product_id));
+	}
+	return $arrRet;
+}
+
+/* ÅÐÏ¿ºÑ¤ß¥ª¥¹¥¹¥á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */
+function lfPreGetRecommendProducts($product_id) {
+	$objQuery = new SC_Query();
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
+	$max = count($arrRet);
+	$no = 0;
+	for($i = 0; $i < $max; $i++) {
+		$where = "delete = 0 AND product_id = ? AND status = 1";
+		$arrProductInfo = $objQuery->select("main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate", "vw_products_allclass", $where, array($arrRet[$i]['recommend_product_id'])); 
+				
+		if(count($arrProductInfo) > 0) {
+			$arrRecommend[$no] = $arrProductInfo[0];
+			$arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
+			$arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
+			$no++;
+		}	
+	}
+	return $arrRecommend;
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	global $objPage;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+		
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	if ($objPage->tpl_classcat_find1) {
+		$objErr->doFunc(array("µ¬³Ê1", "classcategory_id1"), array("EXIST_CHECK"));
+	}
+	if ($objPage->tpl_classcat_find2) {
+		$objErr->doFunc(array("µ¬³Ê2", "classcategory_id2"), array("EXIST_CHECK"));
+	}
+			
+	return $objErr->arrErr;
+}
+
+//±ÜÍ÷ÍúÎò¿·µ¬ÅÐÏ¿
+function lfRegistReadingData($tmp_id, $customer_id){
+	$objQuery = new SC_Query;
+	$sqlval['customer_id'] = $customer_id;
+	$sqlval['reading_product_id'] = $tmp_id;
+	$sqlval['create_date'] = 'NOW()';
+	$objQuery->insert("dtb_customer_reading", $sqlval);
+}
+
+//¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹
+function lfGetRelateProducts($tmp_id) {
+	$objQuery = new SC_Query;
+	//¼«Æ°Ãê½Ð
+	$objQuery->setorder("random()");
+	//É½¼¨·ï¿ô¤ÎÀ©¸Â
+	$objQuery->setlimit(RELATED_PRODUCTS_MAX);
+	//¸¡º÷¾ò·ï
+	$col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate";
+	$from = "vw_products_allclass AS V ";
+	$where = "delete = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
+	$arrval[] = $tmp_id;
+	//·ë²Ì¤Î¼èÆÀ
+	$arrProducts = $objQuery->select($col, $from, $where, $arrval);
+	
+	return $arrProducts;
+}
+
+//¾¦ÉÊ¤´¤È¤Î¥ì¥Ó¥å¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë
+function lfGetReviewData($id) {
+	$objQuery = new SC_Query;
+	//¾¦ÉÊ¤´¤È¤Î¥ì¥Ó¥å¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	$col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment";
+	$from = "dtb_review";
+	$where = "delete = 0 AND status = 1 AND product_id = ? ";
+	$arrval[] = $id;
+	$arrReview = $objQuery->select($col, $from, $where, $arrval);
+	return $arrReview; 
+}
+
+//»ÙÊ§ÊýË¡¤Î¼èÆÀ
+//payment_id	1:¥¯¥ì¥¸¥Ã¥È¡¡2:¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó	
+function lfGetPayment() {
+	$objQuery = new SC_Query;
+	$col = "payment_id, rule, payment_method";
+	$from = "dtb_payment";
+	$where = "delete = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /temp/trunk/html/products/top.php
===================================================================
--- /temp/trunk/html/products/top.php	(revision 1328)
+++ /temp/trunk/html/products/top.php	(revision 1328)
@@ -0,0 +1,20 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/product/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/top.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/faq/index.php
===================================================================
--- /temp/trunk/html/faq/index.php	(revision 1328)
+++ /temp/trunk/html/faq/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/faq/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'faq/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'faq';				
+		$this->tpl_title = '¤è¤¯¤¢¤ë¼ÁÌä';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/user_data/__default.php
===================================================================
--- /temp/trunk/html/user_data/__default.php	(revision 1328)
+++ /temp/trunk/html/user_data/__default.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'] . "require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage);
+
+// ²èÌÌ¤ÎÉ½¼¨
+ $objView->assignobj($objPage);
+ $objView->display(SITE_FRAME);
+ 
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/trunk/html/drecomcms/common.js
===================================================================
--- /temp/trunk/html/drecomcms/common.js	(revision 1328)
+++ /temp/trunk/html/drecomcms/common.js	(revision 1328)
@@ -0,0 +1,467 @@
+/*
+ * ¤Ê JavaScript
+ *
+ *
+ * Copyright (c) 2003 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * uEUæÊÌæÌðæ¾
+ */
+function getWidth(win)
+{
+	var tmp_width;
+    
+	if (win.document.documentElement) { 
+		tmp_width = win.document.documentElement.clientWidth;
+		if (tmp_width > 0) {
+			return tmp_width;
+		}
+	}
+    if (win.document.all) {
+    	tmp_width = win.document.body.clientWidth;
+		return tmp_width;
+	}
+	return win.innerWidth;
+}
+       
+/**
+ * uEUæÊÌæÌ³ðæ¾
+ */
+function getHeight(win)
+{
+	var tmp_height;
+    
+	if (win.document.documentElement) {
+		tmp_height = win.document.documentElement.clientHeight;
+		if (tmp_height > 0) {
+			return(tmp_height);
+		}
+	}
+    if (win.document.all) {
+		return(win.document.body.clientHeight);
+	}
+	return(win.innerHeight);
+}
+
+/**
+ * WindowðSÉÚ®
+ */
+function moveWindowToCenter(win) {
+	x = (screen.width  - getWidth(win)) / 2;
+	y = (screen.height - getHeight(win)) / 2;
+	win.moveTo(x,y);
+}
+
+/**
+ * íÉèOÉ\¦·éEBhEðJ­
+ */
+function openModalWindow(url, name, height, width, scrollbars, resizable, status)
+{
+	ModalWindow = openWindow(url, name, height, width, scrollbars, resizable, status);
+	onfocus = function onFocus(){
+		if (null !=ModalWindow && !ModalWindow.closed) {
+			try {
+				ModalWindow.focus();
+			} catch(e) {
+				document.onmousemove = null;
+			}
+		} else {
+			document.onmousemove = null;
+		}
+	}
+	
+	document.onmousemove = onfocus;
+	
+	return ModalWindow;
+}
+
+/**
+ * EBhEðJ­
+ */
+function openWindow(url, name, height, width, scrollbars, resizable, status, left, top)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					((left) ? ",left=" + left : "") + ((top) ? ",top=" + top : "") +
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status;
+
+	subWindow = window.open(url, name, window_condition);
+	// |bvAbvubJ[ÈÇÅubN³ê½êÉJavaScriptG[ÉÈçÈ¢æ¤É
+	if (subWindow) {
+		subWindow.focus();
+	}
+
+	return subWindow;
+}
+
+/**
+ * EBhEðãëÉJ­
+ */
+function openWindowBack(url, name, height, width, scrollbars, resizable, status)
+{
+	var window_condition = "height=" + height + ",width=" + width + 
+					",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=no,status=" + status +
+					",left=" + window.screen.width;
+	subWindow = window.open(url, name, window_condition);
+	subWindow.blur();
+	window.focus();
+	subWindow.moveTo(0,0);
+	return subWindow;
+}
+
+/**
+ * EscL[ÅEBhEðÂ¶éCxg
+ * 
+ * ¦TuEBhEÌonloadÅ
+ *   document.body.onkeypress = subwinCloseOnEsc;
+ * Ìæ¤ÉgÁÄ­¾³¢B
+ */
+function subwinCloseOnEsc(ev)
+{
+	ev || (ev = window.event);
+	if (ev.keyCode == 27) {
+		window.close();
+		return false;
+	}
+	return true;
+}
+
+
+
+// 2004-06-09 Takanori Ishikawa 
+// -----------------------------------------------------------
+// htmlAlert(), htmlConfirm() Í html ð»ÌÜÜ
+// oÍ¹¸ATj^CY·éæ¤Éµ½B
+
+// sanitize html message
+function sanitize_msg(msg)
+{
+	msg = msg.replace(/</g, '&lt;');
+	msg = msg.replace(/>/g, '&gt;');
+	msg = msg.replace(/&lt;br\s*&gt;/g, '<br>');
+
+	return msg;
+}
+// alert
+function htmlAlert(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	msg = sanitize_msg(msg);
+	
+	if (defined(window.showModalDialog)) {
+		showModalDialog("/drecomcms/html/message_box.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+  	} else {
+		dialogArguments = msg;
+		ModalWindow = open("/drecomcms/html/message_box.html", "sub_alert","height=" + height + ",width=" + width + 
+					",scrollbars=no,resizable=no,toolbar=no,status=no,alwaysRaised=yes");
+		onfocus = function onFocus(){
+			if (null !=ModalWindow && !ModalWindow.closed) {
+				ModalWindow.focus();
+			}
+		}
+		document.onmousemove = onfocus;
+		return ModalWindow;
+	}
+}
+// confirm
+function htmlConfirm(msg, height, width)
+{
+	height = (null == height) ? 150: height;
+	width  = (null == width) ? 300: width;
+	if (defined(window.showModalDialog)) {
+		var value = showModalDialog("/drecomcms/html/confirm.html", sanitize_msg(msg), "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
+		if (typeof value == "undefined") {
+			value = false;
+		} 
+		return value;
+	} else {
+		return window.confirm(msg.replace(/<br[^>]*\/?>/, '\n'));
+	}
+}
+
+/**
+  * júðæ¾·éÖ
+  * year:  N
+  * month: 
+  * day:   ú
+  */
+function getDayOfWeek(year, month, day) {
+
+	DateOfWeek	= new Date();
+	DateOfWeek.setYear(year);
+	DateOfWeek.setMonth(month - 1);
+	DateOfWeek.setDate(day);
+	day_of_week_number	= DateOfWeek.getDay();
+
+	days = new Array('ú','','Î','
+','Ø','à','y');
+	return days[day_of_week_number];
+}
+
+
+// -----------------------------------------------------------
+// |[^Awb_
+// -----------------------------------------------------------
+/**
+ * INPUT FORM ÌwiFÏX
+ */
+function focusForm(obj,flag){
+	if (obj == null || obj.style == null) {
+		return;	
+	}
+	obj.style.backgroundColor = flag ? '#FFFFCC' : '#FFFFFF' 
+}
+function Skinup(fnr){
+	win = window.open('/contents/skinpop_'+fnr,'skin','width=455,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
+	win.focus();
+}
+function imgSwap(name,gifPath) {
+	document.images[name].src = gifPath ;
+}
+
+
+// -----------------------------------------------------------
+// æ
+// -----------------------------------------------------------
+/**
+ * æÌ\¦TCY²®
+ */
+function adjustImageSize(imgElementName, widthMax, heightMax) {
+	var imgs = document.getElementsByName(imgElementName);
+	if (imgs) {
+		if (!imgs.length) {
+			if (widthMax && imgs.width > widthMax) {
+				imgs.height = imgs.height * widthMax / imgs.width;
+				imgs.width = widthMax;
+			}
+			if (heightMax && imgs.height > heightMax) {
+				imgs.width = imgs.width * heightMax / imgs.height;
+				imgs.height = heightMax;
+			}
+		} else {
+			for (i=0; i<imgs.length; i++) {
+				if (widthMax && imgs[i].width > widthMax) {
+					imgs[i].height = imgs[i].height * widthMax / imgs[i].width;
+					imgs[i].width = widthMax;
+				}
+				if (heightMax && imgs[i].height > heightMax) {
+					imgs[i].width = imgs[i].width * heightMax / imgs[i].height;
+					imgs[i].height = heightMax;
+				}
+			}
+		}
+	}
+}
+
+/**
+ * {¶ÌHTML\[XæèOæURL("http://`")ðPickUp
+ */
+function getExternalImageList(orgHtml) {
+
+	var extImageList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+	
+	exp = new RegExp("<img [^>]*src=[\"']?http://[^\"']*[\"']?[^>]*>", 'ig');
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("src=[\"']?");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp("[\"'\\s>]|/>");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+				
+				var isExist = false;
+				for (var j = 0; j < extImageList.length; j++) {
+					if (extImageList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extImageList[n++] = str; }
+			}
+		}
+	}
+	return extImageList;
+}
+
+/**
+ * {¶ÌHTML\[XæèOFlashURL("http://`")ðPickUp
+ */
+function getExternalFlashList(orgHtml) {
+
+	var extFlashList = new Array();
+	var list = new Array();
+	var n = 0;	
+	var exp;
+
+	var flashTag = "\\{\\\$CMSInclude [^\\\$\\}]*name=\"flash\"\\s*param=\"[^\"]*Movie=http://[^\"]*\"\\s*\\\$\\}";	
+	exp = new RegExp(flashTag, 'ig');	
+	list = orgHtml.match(exp);
+	if (list) {
+		for (var i = 0; i < list.length; i++) {
+			var str = "";
+			exp = new RegExp("Movie=");
+			list[i].match(exp);
+			str = RegExp.rightContext;
+			exp = new RegExp(";");
+			if (str) {
+				str.match(exp);
+				str = RegExp.leftContext;
+
+				var isExist = false;				
+				for (var j = 0; j < extFlashList.length; j++) {
+					if (extFlashList[j] == str) { isExist = true; break; }
+				}
+				if (!isExist) { extFlashList[n++] = str; }
+			}
+		}
+	}
+	return extFlashList;
+}
+ 
+/**
+ * NÌJÚæð³øÉ·éB
+ * i<a>^OÌhref®«ð"javascript:void(0)"Éu·j
+ */
+function replaceLinkInvalid(html) {
+	html = html.replace(/<a [^>]*>/ig, '<a href="javascript:void(0);">');
+	html = html.replace(/openPermLink\([^)]*\)/ig, 'void(0)');
+	return html;
+}
+
+/**
+ * URLpÌGXP[vðs¢Ü·B
+ * '&' -> '&amp;'
+ * '>' -> '&gt;'
+ * '<' -> '&lt;'
+ * '"' -> '&quot;'
+ * ¼[ÌóÍ Trim
+ * ' ' -> '%20'
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ escapeUrl(/*: String :*/ src) {
+	var s = replaceAll(src, '&', '&amp;');
+	s = replaceAll(s, '>', '&gt;');
+	s = replaceAll(s, '<', '&lt;');
+	s = replaceAll(s, '"', '&quot;');
+	s = trim(s);
+	s = replaceAll(s, ' ', '%20');
+	return s;
+}
+function /*: String :*/ escapeScript(/*: String :*/ src) {
+	var s = replaceAll(src, "\\", "\\\\");
+	s = replaceAll(s, "'", "\\'");
+	s = replaceAll(s, "\"", "\\\"");
+	return s;
+}
+/**
+ * ¶ñÌSu·ðs¢Ü·B
+ * @param src ÎÛ¶ñ
+ * @param oldc ¶ñ
+ * @param newc V¶ñ
+ */
+function /*: String :*/ replaceAll(/*: String :*/src, /*: String :*/oldc, /*: String :*/newc) {
+ var h = "";
+ var b = src;
+ var index = 0;
+ while (true) {
+  index = b.indexOf(oldc, 0);
+  if (index == -1) {
+   break;
+  }
+  src = b.replace(oldc, newc);
+  h += src.substring(0, index + newc.length);
+  b = src.substring(index + newc.length, src.length);
+ }
+ return h + b;
+}
+/**
+ * ¼[Ì¼p/SpXy[Xðæè«Ü·B
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ trim(/*: String :*/src ) {
+	var s = trimR(src);
+	return trimL(s);
+}
+/**
+ * E[Ì¼p/SpXy[Xðæè«Ü·B
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ trimR(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(strFinal.length - 1, strFinal.length) == " ") || (strFinal.substring(strFinal.length - 1, strFinal.length) == "@")) {
+			strFinal = strTemp.substring(0, strTemp.length - (nLoop + 1));
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+/**
+ * ¶[Ì¼p/SpXy[Xðæè«Ü·B
+ * @param src ÎÛ¶ñ
+ */
+function /*: String :*/ trimL(/*: String :*/src) {
+	var nLoop = 0;
+	var strFinal = src;
+	var strTemp = src;
+	while (nLoop < strTemp.length) {
+		if ((strFinal.substring(0, 1) == " ") || (strFinal.substring(0, 1) == "@")) {
+			strFinal = strTemp.substring(nLoop + 1, strTemp.length );
+		}
+		else {
+			break;
+		}
+		nLoop++;
+	}
+	return strFinal;
+}
+
+/**
+ * p³
+ */
+function extend(subClass, superClass) {
+    for (var prop in superClass.prototype) {
+        subClass.prototype[prop] = superClass.prototype[prop];
+    }
+}
+
+
+/**
+ * |bvAbvubJ[Îô
+ * window.onPopupBlocked,window.onPopupNonBlockedðI[o[ChµÄ­¾³¢B
+ */
+window.onPopupBlocked = function(){
+	alert('EBhEðJ¯Ü¹ñÅµ½B|bvAbvubJ[ðLøÉµÄ¢éêÍA³øÉµÄ­¾³¢B');
+};
+
+window.onPopupNonBlocked = function(){}
+
+if (typeof window.org_open == 'undefined'){
+	window.org_open = window.open;
+	window.open = function() {
+		var win = (2 == window.open.arguments.length)
+					? window.org_open(window.open.arguments[0], window.open.arguments[1])
+					: window.org_open(window.open.arguments[0], window.open.arguments[1], window.open.arguments[2]);
+		if (null == win) {
+			window.onPopupBlocked(window.open.arguments);
+		} else {
+			window.onPopupNonBlocked(window.open.arguments);
+		}
+		return win;
+	}
+}
+
+
Index: /temp/trunk/html/drecomcms/access_key.js
===================================================================
--- /temp/trunk/html/drecomcms/access_key.js	(revision 1328)
+++ /temp/trunk/html/drecomcms/access_key.js	(revision 1328)
@@ -0,0 +1,51 @@
+/*
+ * Access Key Utilities
+ *
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+/**
+ * Û¶V[gJbgðLøÉ·é©Ç¤©B
+ * V[gJbgæèàæÉAuEUÌÛ¶_CAOªoéêÍ³øÉ·éB
+ * 
+ * @return Û¶V[gJbgðLøÉ·é©Ç¤©
+ */
+function shortCutSupported()
+{
+	return (document.all != null && null == XBSUtil.opera);
+}
+
+function access_key_onkeydown_hock(theEvent) 
+{
+	if (false == shortCutSupported()) {
+		return true;
+	}
+
+	if (theEvent == null) {
+		theEvent = window.event;
+	}
+	var willCancel = false;
+	var k = XBSEvent.getKeyCode(theEvent);
+	var m = XBSEvent.getModifierFlags(theEvent);
+	if (m & XBSEvent.CONTROL_KEY_MASK){
+		if (k == 83) {  // 's'
+			execSave != null ? execSave() : void(0);
+			willCancel = true;
+		}
+	} else if (m & XBSEvent.ALT_KEY_MASK){
+		if (k == 80) {  // 'p'
+			execPrint != null ? execPrint() : void(0);
+			willCancel = true;
+		}
+	}
+	if (willCancel) {
+		theEvent.returnValue = false;
+		return false;
+	}
+	
+	return true;
+}
Index: /temp/trunk/html/drecomcms/sidefunc_order.js
===================================================================
--- /temp/trunk/html/drecomcms/sidefunc_order.js	(revision 1328)
+++ /temp/trunk/html/drecomcms/sidefunc_order.js	(revision 1328)
@@ -0,0 +1,1021 @@
+/**
+ * 
+ * TCho[ÒW JavaScript
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+
+//---------------------------------------------------------------------------------
+// Ýè
+//---------------------------------------------------------------------------------
+
+// *** úÝèÏ *** //
+
+var gSidefuncOrderForm = null;
+var SIDEFUNC_ORDER_FORM_NAME = "SidefuncOrderForm";
+
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+//
+// Mac Ì IE5 ÍÀWÖAÌ@\i¾¯¶áÈ¢¯ÇjÌ½­ª¶ÁÄ¢é
+// ÌÅKÉÎ
+//
+// QlF
+// Mac ÌH¦È¢ìYÇà
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+var MAC_IE5_PITCH_X;
+var MAC_IE5_PITCH_Y;
+
+MAC_IE5_PITCH_X = MAC_IE5_PITCH_Y = 0;	/* BITCH */
+if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+	MAC_IE5_PITCH_X = -10;
+	MAC_IE5_PITCH_Y = 0;
+}
+
+
+// *** CheckLine *** //
+var CHECKLINE_ID = 'checkline';
+
+
+// --- Panel ---
+// ¯Êq
+var PANEL_NAME_DISABLE	= 'DISABLE';	// O@\BOXÌID
+var PANEL_NAME_LEFT		= 'LEFT';		// àE¶@\BOXÌID
+var PANEL_NAME_RIGHT	= 'RIGHT';		// àEE@\BOXÌID
+
+//·×ÄÌ Panel ðvpeBÉàÂIuWFNg
+// key Í name
+var gAllPanels         = new Object();
+
+// ¶©çÌÔ
+var gPanelNames         = [PANEL_NAME_DISABLE, PANEL_NAME_LEFT, PANEL_NAME_RIGHT];
+
+
+// --- Box ---
+var BOX_ID_PREFIX 		= 'f';			// Box Ì ID vtBbNX
+var BoxConfig = {
+	width: 		120,	// Box 
+	height: 	20,		// Box ³
+	padding: 	10,		// Box ÔÌXy[X
+	marginTop: 	5,		// êÔãÌBoxÆeplÆÌXy[X
+	marginLeft: 5		// Box ÆeplÌ¶¤ÌXy[X
+};
+
+// Box zuÌæÌÅ¬³
+var MIN_BOXIES_HEIGHT	= 200;
+
+// ·×ÄÌ Box ðvpeBÉàÂIuWFNg
+var gAllBoxes           = new Object();
+
+/**
+ * plÉi[Å«éÅå Box ðL^µ½IuWFNg
+ * 
+ * key: pl¼ value: plÉi[Å«éÅå Box 
+ * 
+ */
+
+BoxConfig.maxNBoxes = new Object();
+BoxConfig.maxNBoxes[PANEL_NAME_DISABLE]	= OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES;	// ugpµÈ¢@\v
+BoxConfig.maxNBoxes[PANEL_NAME_LEFT]	= OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES;		// ugp·é@\v¶
+BoxConfig.maxNBoxes[PANEL_NAME_RIGHT]	= OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES;		// ugp·é@\vE
+
+/**
+ * y[WÇÝÝÌzuf[^
+ */
+gInitialBoxPositionsData = null;
+
+//---------------------------------------------------------
+// zuÈÇ
+//---------------------------------------------------------
+/**
+ * HTML Ì hidden input vf©çÚÌzuÈÇÌîñðÇÝæéIuWFNg
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+SFSettings = new Object();
+
+/**
+ * HTML Ì hidden input vf©çÝèlðÇÝæé
+ */
+SFSettings.loadBoxPositions = function()
+{
+	var positions = new Object();
+	var orders       = new Array();
+	var panelNames   = new Array();	
+	
+	// hidden©çbox_positionðæ¾
+	positions[PANEL_NAME_DISABLE]	= new Array();
+	positions[PANEL_NAME_LEFT]		= new Array();
+	positions[PANEL_NAME_RIGHT]		= new Array();
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			var idx = XBSUtil.parseIntNoError(elem.value);
+			panelNames[panelNames.length] = gPanelNames[idx];
+		} else if (Box.ID_PROPERTY_NAME == elem.name) {
+			;
+		}
+	}
+	for (var i = 0; i < orders.length; i++) {
+		var pnm = panelNames[i];
+		var bid = i;
+		var ord = orders[i];
+		
+		positions[pnm][bid] = ord;
+	}
+	
+	orders     = null;
+	panelNames = null;
+	return positions;
+}
+
+/**
+ * »ÝÌóÔðPêÌIuWFNgÉGR[hµÄÔ·B
+ */
+SFSettings.getObjectForPersistent = function()
+{
+	var orders = new Array();
+	var pidxes = new Array();
+	var result = '';
+	
+	if (gSidefuncOrderForm == null) {
+		return result;
+	}
+	for (var i = 0; i < gSidefuncOrderForm.elements.length; ++i) {
+		var elem = gSidefuncOrderForm.elements[i];
+		
+		if(Box.ORDER_PROPERTY_NAME == elem.name) {
+			orders[orders.length] = elem.value;
+		} else if(Box.POSITION_PROPERTY_NAME == elem.name) {
+			pidxes[pidxes.length] = XBSUtil.parseIntNoError(elem.value);
+		}
+	}
+	result += pidxes.join('');
+	result += orders.join('');
+	pidxes = null;
+	orders = null;
+	
+	return result;
+}
+
+//---------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------
+/**
+ * TCho[ÌÏXðÄ·éIuWFNg
+ * ContentsChangedListener ÌTuNX
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/23
+ */
+function SFChangedListener(/* Optional */ aName) /* extends ContentsChangedListener */
+{
+}
+SFChangedListener.prototype = new ContentsChangedListener();
+SFChangedListener.prototype.setChanged = function(b) 
+{
+	var persistent = SFSettings.getObjectForPersistent();
+	
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// ±±Å prototype Ì\bhðÄÑoµÄà¤Ü­¢©È¢B
+
+	this.changed = (gInitialBoxPositionsData != persistent);
+}
+
+//---------------------------------------------------------
+// Drag & Drop: SFDragManager (Sidebar Function DragManager)
+//---------------------------------------------------------
+/**
+ * hbOÌLø»ArÌóÔðÛ·é½ßÌIuWFNg
+ * hbOÍêxÉÐÆÂµ©N±çÈ¢ÌÅA¢ÜÌÆ±ë
+ * Singleton ÆµÄÀ
+ * 
+ * For example:
+ * <pre>
+ * // prepare for dragging, enable event handler.
+ * SFDragManager.enableEventHandler();
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+SFDragManager = new Object();
+
+// *** Event Handler *** //
+SFDragManager.ondrop = null;  // zuªÏX³ê½
+
+
+// hbOÉp·é document ÌCxgnhðÝè
+SFDragManager.enableEventHandler = function ()
+{
+	document.onmousemove = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.moveBox(e);
+	};
+	
+	document.onmouseup = function(e) {
+		if (SFDragManager.box != null)
+			SFDragManager.downBox(e);
+	};
+	
+	for (var key in gAllBoxes) {
+		var box = gAllBoxes[key];
+		var src = box ? box.getHTMLElement() : null;
+		
+		if (src != null) {
+			src.onmousedown = SFDragManager.pickUpBox;
+		}
+	}
+}
+
+// hbOÉp·é document ÌCxgnhðð
+SFDragManager.disbleEventHandler= function()
+{
+	document.onmousemove	= '';
+	document.onmouseup		= '';
+}
+
+
+//hbOÌIuWFNg
+
+SFDragManager.destination = null;	/* Ú®æ Panel */
+SFDragManager.source      = null;	/* Ú®³ Panel */
+SFDragManager.box         = null;	/* hbOÌ Panel */
+
+/**
+ * TCho[ÚÌÏXðÄ·éIuWFNgðÔ·B
+ */
+SFDragManager.getChangedListener = function()
+{
+	if (SFDragManager.getChangedListener.$instance == null) {
+		
+		SFDragManager.getChangedListener.$instance = 
+			new SFChangedListener("[Sidebar Function Order]");
+	}
+	return SFDragManager.getChangedListener.$instance;
+}
+SFDragManager.setUpContentsChangedListener = function()
+{
+	// 2004-04-23  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// TCho[ÌzuªÏX³ê½©Ç¤©ðL^
+	
+	var listener = SFDragManager.getChangedListener();
+	
+	listener.listenEvent(SFDragManager, 'ondrop');
+	OEMBlogGlobal.watchOtherLinks(document, listener);
+}
+
+/**
+  * setOnLoad()
+  *
+  * y[WÇÝÝÌú
+  */
+SFDragManager.loaded = false;
+SFDragManager.onload = function() 
+{
+	// tH[ú»
+	gSidefuncOrderForm = UtilKit.getPropertyNotNull(document, SIDEFUNC_ORDER_FORM_NAME);
+	
+	// e Panel, Box IuWFNg¶¬
+	var boxPositions = SFSettings.loadBoxPositions();
+	gInitialBoxPositionsData = SFSettings.getObjectForPersistent();
+	for (var i = 0; i < gPanelNames.length; i++) {
+		var nm = gPanelNames[i];
+		var panel;
+		
+		panel = new Panel(nm, boxPositions[nm]);
+		
+		for(var key in panel.box_position) {
+			gAllBoxes[key] = new Box(key);
+		}
+		
+		// Box Ìúzu
+		panel.setBoxPosition();
+		Panel[nm] = panel;
+		
+		gAllPanels[nm] = panel;
+	}
+	
+	
+	// hbOÌõ
+	SFDragManager.setUpContentsChangedListener();
+	SFDragManager.enableEventHandler();
+	
+	// onload àCxg
+	resetPositionsInEventHandler();
+	window.onresize = resetPositionsInEventHandler;
+	
+	SFDragManager.loaded = true;
+	// 2004-04-20  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// Opera ÅÍ onload _ÅC[ÌÄ`æªÔÉíÈ¢B
+	// ±ÌÖðgÁÄA³âèÄ`æ·éB
+	if (window.opera) {
+		SFDragManager.loaded = false;
+		setTimeout("refreshDisplay()", 0.8*1000);
+	}
+	
+}
+
+
+//---------------------------------------------------------
+// Cxg
+//---------------------------------------------------------
+// CheckLine
+/**
+ *  hbOÌ Box ª}ü³êéÓðwµ¦·½ßÌC 
+ *
+ * @return XBSLayer
+ * @see xbs.js 
+ */
+function getCheckLineLayer()
+{
+	if (null == getCheckLineLayer.layer) {
+		getCheckLineLayer.layer = XBSLayer.makeLayer(CHECKLINE_ID);
+	}
+	return getCheckLineLayer.layer;
+}
+function getPanelAtPosition(x, y)
+{
+	var panel = null;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+			
+		if (x > panel.panel_section['left']  &&
+			x < panel.panel_section['right'] &&
+			y > panel.panel_section['top']   &&
+			y < panel.panel_section['under']) 
+		{ break; }
+	}
+	return panel;
+}
+
+// 2004-04-13  Takanori Ishikawa  
+// ------------------------------------------------------------------------
+// Mac IE ÅÍCxgnhÌÅÀWÖWÌìðs¤Æ¤Ü­¢©È¢ÌÅ
+// ·±µxç¹ÄÀs
+function resetPositionsInEventHandler()
+{
+	if (XBSUtil.macIE && XBSUtil.macIE.major >= 5) {
+		setTimeout("resetPositions()", 1*1000);	
+	} else {
+		resetPositions();
+	}
+}
+
+// *** Reset *** //
+/**
+  * ·×ÄÌ Box ðÄzu
+  */
+function resetPositions() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setSections(); 
+			panel.setBoxPosition(); 
+		}
+	}
+}
+
+/**
+ * ·×ÄÌ Box ðêxÁµA·®É·×Ä\¦
+ */
+function refreshDisplay() 
+{
+	var panel;
+	
+	for (var key in gAllPanels) {
+		panel = gAllPanels[key];
+		if (panel != null) {
+			panel.setBoxVisible(false);
+			panel.setBoxVisible(true);		
+		}
+	}
+	SFDragManager.loaded = true;
+}
+
+// -----------------------------------------------------------------
+// {bNXÌhbOhbv
+// -----------------------------------------------------------------
+
+/**
+  * pickUpBox()
+  * theEvent: Cxg
+  *
+  * Boxð¿ã°½(NbN³ê½)Ìð·éÖ
+  */
+SFDragManager.pickUpBox = function(theEvent) {
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	if (SFDragManager.box != null || SFDragManager.loaded == false)
+		return;
+	
+	// }EXÊuæ¾
+	var mouse_x	    = XBSEvent.getMouseX(theEvent);
+	var mouse_y	    = XBSEvent.getMouseY(theEvent);
+	var pickedPanel = getPanelAtPosition(mouse_x, mouse_y);
+
+	if (null == pickedPanel) 
+		return;
+
+	// Ið³ê½BoxÌÀÑÔÆ id ðæ¾
+	var beforeId = pickedPanel.orderIndexOfBoxAt(mouse_x, mouse_y);
+	var funcId	= UtilKit.getKeyForValue(pickedPanel.box_position, beforeId);
+	
+	if (null == funcId)
+		return;
+	
+	//BoxGgæ¾E
+	var selected = new XBSLayer(BOX_ID_PREFIX + funcId);
+	if (null == selected) 
+		return;
+
+	selected.setZIndex(selected.getZIndex() +1);
+
+	//Ið³ê½BoxÌX,YÀWðÛ¶
+	before_box_x	= selected.getX() + MAC_IE5_PITCH_X;
+	before_box_y	= selected.getY() + MAC_IE5_PITCH_Y;
+
+	//}EXÆBox´_Ì·
+	box_to_mouse_x	= mouse_x - before_box_x;
+	box_to_mouse_y	= mouse_y - before_box_y;
+	
+	// hbOJn
+	SFDragManager.box = selected;
+	SFDragManager.source = pickedPanel;
+	before_order_id = beforeId;
+	function_id = funcId;
+}
+
+
+/**
+ * 
+ * BoxðÚ®·éÖ
+ * 
+ * @param theEvent mousemove Cxg
+ */
+SFDragManager.moveBox = function(theEvent) {
+	var selected = SFDragManager.box;
+	
+	if (null == selected || SFDragManager.loaded == false)
+		return;
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	//
+	// hbOAEBhE©çoéZbgµÄIíé
+	//
+	if (false == Box.canMoveWithEvent(theEvent)) {
+		gAllBoxes[function_id].setPosition(before_box_x, before_box_y);
+		clearMove();
+		
+		return;
+	}
+
+	var mouse_x  = XBSEvent.getMouseX(theEvent);
+	var mouse_y  = XBSEvent.getMouseY(theEvent);
+	var curPanel = getPanelAtPosition(mouse_x, mouse_y);
+	if (null == curPanel) 
+		return;
+	
+	if (curPanel.canDropAtPosition(SFDragManager.source, selected, mouse_x, mouse_y)) {
+		// `FbNC\¦
+		curPanel.showCheckLineAtPosition(mouse_x, mouse_y);
+	}
+
+	//BoxÚ®
+	move_to_x = mouse_x - box_to_mouse_x;
+	move_to_y = mouse_y - box_to_mouse_y;
+	
+	selected.setLeftTopPosition(move_to_x, move_to_y);
+}
+
+
+
+/**
+ * Box ðºëµ½Ì
+ * 
+ * @param theEvent Cxg
+ */
+SFDragManager.downBox = function(theEvent)
+{
+	if (SFDragManager.loaded == false) {
+		return;
+	}
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// `FbNCðÁ·
+	getCheckLineLayer().setVisible(false);
+
+	// }EXÊuæ¾
+	var mouse_x = XBSEvent.getMouseX(theEvent);
+	var mouse_y = XBSEvent.getMouseY(theEvent);
+	
+	// -------------------------------------
+	// Ú®Ìæà©O©`FbN
+	// -------------------------------------
+	// Ú®æÌplðæ¾µAhbOîñðXV
+	// hbOOãÌpl
+	var beforePanel = SFDragManager.source;
+	var afterPanel  = getPanelAtPosition(mouse_x, mouse_y);
+	
+	SFDragManager.destination = afterPanel;
+	if (null == beforePanel) {
+		throw ASSERT_EXCEPTION + 'SFDragManager.source must be not null';
+	}
+	
+	var droppedBox = gAllBoxes[function_id];
+	var after_order_id = afterPanel.orderIndexOfMovingAt(mouse_x, mouse_y);
+	
+	// hbvÅ«È¢êABox ðßµÄAhbOðI¹·é
+	if (false == afterPanel.canDropAtPosition(beforePanel, droppedBox, mouse_x, mouse_y)) {
+		droppedBox.setPosition(before_box_x, before_box_y);
+		clearMove();
+		return;
+	}
+
+	// Ú®·éBoxðpl©çíµAÔð®·é
+	delete beforePanel.box_position[function_id];	
+	for (key in beforePanel.box_position) {
+		if (before_order_id < beforePanel.box_position[key]) {
+			--beforePanel.box_position[key];
+		}
+	}
+
+	//after_order_idÌ
+	if (!(beforePanel.equals(afterPanel) && before_order_id <= after_order_id)) {
+		++after_order_id;
+	}
+
+
+	// ÅåÌCfbNXðXV
+	if (after_order_id > afterPanel.getMaxOrderIndex() + 1) {
+		after_order_id = afterPanel.getMaxOrderIndex() + 1;
+	}
+
+	//}ü·éÔðÂ­èA}ü·é
+	for (key in afterPanel.box_position) {
+		if (after_order_id <= afterPanel.box_position[key]) {
+			++afterPanel.box_position[key];
+		}
+	}
+	afterPanel.box_position[function_id] = after_order_id;
+
+	//BoxÄzu
+	if (false == beforePanel.equals(afterPanel)) {
+		beforePanel.setBoxPosition();
+	}
+	afterPanel.setBoxPosition();
+
+	// HTMLÌhiddenlÏX
+	for (var nm in gAllPanels) {
+		var p = gAllPanels[nm];
+
+		for (key in p.box_position) {
+			gSidefuncOrderForm.elements['order'][key].value = p.box_position[key];
+			gSidefuncOrderForm.elements['position'][key].value = p.getPosition();
+		}
+	}
+
+	// Ú®Ìð
+	clearMove();
+	if (SFDragManager.ondrop != null && typeof SFDragManager.ondrop == 'function') {
+		SFDragManager.ondrop();
+	}	
+}
+
+
+/**
+  * clearMove()
+  *
+  * BoxÚ®ðI¹·éÖ
+  */
+function clearMove() {
+	var selected = SFDragManager.box;
+	
+	selected.setZIndex(selected.getZIndex() -1);
+	SFDragManager.box = null;
+}
+
+
+
+
+//---------------------------------------------------------------------------------
+// Panel
+//---------------------------------------------------------------------------------
+/**
+  * ÂXÌhbOÂ\ÈÚðÛ·éÌæ
+  * 
+  * ¢ÜÌÆ±ëA¶©çugpµÈ¢@\vugp·é@\E¶vugp·é@\EEv
+  *
+  * @param aPanelName    plÌ¼O
+  * @param aPositionArray BoxÌzuîñzñ
+  *
+  * @author Yusuke Saito
+  * @version 2003/10/10
+  * 
+  * @author Takanori Ishikawa
+  * @version 2004/04/20
+  */
+function Panel(aPanelName, aPositionArray)
+{
+	this.name			   = aPanelName;						// plÌ¼O(divÌid)
+	this.box_position	   = aPositionArray;					// BoxÌzuîñzñ
+	this.box_limit_number  = BoxConfig.maxNBoxes[aPanelName];	// plàÌÅåBox
+	
+	this.position = -1;
+	for (var i = 0; i < gPanelNames.length; i++) {
+		if (this.name == gPanelNames[i]) {
+			this.position = i;
+			break;
+		}
+	}
+	
+	// plE{bNXEÚ®ÌeÌæðÝè
+	this.setSections();
+}
+
+/**
+ * Box Ì Y offset
+ * 
+ * @param anIndex order index
+ */
+Panel.getBoxSectionOffsetY = function(anIndex)
+{
+	if (Panel.box_section_y == null) {  // Box ÊuÝè
+		var nboxs = BoxConfig.maxNBoxes[PANEL_NAME_DISABLE];
+		Panel.box_section_y = new Array(nboxs);
+		
+		for (var i = 0; i < nboxs; ++i) {
+			Panel.box_section_y[i] = (BoxConfig.height + BoxConfig.padding) * i + BoxConfig.marginTop;
+		}
+	}
+	return Panel.box_section_y[anIndex];
+}
+
+Panel.prototype.getPosition = function() {
+	return this.position;
+}
+
+/**
+ * description
+ */
+Panel.prototype.toString = function()
+{
+	return '[Panel] ' + this.name;
+}
+
+/**
+ * är
+ * 
+ * @param aPanel pl
+ */
+Panel.prototype.equals = function(aPanel)
+{
+	// 2004-04-23  Takanori Ishikawa 
+	// ------------------------------------------------------------------------
+	// instanceof Í IE 6 Åà¢T|[g	
+	if (aPanel == null || /*false == (aPanel instanceof Panel)*/ typeof aPanel.name == 'undefined') {
+		return false;
+	}	
+	return this.name == aPanel.name;
+}
+
+
+/**
+  * setSections()
+  * 
+  * EBhEð´_Æµ½plÌSÓÌX,YÀWðÝè·éÖ
+  * left:¶ÓX right:EÓX top:ãÓY under:ºÓY
+  */
+Panel.prototype.setSections = function() {
+
+	// eC[ÌÊuæ¾
+	this.setUpPanelSections();
+
+	//BoxÌæÌÝè
+	this.setBoxSection();
+
+	//BoxÚ®æÌæÌÝè
+	this.setMoveSection();
+}
+
+
+/**
+  * setUpPanelSections()
+  * 
+  * EBhEð´_Æµ½plÌSÓÌX,YÀWðÝè·éÖ
+  * left:¶ÓX right:EÓX top:ãÓY under:ºÓY
+  */
+Panel.prototype.setUpPanelSections = function() 
+{
+	var psec    = new Object;
+	var lyer = XBSLayer.makeLayer(this.name);
+	
+	psec['left'] = MAC_IE5_PITCH_X; 
+	psec['top']  = MAC_IE5_PITCH_Y;
+	
+	psec['right'] = lyer.getWidth();
+	psec['under'] = lyer.getHeight();
+	while (lyer != null && lyer.isValid() && lyer.hasID()) {
+		
+		psec['left'] += lyer.getX();	
+		psec['top']  += lyer.getY();
+		lyer = lyer.getParent();
+	}
+	psec['right'] += psec['left'];
+	psec['under'] += psec['top'];
+
+	this.panel_section = psec;
+}
+
+/**
+  * setBoxSection()
+  * 
+  * BoxÌûÜéÌæðÝè·éÖ
+  * box_section[ÀÑÔ] => (left => ¶ÓX, right => EÓX, top => ãÓY, under => ºÓY)
+  */
+Panel.prototype.setBoxSection = function() {
+
+	//BoxÌæÌÝè
+	this.box_section_left_x		= this.panel_section['left'] + BoxConfig.marginLeft;
+	this.box_section_right_x	= this.box_section_left_x + BoxConfig.width
+
+	this.box_section			= new Array(this.box_limit_number);
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.box_section[i]				= new Array(4);
+		this.box_section[i]['left']		= this.box_section_left_x;
+		this.box_section[i]['right']	= this.box_section_right_x;
+		this.box_section[i]['top']		= Panel.getBoxSectionOffsetY(i) + this.panel_section['top'];
+		this.box_section[i]['under']	= this.box_section[i]['top'] + BoxConfig.height;
+	}
+}
+
+/**
+ * plÌÅêÔºÌ Box ÌCfbNXðÔ·
+ * 
+ * @return êÔºÌ Box ÌCfbNXB
+ */
+Panel.prototype.getMaxOrderIndex = function()
+{
+	var max = -1;
+	for(key in this.box_position) {
+		max = (max < this.box_position[key]) ? this.box_position[key] : max;
+	}
+	return Number(max);
+}
+
+/**
+ * wè³ê½ÊuÉÅàß¢ABox ð}üÂ\ÈÓÉ`FbNCð\¦·éB
+ * 
+ * @param x x ÀW
+ * @param y y ÀW
+ */
+Panel.prototype.showCheckLineAtPosition = function(x, y)
+{
+	if (typeof x != typeof 0 || typeof y != typeof 0) {
+		throw ASSERT_EXCEPTION + 'x or y arg';
+	}
+	
+	var moveOrderId   = this.orderIndexOfMovingAt(x, y);
+	var maxOrderIndex = this.getMaxOrderIndex();
+	
+	if (null == moveOrderId)
+		return;
+	
+	if (maxOrderIndex < moveOrderId) {
+		moveOrderId = maxOrderIndex;
+	}
+	if (moveOrderId < this.box_limit_number) {
+		// `FbNCÚ®
+		var check_line_left = this.panel_section['left'];
+		var check_line_top = this.move_section[moveOrderId]['top'];
+
+		// êU`FbNCðÁ·
+		getCheckLineLayer().setVisible(false);
+		getCheckLineLayer().setLeftTopPosition(check_line_left, check_line_top);
+		getCheckLineLayer().setVisible(true);
+	}
+}
+
+
+/**
+  * setMoveSection()
+  * 
+  * BoxðÚ®Å«éÌæðÝè·éÖ
+  * move_section[ÀÑÔ] => (left => ¶ÓX, right => EÓX, top => ãÓY, under => ºÓY)
+  */
+Panel.prototype.setMoveSection = function() {
+
+	//Ú®ÌæÌÝè
+	this.move_section_left_x	= this.panel_section['left'];
+	this.move_section_right_x	= this.move_section_left_x + BoxConfig.width + (BoxConfig.marginLeft * 2);
+	this.move_section			= new Array(this.box_limit_number + 1);
+
+	this.move_section[-1]			= new Array(4);
+	this.move_section[-1]['left']	= this.move_section_left_x;
+	this.move_section[-1]['right']	= this.move_section_right_x;
+	this.move_section[-1]['top']	= this.panel_section['top'] - 7;
+	this.move_section[-1]['under']	= this.panel_section['top'] + (BoxConfig.marginTop / 2) + BoxConfig.height;
+
+	for(i = 0; i < this.box_limit_number; ++i) {
+		this.move_section[i]			= new Array(4);
+		this.move_section[i]['left']	= this.move_section_left_x;
+		this.move_section[i]['right']	= this.move_section_right_x;
+		this.move_section[i]['top']		= this.move_section[i - 1]['under'];
+		this.move_section[i]['under']	= this.move_section[i]['top'] + BoxConfig.height + BoxConfig.padding;
+	}
+}
+
+
+
+Panel.prototype.canDropAtPosition = function(aSourcePanel, aBox, x, y)
+{
+	var orderIndex = this.orderIndexOfMovingAt(x, y);
+	var maxIndex = this.getMaxOrderIndex() + 1;
+
+	// pl©çOê½A
+	// plÌÅå Box ð´¦é = false
+	return (orderIndex != null && (this.equals(aSourcePanel) || this.box_limit_number > maxIndex));
+}
+
+/**
+ * Ú®A}ü³êéÓÌCfbNXðÔ·B
+ * 
+ * @param x x ÀW
+ * @param y y ÀW
+ * @return }ü³êéCfbNXAÈ¯êÎ null
+ */
+Panel.prototype.orderIndexOfMovingAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.move_section, x, y);
+}
+Panel.prototype.orderIndexOfBoxAt = function(x, y)
+{
+	return this.findOrderIndexOf_(this.box_section, x, y);
+}
+// private
+Panel.prototype.findOrderIndexOf_ = function(sectionDataArray, x, y)
+{
+	for (var i = -1; i < sectionDataArray.length; i++) {
+		var sec = sectionDataArray[i];
+		if (sec == null)
+			continue;
+		
+		if (x >= sec['left'] && x <= sec['right'] &&
+			y >= sec['top']  && y <= sec['under']) {
+	
+			return i
+		}
+	}
+	return null;
+}
+
+/**
+  * setBoxPosition()
+  *
+  * BoxðÄzu·éÖ
+  */
+Panel.prototype.setBoxPosition = function() {
+	for (key in this.box_position) {
+		gAllBoxes[key].setPosition(
+			this.panel_section['left'] + BoxConfig.marginLeft,
+			this.panel_section['top']  + Panel.getBoxSectionOffsetY(this.box_position[key]) );
+	}
+}
+
+Panel.prototype.setBoxVisible = function(flag)
+{
+	for (key in this.box_position) {
+		gAllBoxes[key].setVisible(flag);
+	}
+}
+
+
+
+//---------------------------------------------------------------------------------
+// Box
+//---------------------------------------------------------------------------------
+/**
+ * ÂXÌhbOÅÚ®Â\ÈÚ
+ * 
+ * @param anId HTML vfÌ id ®«
+ * 
+ * @author Yusuke Saito
+ * @version 2003/10/10
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/21
+ */
+function Box(anId)
+{	
+	this.uniqID     = anId;
+	this.srcElement = XBSLayer.getLayerImpById(BOX_ID_PREFIX + anId);
+
+	this.setUpSize();
+	this.x = this.y = 0;	
+}
+
+Box.prototype.getFormID = function() { return this.uniqID; }
+Box.prototype.getHTMLElement = function() { return this.srcElement; }
+
+/**
+ * HTML Ì hidden input vfÅn³êévpeBÌ¼O
+ */
+Box.POSITION_PROPERTY_NAME = "position";
+Box.ORDER_PROPERTY_NAME    = "order";
+Box.NAME_PROPERTY_NAME     = "sidefuncName";
+Box.AUTHOR_PROPERTY_NAME   = "authorCd";
+Box.ID_PROPERTY_NAME       = "sidefuncId";
+
+
+/**
+ * hbOÌÅÉÄÎêéB
+ * 
+ * @param theEvent mousemove
+ * @return hbOðLZ·éêÍAfalse ðÔ·B
+ */
+Box.MOVABLE_INSET = 5;	/* hL
+gÌ[ - Box.MOVABLE_INSET = hbOÂ\ÈÌæ */
+Box.canMoveWithEvent = function(theEvent) 
+{
+	// ÎIÈÊuªÙµ¢ÌÅAXBSDocument.getPageOffsetX/Y() ðø­
+	var mouse_x = XBSEvent.getMouseX(theEvent) - XBSDocument.getPageOffsetX();
+	var mouse_y = XBSEvent.getMouseY(theEvent) - XBSDocument.getPageOffsetY();
+	
+	if (mouse_x < Box.MOVABLE_INSET || mouse_y < Box.MOVABLE_INSET) {
+		return false;
+	}
+	
+	var maxX = XBSDocument.getWidth() - Box.MOVABLE_INSET;
+	var maxY = XBSDocument.getHeight() - Box.MOVABLE_INSET;
+	
+	if (mouse_x > maxX || mouse_y > maxY) {
+		return false;
+	}
+	
+	return true;
+}
+
+/**
+  * setUpSize()
+  * 
+  * BoxÌå«³ðÝè·éÖ
+  */
+Box.prototype.setUpSize = function() 
+{
+	var imp = this.getHTMLElement();
+	
+	// style.height ÅÈ¢Æ opera Å¤Ü­¢©È¢
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = BoxConfig.height;	
+		imp.style.width = BoxConfig.width;	
+	} else {
+		XBSLayer.setHeightWithLayerImp(imp, BoxConfig.height);
+		XBSLayer.setWidthWithLayerImp(imp, BoxConfig.width);
+	}
+	XBSLayer.setCursorWithLayerImp(imp, 'move');
+}
+
+/**
+  * BoxÌÊuðÝè
+  * 
+  * @param left x
+  * @param top  y
+  */
+Box.prototype.setPosition = function(left, top) 
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top);
+	this.x = left; this.y = top;
+}
+/**
+ * Box ÌÂ®«ðÝè
+ */
+Box.prototype.setVisible = function(flag)
+{
+	var imp = this.getHTMLElement();
+	XBSLayer.setVisibilityWithLayerImp(imp, flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
Index: /temp/trunk/html/drecomcms/xbs.js
===================================================================
--- /temp/trunk/html/drecomcms/xbs.js	(revision 1328)
+++ /temp/trunk/html/drecomcms/xbs.js	(revision 1328)
@@ -0,0 +1,1466 @@
+/**
+ * XBS (Cross Browser Scripting) Utilities
+ *
+ * Copyright (c) 2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+//---------------------------------------------------------------------------------
+// Debugging 
+//---------------------------------------------------------------------------------
+/**
+ * Assertion É¸sµ½Æ«É±êð throw
+ */
+ASSERT_EXCEPTION = '*** Assertion Failur *** ';
+
+/**
+ * dprint, dinspect ÌoÍðXgbv·éÆ«Í true ÉÝè
+ */
+BLOCK_DEBUG_PRINT  = true;
+
+
+/**
+ * v ª undefined ÅÈ¯êÎ true
+ */
+function defined(v) { return (typeof v != 'undefined'); }
+
+/**
+ * IuWFNgÌ·×ÄÌvpeBð dprint ÖÅ\¦
+ * 
+ * @param IuWFNg
+ */
+function dinspect(anObj)
+{
+	if (null == anObj) return;
+	for (key in anObj) {
+		dprint(key + ": " + anObj[key]);
+	}
+
+}
+
+function dprint(obj)
+{
+	if (BLOCK_DEBUG_PRINT) {
+		return;
+	}
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("/drecomcms/js/Console.html", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+	}
+	
+	var t = dprint.window.document.getElementById('console');
+	
+	if (t != null) {
+		t.value = t.value + "\n> " + obj.toString();
+	}
+// Takanori Ishiakwa 04/04/06
+// -----------------------------------------
+// Safari â Opera Å¤Ü­®ìµÈ¢½ß
+// TextArea o[WÉØèÖ¦½
+/*
+	if (typeof dprint.window == "undefined") {
+		dprint.window = window.open("", 
+			"Console",
+			"width=300, height=600, scrollbars, resizable, menubar");
+		dprint.window.document.open("text/plain");	
+	}
+	var d = dprint.window.document;
+	
+	if (d == null) return;
+
+	d.writeln("> " + obj.toString());
+	
+	// Opera: mime text/plain ðwèµÄà HTML ÆµÄðß
+	// ³êÄ¢éæ¤ÈÌÅAüs³¹é½ßÉ^OðoÍ
+	if (window.opera) d.writeln("<br>");
+*/
+}
+
+// ---------------------------------------------------------
+// XBSUtil
+// ---------------------------------------------------------
+// for the purpose of namespace
+/**
+ * uEUÝ·ðÚwµÄA[eBeBQðÜÆß½IuWFNg
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSUtil = new Object();
+
+/**
+ * vfðÜÞ document IuWFNgðÔ·B
+ * 
+ * @param document
+ */
+XBSUtil.getOwnerDocument = function(anElement) 
+{
+	if (anElement.document) {
+		return anElement.document;
+	} else if (anElement.ownerDocument) {
+		return anElement.ownerDocument;
+	}
+	return null;
+}
+
+
+/**
+ * Unicode code points collection
+ * 
+ * vOÅg¤¶R[hðWß½àÌ
+ * 
+ * @author Takanori Ishikawa
+ * @version 1.0
+ */
+XBSCType = new Object();
+
+// *** XBSCType ú» *** //
+// ú»e[u
+// key: property name
+// value: string (length must be 1)
+XBSCType.template_ = {
+	CR:    '\r',
+	LF:    '\n',
+	TAB:   '\t',
+	SPACE: ' ',
+	LT:    '<',
+	GT:    '>',
+	SLASH: '/',
+	COLON: ':',
+	AMP:   '&',
+	LBRACE:'{',
+	RBRACE:'}'
+};
+
+for (var key in XBSCType.template_) {
+	var c = XBSCType.template_[key];
+	
+	if (c.length != 1) {
+		throw ASSERT_EXCEPTION + 'XBSCType.template_[' + key + '] length must be 1.';
+	}
+	c = c.charCodeAt(0);
+	XBSCType[key] = c;
+}
+// í
+delete XBSCType.template_;
+
+/**
+ * isspace
+ */
+XBSCType.isspace = function(c) 
+{
+	return (c == XBSCType.SPACE || c == XBSCType.TAB || c == XBSCType.CR || c == XBSCType.LF);
+}
+
+
+/**
+ * DOM T|[gïÉæéuEU»Ê
+ * 
+ * <ul>
+ * <li>IE4:   IE4 </li>
+ * <li>IE5:   IE5 </li>
+ * <li>NN4:   NN4 </li>
+ * <li>NN6:   NN6 </li>
+ * <li>OTHER: ãLÈO</li>
+ * </ul>
+ */
+OTHER = 0;
+IE4   = 1;
+IE5   = 2;
+NN4   = 3;
+NN6   = 4;
+XBSUtil.DOM = document.all 
+				? (document.getElementById ? IE5 : IE4)
+				: (document.getElementById 
+					? NN6
+					: (document.layers ? NN4 : OTHER));
+
+/**
+ * eLXgì API ÌT|[gïÉæéuEU»Ê
+ */
+XBSUtil.Range = null;
+if (document.selection != null && defined(document.selection.createRange)) {
+	XBSUtil.Range = IE5;
+}
+
+
+// G[ÉÍ 0 ðÔ· parseInt(), 10 i
+XBSUtil.parseIntNoError = function(anObj) {
+	var v = 0;	
+
+	try {
+		v = parseInt(anObj, 10);
+	} catch (e) {
+
+	}
+	if ((typeof v != typeof 0) || isNaN(v)) {
+		v = 0;
+	}
+
+	return v;
+}
+
+/**
+ * DOM:
+ * DocumentImplementation - feature list
+ */
+if (null == XBSUtil.DOM) {
+	throw ASSERT_EXCEPTION + 'XBSUtil.DOM must be not null.';
+}
+XBSUtil.DOM.HTMLEvent = false;
+
+if (document.implementation) {
+	XBSUtil.DOM.HTMLEvent = document.implementation.hasFeature('HTMLEvents', '2.0');
+}
+
+
+/**
+ * Mac: AppleWebKit
+ * 
+ * Apple Ì WebKit framework ÌãÉ\z³ê½uEUÈç
+ * ±±Å XBSUtil.appleWebKit IuWFNgð¶¬B
+ * 
+ * @field major WebKit W[o[WÔ (Number)
+ * @field minor WebKit }Ci[o[WÔ (Number)
+ */
+XBSUtil.appleWebKit = null;
+var _webKitMatch = navigator.userAgent.match(/AppleWebKit\/(\d+)\.?(\d+)?/i);
+if (_webKitMatch != null) {
+	var o = new Object();
+	
+	o.major = XBSUtil.parseIntNoError(_webKitMatch[1]);
+	o.minor = XBSUtil.parseIntNoError(_webKitMatch[2]);	
+	XBSUtil.appleWebKit = o;
+}
+
+/**
+ * Mac IE
+ * 
+ * Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
+ */
+/**
+ * Mac: IE
+ * 
+ * IE Ì Mac ÅÈç
+ * ±±Å XBSUtil.macIE IuWFNgð¶¬B
+ * 
+ * @field major IE W[o[WÔ (Number)
+ * @field minor IE }Ci[o[WÔ (Number)
+ */
+//
+// QlF 
+// Mac ÌH¦È¢ìYÇà
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/ProbMac5.htm
+// Microsoft
+// http://www.microsoft.com/
+//
+XBSUtil.macIE = null;
+if (navigator.userAgent.match(/Mac/i)) {
+	var _macIEMatch;
+	
+	_macIEMatch = navigator.userAgent.match(/MSIE\s+(\d+)\.?(\d+)?/i);
+	if (_macIEMatch) {
+		var o = new Object();
+
+		o.major = XBSUtil.parseIntNoError(_macIEMatch[1]);
+		o.minor = XBSUtil.parseIntNoError(_macIEMatch[2]);	
+		XBSUtil.macIE = o;
+	}
+}
+/**
+ * Opera
+ *
+ * Opera Èç±±Å XBSUtil.opera IuWFNgð¶¬B
+ * 
+ * @field major opera W[o[WÔ (Number)
+ * @field minor opera }Ci[o[WÔ (Number)
+ */
+XBSUtil.opera = null;
+if (window.opera) {
+	var o = new Object();
+	
+	o.major = 6;
+	if (document.documentElement)
+		o.major = 7;
+	
+	o.minor = 0;
+	XBSUtil.opera = o;
+}
+
+
+// ---------------------------------------------------------
+// XBSLayer
+// ---------------------------------------------------------
+/**
+ * div vfÈÇðC[ÆµÄµ¤½ßÌIuWFNg
+ * 
+ * For example:
+ * <pre>
+ *    var layer = new XBSLayer(anIdOfDivElement);
+ *    // some operation...
+ * </pre>
+ *
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ * @see     document.layer
+ * @see     style
+ * 
+ * @param     uniqId  div vfÌ id ®«
+ * @param     doc     document IuWFNgiIvVFftHgÍwindow.documentj
+ */
+function XBSLayer(uniqId, doc)
+{
+	if (uniqId) {
+		this.setLayerImp(XBSLayer.getLayerImpById(uniqId, doc));
+	}
+}
+/**
+ * wè³ê½ div vfªÈ¯êÎáOð°é
+ * 
+ * Ç¤¹A½¢µ½ÌC[ÍÈ¢ÌÅLbV
+
+ */
+XBSLayer.makeLayer = function(uniqId, doc)
+{
+	var lyer = null;
+	
+	if (XBSLayer.makeLayer.$cache == null) {
+		XBSLayer.makeLayer.$cache = new Object();
+	}
+	
+	lyer = XBSLayer.makeLayer.$cache[uniqId];
+	if (null == lyer || (doc && doc != XBSUtil.getOwnerDocument(lyer.getLayerImp()))) {
+		lyer = new XBSLayer(uniqId, doc);
+		
+		if (null == lyer || null == lyer.getLayerImp()) {
+			//b throw ASSERT_EXCEPTION + 'div element (id:' + uniqId + ') is required.';
+		}
+		XBSLayer.makeLayer.$cache[uniqId] = lyer;
+	}
+	
+	return lyer;
+}
+
+/* ---- class properties ---- */
+
+// Visibility constants
+/**
+ * C[ÌÂ®«ð\·è
+ */
+XBSLayer.VISIBLE   = 1;
+XBSLayer.HIDDEN    = 2;
+XBSLayer.INHERIT   = 3;
+XBSLayer.UNDEFINED = 4;
+
+/**
+ * C[ÌìÉg¤ÀIuWFNgð¾é
+ *
+ * @param     anId  div vfÌ id ®«
+ * @param     doc   document IuWFNgiIvVFftHgÍwindow.documentj
+ * @return    DOM: element.style, NN: layer
+ */
+XBSLayer.getLayerImpById = function(anId, doc) 
+{
+	var imp = null;
+	
+	if (null == doc) {
+		doc = document;
+	}
+	if (doc.getElementById || doc.all) {
+		imp = doc.getElementById 
+				? doc.getElementById(anId)
+				: doc.all(anId);
+	} else if (doc.layers) {
+		imp = doc.layers[anId];
+	}
+	return imp;
+}
+XBSLayer.getStyleObjectWithLayerImp = function(imp)
+{
+	if (document.getElementById || document.all) {
+		return imp.style;
+	} else {
+		return imp;
+	}
+}
+
+/**
+ * evfð¾é
+ *
+ * @param     imp  ÀIuWFNg
+ * @return    evf
+ */
+XBSLayer.getParentOfLayerImp = function(imp)
+{
+	var parent = null;
+	
+	if (null == imp) {
+		;
+	} else if (defined(imp.parentElement)) {
+		parent = imp.parentElement;
+	} else if (defined(imp.offsetParent)) {
+		parent = imp.offsetParent;
+	}
+
+	return parent;
+}
+
+
+/**
+ * C[ÌìÉg¤ÀIuWFNgÌÂ®«ðÔ·B
+ *
+ * @param     imp  ÀIuWFNg
+ * @return    Â®«ð\·è
+ * <ul>
+ * <li>XBSLayer.VISIBLE</li>
+ * <li>XBSLayer.HIDDEN</li>
+ * <li>XBSLayer.INHERIT</li>
+ * <li>XBSLayer.UNDEFINED</li>
+ * </ul>
+ */
+XBSLayer.getVisibilityWithLayerImp = function(imp)
+{
+	var v;
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	v = imp.visibility;
+	if (document.all) {
+		if (v == '') return XBSLayer.INHERIT;
+	} else if (!document.getElementById && document.layers) {
+		if (v == 'show') return XBSLayer.VISIBLE;
+		if (v == 'hide') return XBSLayer.HIDDEN;
+	}
+	
+	if (v == 'visible') return XBSLayer.VISIBLE;
+	if (v == 'hidden') return XBSLayer.HIDDEN;
+	if (v == 'inherit') return XBSLayer.INHERIT;
+		
+	return XBSLayer.UNDEFINED;
+}
+XBSLayer.setVisibilityWithLayerImp = function(imp, anEnum)
+{
+	var v = '';
+	
+	if (!document.getElementById && document.layers) {
+		if (anEnum == XBSLayer.VISIBLE) v = 'show';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hide';
+	} else {
+		if (anEnum == XBSLayer.VISIBLE) v = 'visible';
+		if (anEnum == XBSLayer.HIDDEN) v = 'hidden';
+		if (anEnum == XBSLayer.INHERIT) v = 'inherit';
+	}
+	
+	if (XBSUtil.DOM != NN4) {
+		imp = imp.style;
+	}
+	return imp.visibility = v;
+}
+/**
+ * C[Ì display ®«
+ * 
+ * @return C[ªÌæðÂêÍ true
+ */
+XBSLayer.isBlockWithLayerImp = function(imp)
+{
+	var b = true;
+	
+	if (imp.style.display != null) {
+		b = (imp.style.display != 'none');
+	}
+	return b;
+}
+XBSLayer.setBlockWithLayerImp = function(imp, b)
+{
+	if (imp.style != null) {
+		imp.style.display = b ? 'block' : 'none';
+	}
+}
+
+// Position & Size
+
+
+// zIndex
+XBSLayer.getZIndexWithLayerImp = function(imp)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	return imp.zIndex;
+}
+XBSLayer.setZIndexWithLayerImp = function(imp, z)
+{
+	if (XBSUtil.DOM != NN4)
+		imp = imp.style;
+	
+	imp.zIndex = z;
+}
+
+
+// Position
+/**
+ * ÊuwèÉg¤è
+ */
+XBSLayer.LEFT_TOP     = 1;
+XBSLayer.LEFT_BOTTOM  = 2;
+XBSLayer.RIGHT_TOP    = 3;
+XBSLayer.RIGHT_BOTTOM = 4;
+
+/**
+ * [eBeBF wè³ê½CxgÌÊuÉC[ðÚ®A\¦
+ * 
+ * @param imp div vf
+ * @param theEvent CxgIuWFNg
+ * @param axisType ÀWðwè·éÊu
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ *
+ * @param offsetX ±Ì£¾¯CxgÌÊu©ç£· (x ÀW)
+ * @param offsetY ±Ì£¾¯CxgÌÊu©ç£· (y ÀW)
+ * 
+ */
+XBSLayer.popUpWithLayerImpAtEventLocation = function(imp, theEvent, axisType, offsetX, offsetY)
+{
+	var left   = XBSEvent.getMouseX(theEvent) + offsetX;
+	var top    = XBSEvent.getMouseY(theEvent) + offsetY;
+		
+	XBSLayer.initPositionStyle(imp);
+	XBSLayer.setPositionWIthLayerImp(imp, left, top, axisType);
+	XBSLayer.setVisibilityWithLayerImp(imp, XBSLayer.VISIBLE);
+}
+
+/**
+ * C[ÌÊuwè
+ * 
+ * @param imp div vf
+ * @param x x ÀW
+ * @param y y ÀW
+ * @param axisType ÀWðwè·éÊu (default: LEFT_TOP)
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.setPositionWIthLayerImp = function(imp, x, y, axisType)
+{
+	var left = x;
+	var top  = y;
+	var w = XBSLayer.getWidthWithLayerImp(imp);
+	var h = XBSLayer.getHeightWithLayerImp(imp);
+	
+	if (XBSLayer.LEFT_BOTTOM == axisType) {
+		top -= h;
+	} else if (XBSLayer.RIGHT_TOP == axisType) {
+		left -= w;
+	} else if (XBSLayer.RIGHT_BOTTOM == axisType) {
+		top -= h;
+		left -= w;
+	}
+	if (left < 0) left = 0;
+	if (top < 0) top = 0;
+	
+	XBSLayer.setLeftTopPositionWithLayerImp(imp, left, top)
+}
+/**
+ * C[ÌÊui¶ãjðwèB
+ * 
+ * @param imp div vf
+ * @param top ¶ã x ÀW
+ * @param left ¶ã y ÀW
+ */
+XBSLayer.setLeftTopPositionWithLayerImp = function(imp, left, top)
+{	
+	if (XBSUtil.DOM == NN4) {
+		imp.moveTo(left, top);
+	}else if (imp.style != null) {	
+		imp.style.left = left; imp.style.top = top;
+	}
+}
+/**
+ * C[ÌÊuîñðú»BuEUÉæÁÄÍ±ÌÖð
+ * ¼ÌÊuÖWÖæèàOÉÄÎÈ¢ÆÊªsèÉÈéB
+ * 
+ * @param imp div
+ */
+XBSLayer.initPositionStyle = function(imp)
+{
+	if (document.layers) {
+		return;
+	} else if (typeof imp.style.left == "string") {
+		imp.style.left = imp.offsetLeft + 'px';
+		imp.style.top  = imp.offsetTop  + 'px';
+	} else if (typeof imp.style.pixelLeft != "undefined") {
+		imp.style.pixelLeft = imp.offsetLeft;
+		imp.style.pixelTop  = imp.offsetTop;
+	}
+}
+
+XBSLayer.getLeftWithLayerImp = function(imp)
+{
+	var x = 0;
+
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		x = imp.offsetLeft;
+	} else if (XBSUtil.DOM == IE4) {
+		x = imp.style.pixelLeft;
+	} else if (XBSUtil.DOM == NN4) {
+		x = imp.clip.left;
+	}
+	return x;
+}
+
+XBSLayer.getTopWithLayerImp = function(imp)
+{
+	var y = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		y = imp.offsetTop;
+	} else if (XBSUtil.DOM == IE4) {
+		y = imp.style.pixelTop;
+	} else if (XBSUtil.DOM == NN4) {
+		y = imp.clip.top;
+	}
+	return y;
+}
+
+// Size
+XBSLayer.getWidthWithLayerImp = function(imp) 
+{
+	var w = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		w = imp.offsetWidth;
+	} else if (XBSUtil.DOM == IE4) {
+		w = imp.style.pixelWidth;
+	} else if (XBSUtil.DOM == NN4) {
+		w = imp.clip.width;
+	}
+	return w;
+}
+XBSLayer.getHeightWithLayerImp = function(imp)
+{
+	var h = 0;
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		h = imp.offsetHeight;
+	} else if (XBSUtil.DOM == IE4) {
+		h = imp.style.pixelHeight;
+	} else if (XBSUtil.DOM == NN4) {
+		h = imp.clip.height;
+	}
+	return h;
+}
+XBSLayer.setWidthWithLayerImp = function(imp, w) 
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.width = w;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelWidth = w;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(w, imp.clip.height);
+
+	}
+}
+XBSLayer.setHeightWithLayerImp = function(imp, h)
+{
+	if (XBSUtil.DOM == NN6 || XBSUtil.DOM == IE5) {
+		imp.style.height = h;	
+	} else if (XBSUtil.DOM == IE4) {
+		imp.style.pixelHeight = h;
+	} else if (XBSUtil.DOM == NN4) {
+		imp.resizeTo(imp.clip.width, h);
+	}
+}
+
+// HTML
+XBSLayer.getInnerHTMLWithLayerImp = function(imp)
+{
+	if (defined(imp.innerHTML)) {
+		return imp.innerHTML;
+	}
+	return '';
+}
+XBSLayer.setInnerHTMLWithLayerImp = function(imp, htmlText)
+{
+	if (defined(imp.innerHTML)) {
+		imp.innerHTML = htmlText;
+	} else if (document.layers != null) {
+		imp.document.open();
+		imp.document.write(htmlText);
+		imp.document.close();
+	}
+}
+
+// Cursor
+XBSLayer.setCursorWithLayerImp = function(imp, aName) 
+{
+	if (imp.style != null && defined(imp.style.cursor)) {
+		imp.style.cursor = aName;
+	}
+}
+
+
+
+/* ---- Instance properties ---- */
+/**
+ * evfÌ XBSLayer ðÔ·
+ */
+XBSLayer.prototype.getParent = function()
+{
+	var imp = XBSLayer.getParentOfLayerImp(this.getLayerImp());
+	if (null == imp) {
+		return null;
+	}
+	var lyer = new XBSLayer();
+	
+	lyer.setLayerImp(imp);
+	return lyer;
+}
+XBSLayer.prototype.getID = function() { 
+	return this.getLayerImp().id;
+}
+XBSLayer.prototype.hasID = function() {
+	var id = this.getID();
+	
+	return id != null && id != '';
+}
+XBSLayer.prototype.isValid = function() {
+	return (this.getLayerImp() != null);
+}
+// Visibility
+XBSLayer.prototype.getVisibility = function()
+{
+	return XBSLayer.getVisibilityWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setVisibility = function(aEnum)
+{
+	XBSLayer.setVisibilityWithLayerImp(this.getLayerImp(), aEnum);
+}
+
+/**
+ * C[ªÂ©Ç¤©ðÔ·B
+ *
+ * @return    boolean
+ */
+XBSLayer.prototype.isVisible  = function()
+{
+	return this.getVisibility() == XBSLayer.HIDDEN ? false : true;
+}
+XBSLayer.prototype.setVisible = function(/* boolean */ flag)
+{
+	this.setVisibility(flag ? XBSLayer.VISIBLE : XBSLayer.HIDDEN);
+}
+XBSLayer.prototype.toggleVisibility = function()
+{
+	this.setVisible(false == this.isVisible())
+}
+/**
+ * C[Ì display ®«
+ * 
+ * @return C[ªÌæðÂêÍ true
+ */
+XBSLayer.prototype.isBlock  = function()  
+{ return XBSLayer.isBlockWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setBlock = function(b) 
+{ XBSLayer.setBlockWithLayerImp(this.getLayerImp(), b); }
+
+
+/**
+ * C[Ì z ÀW
+ */
+XBSLayer.prototype.getZIndex = function()
+{
+	return XBSLayer.getZIndexWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setZIndex = function(z)
+{
+	XBSLayer.setZIndexWithLayerImp(this.getLayerImp(), z);
+}
+
+
+XBSLayer.prototype.getStyleObject = function() 
+{
+	return XBSLayer.getStyleObjectWithLayerImp(this.imp);
+}
+XBSLayer.prototype.getLayerImp = function() { return this.imp; }
+XBSLayer.prototype.setLayerImp = function(imp) { this.imp = imp; }
+
+// Position & Size
+XBSLayer.prototype.popUpAtEventLocation = function(theEvent, axisType, offsetX, offsetY)
+{ XBSLayer.popUpWithLayerImpAtEventLocation(this.getLayerImp(), theEvent, axisType, offsetX, offsetY); }
+
+/**
+ * C[ÌÊuwè
+ * 
+ * @param x x ÀW
+ * @param y y ÀW
+ * @param axisType ÀWðwè·éÊu
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP</li>
+ * <li>XBSLayer.LEFT_BOTTOM</li>
+ * <li>XBSLayer.RIGHT_TOP</li>
+ * <li>XBSLayer.RIGHT_BOTTOM</li>
+ * </ul>
+ */
+XBSLayer.prototype.setPosition = function(x, y, axisType)
+{ XBSLayer.setPositionWIthLayerImp(this.getLayerImp(), x, y, axisType); }
+XBSLayer.prototype.setLeftTopPosition = function(left, top) 
+{ 
+	XBSLayer.setLeftTopPositionWithLayerImp(this.getLayerImp(), left, top); 
+}
+
+XBSLayer.prototype.getX = function() { return XBSLayer.getLeftWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getY = function() { return XBSLayer.getTopWithLayerImp(this.getLayerImp()); }
+/**
+ * ÀWðâÎlÅæ¾
+ */
+XBSLayer.prototype.getAbsolute_ = function(fnName)
+{
+	var ret = 0;
+	var lyer = this;
+	
+	while (lyer != null && lyer.isValid()) {
+		ret += lyer[fnName]();	
+		lyer = lyer.getParent();
+	}
+	return ret;
+	
+}
+XBSLayer.prototype.getAbsoluteX = function()
+{
+	return this.getAbsolute_("getX");
+}
+XBSLayer.prototype.getAbsoluteY = function()
+{
+	return this.getAbsolute_("getY");
+}
+
+XBSLayer.prototype.getWidth  = function() { return XBSLayer.getWidthWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.getHeight = function() { return XBSLayer.getHeightWithLayerImp(this.getLayerImp()); }
+XBSLayer.prototype.setWidth  = function(w) { return XBSLayer.setWidthWithLayerImp(this.getLayerImp(), w); }
+XBSLayer.prototype.setHeight = function(h) { return XBSLayer.setHeightWithLayerImp(this.getLayerImp(), h); }
+
+// HTML
+XBSLayer.prototype.getInnerHTML = function()
+{
+	return XBSLayer.getInnerHTMLWithLayerImp(this.getLayerImp());
+}
+XBSLayer.prototype.setInnerHTML= function(htmlText)
+{
+	XBSLayer.setInnerHTMLWithLayerImp(this.getLayerImp(), htmlText);
+}
+
+// Cursor
+XBSLayer.prototype.setCursor = function(aName) { XBSLayer.setCursorWithLayerImp(this.getLayerImp(), aName); }
+
+//---------------------------------------------------------
+// XBSDocument
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * hL
+gîñÌæ¾
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSDocument = new Object();
+
+
+/**
+ * hL
+gSÌÌå«³
+ * 
+ * @return A³
+ */
+XBSDocument.getWidth = function()
+{
+	var w = 0;
+	
+	if (window.innerWidth != null) {
+		w = window.innerWidth;
+	
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ªÔÁÄ­é
+	/*
+	} else if (document.documentElement && document.documentElement.clientWidth != null) {
+		w = document.documentElement.clientWidth;
+	*/
+	} else if (document.body && document.body.clientWidth != null) {
+		w = document.body.clientWidth;
+	} 
+	return w;
+}
+
+XBSDocument.getHeight = function()
+{
+	var h = 0;
+	
+	if (window.innerHeight != null) {
+		h = window.innerHeight;
+	// 2004-04-13  Takanori Ishikawa  
+	// ------------------------------------------------------------------------
+	// IE: 0 ªÔÁÄ­é
+	/*
+	} else if (document.documentElement && document.documentElement.clientHeight != null) {
+		h = document.documentElement.clientHeight;
+	*/
+	} else if (document.body && document.body.clientHeight != null) {
+		h = document.body.clientHeight;
+	} 
+	return h;
+}
+
+/**
+ * hL
+gÌÂÌæÌ¶ãÀW
+ * 
+ * @return x, y
+ */
+XBSDocument.getPageOffsetX = function()
+{
+	var x = 0;
+	
+	if (document.body && document.body.scrollLeft != null) {
+		x = document.body.scrollLeft;
+	} else if (document.documentElement && document.documentElement.scrollLeft != null) {
+		x = document.documentElement.scrollLeft;
+	} else if (window.scrollX != null) {
+		x = window.scrollX;
+	} else if (window.pageXOffset != null) {
+		x = window.pageXOffset;
+	}
+	
+	return x;
+}
+XBSDocument.getPageOffsetY = function()
+{
+	var y = 0;
+	
+	if (document.body && document.body.scrollTop != null) {
+		y = document.body.scrollTop;
+	} else if (document.documentElement && document.documentElement.scrollTop != null) {
+		y = document.documentElement.scrollTop;
+	} else if (window.scrollY != null) {
+		y = window.scrollY;
+	} else if (window.pageYOffset != null) {
+		y = window.pageYOffset;
+	}
+	
+	return y;
+}
+
+//---------------------------------------------------------
+//XBSEvent
+//---------------------------------------------------------
+// object for namespace purpose
+/**
+ * CxgIuWFNgÌì
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+XBSEvent = new Object();
+
+// *** Key code *** //
+/**
+ * Key code (unicode)
+ * 
+ * @see http://www.unicode.org
+ */
+// 0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;;
+XBSEvent.BACKSPACE_KEY = 0x08;
+// 0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;;
+XBSEvent.TAB_KEY = 0x09;
+// 000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;;
+XBSEvent.LINE_FEED_KEY = 0x0A;
+// 000D;<control>;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;;
+XBSEvent.NEW_LINE_KEY = 0x0D;
+
+
+// Modifier keys
+XBSEvent.ALT_KEY_MASK     = 1;
+XBSEvent.SHIFT_KEY_MASK   = 1 << 1;
+XBSEvent.CONTROL_KEY_MASK = 1 << 2;
+XBSEvent.META_KEY_MASK    = 1 << 3;
+
+/**
+  * getMouseX(e), getMouseY(e)
+  *
+  * }EXªCxgðN±µ½É
+  * XÀWAYÀWðÔ·Ö
+  * 
+  * @param theEvent }EXCxg
+  * @return ÀW
+  */
+XBSEvent.getMouseX = function(theEvent)
+{
+	var x = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	// Safari Í clientX àâÎÀWÅÔµÄ­é
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageX
+	}
+	
+	if (theEvent.clientX != null) {
+		x = XBSDocument.getPageOffsetX() + theEvent.clientX;
+	} else if (theEvent.pageX != null) {
+		x = theEvent.pageX;
+	} else if (window.opera != null) {  // OÌ½ßB®ìmFµ½o[WÅÍ±È¢
+		x = (document.documentElement ? window.pageXOffset : 0) + theEvent.clientX;
+	}
+	
+	return x;
+}
+XBSEvent.getMouseY = function(theEvent) {
+	var y = 0;
+	
+	if (null == theEvent) {
+		theEvent = window.event;
+	}
+	
+	// Safari Í clientY àâÎÀWÅÔµÄ­é
+	if (XBSUtil.appleWebKit != null) {
+		return theEvent.pageY;
+	}
+	
+	if (theEvent.clientY != null) {
+		y = XBSDocument.getPageOffsetY() + theEvent.clientY;
+	} else if (theEvent.pageY != null) {
+		y = theEvent.pageY;
+	} else if (window.opera != null) {  // OÌ½ßB®ìmFµ½o[WÅÍ±È¢
+		y = (document.documentElement ? window.pageYOffset : 0) + theEvent.clientY;
+	}
+	
+	return y;
+}
+
+
+/**
+ * Key Event Ì Unicode R[h|Cgð¾é
+ * 
+ * @return code, È¯êÎ null
+ */
+XBSEvent.getKeyCode = function(theEvent) 
+{
+	if (theEvent.which != null) {
+		return theEvent.which;
+	} else if (theEvent.keyCode != null) {
+		return theEvent.keyCode;
+	}
+	return null;
+}
+XBSEvent.getTarget = function(theEvent) 
+{
+	if (theEvent.target != null) {
+		return theEvent.target;
+	} else if (theEvent.srcElement != null) {
+		return theEvent.srcElement;
+	}
+	return null;
+}
+
+
+XBSEvent.getModifierFlags = function(theEvent)
+{
+	var flags = 0;
+	
+
+	if (defined(theEvent.ctrlKey)) {
+		if (theEvent.altKey) flags |= XBSEvent.ALT_KEY_MASK;
+		if (theEvent.shiftKey) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (theEvent.ctrlKey) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (theEvent.metaKey) flags |= XBSEvent.META_KEY_MASK;
+	} else if (defined(theEvent.modifiers)) {
+		var m = theEvent.modifiers;
+		
+		if (Event.ALT_MASK & m) flags |= XBSEvent.ALT_KEY_MASK;
+		if (Event.SHIFT_KEY_MASK & m) flags |= XBSEvent.SHIFT_KEY_MASK;
+		if (Event.CONTROL_MASK & m) flags |= XBSEvent.CONTROL_KEY_MASK;
+		if (Event.META_MASK & m) flags |= XBSEvent.META_KEY_MASK;
+	}
+	return flags;
+}
+
+
+//---------------------------------------------------------------------------------
+// Utilities
+//---------------------------------------------------------------------------------
+UtilKit = new Object();
+
+/**
+ * wè³ê½IuWFNgÌvpeBÉÖð *** ÇÁ *** ·éB
+ * ÈOÉÊÌÖªo^³êÄ¢êÎ»êðÄÑoµÄ©çAo^³ê½ÖðÄÑo·B
+ * 
+ * NOTE: n¹éøÍÆè ¦¸ 5 ÂÜÅÆµ½B±ê¾¯ êÎ\ªÈÌÅB
+ * 
+ * @param anObject IuWFNg
+ * @param funcName vpeB¼
+ * @param func     Ö{Ì
+ */
+UtilKit.addhook = function(anObject, funcName, func)
+{
+	var prev = anObject[funcName];
+	var fns  = new Array();
+	if (typeof prev == typeof UtilKit.addhook) {
+		fns[fns.length] = prev;
+	}
+	fns[fns.length] = func;
+	
+	// dprint("UtilKit.addhook(" + anObject + ", " + funcName + ") nfunc = " + fns.length);
+	anObject[funcName] = function() {
+		// dprint("funcName: " + funcName + ": " + this);
+		for (var i = 0; i < fns.length; i++) {
+			// dprint(fns[i]);
+			
+			// 2004-04-20  Takanori Ishikawa  
+			// -------------------------------------------------------------------
+			// ÖàÅøÌÂð`FbNµÄ¢éÂ\«à éÌÅA{ÍøÂÅªò·×«©à
+			// ½¾A»ÌêAøª«èÈ¢êÈÇàl¶·éÆÊ|­³¢ÌÅè²«
+			 fns[i](
+				arguments[0],
+				arguments[1],
+				arguments[2],
+				arguments[3],
+				arguments[4]);
+			/*
+			var f = fns[i]; var args = arguments;
+			
+			switch (fns.length) {
+			case 0: f(); break;
+			case 1: f(args[0]); break;
+			case 2: f(args[0], args[1]); break;
+			case 3: f(args[0], args[1], args[2]); break;
+			default: ;
+			}
+			*/
+		}
+	};
+}
+
+/**
+ * IuWFNgÌvpeBðÔ·B
+ * null ÌêÍáOð°é
+ * 
+ * @param obj  object
+ * @param name property name
+ */
+UtilKit.getPropertyNotNull = function(obj, name)
+{
+	var v = obj[name];
+	
+	if (null == v) {
+		throw ASSERT_EXCEPTION + "object: " + obj + " name: " + name + ' must be nut null.';
+	}
+	
+	return v;	
+}
+
+/**
+ * IuWFNgð_lÉÏ·
+ */
+UtilKit.parseBoolean = function(v)
+{
+	if (typeof v == typeof true) {
+		return v;
+	} else if (typeof v == typeof "") {
+		if ('true' == v) 
+			return true;
+		else if ('false' == v) 
+			return false;
+		else
+			return true;
+	} else if (null == v) {
+		return false;
+	} else {
+		return true;
+	}
+}
+/**
+ * IuWFNgÌvpeB©çA»êÌo^³êÄ¢éL[ðõ
+ * 
+ * @param anObject IuWFNg
+ * @param aValue   vpeBl
+ */
+UtilKit.getKeyForValue = function(anObject, aValue)
+{
+	for (var key in anObject) {
+		if (aValue == anObject[key]) {
+			return key;
+		}
+	}
+	return null;
+}
+
+UtilKit.getBgColorById = function(anId, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	return UtilKit.normalizeRGBColorRep(style.backgroundColor);
+}
+UtilKit.setBgColorById = function(anId, aColor, doc)
+{
+	var imp;
+	var style;
+	
+	if (doc == null) {
+		doc = document;
+	}
+		
+	imp = XBSLayer.getLayerImpById(anId, doc);
+	style = imp ? XBSLayer.getStyleObjectWithLayerImp(imp) : null;
+	
+	if (style == null) {
+		return null;
+	}
+	style.backgroundColor = aColor;
+}
+
+/**
+ * NN, Opera ÍwiFð rgb(r, g, b) Æ¢¤`®Å
+ * nµÄ­éÌÅA»êð #RGB ÉÏ·
+ */
+UtilKit.normalizeRGBColorRep = function(aColor)
+{
+	var m = aColor.match(/rgb\((\d+),\s*(\d+),\s+(\d+)\)/);
+	
+	if (null == m) {
+		return aColor;
+	}
+	var s = "#";
+	
+	for (var i = 1; i <= 3; i++) {
+		var n = m[i];
+		
+		n = XBSUtil.parseIntNoError(n);
+		n = n.toString(16);
+		if (n.length == 1){
+			n = '0' + n;
+		}
+		s += n;
+	}
+	return s;
+}
+
+/**
+ * InitialFirstResponder:
+ *   [UªÅÉüÍ·×«tH[vf
+ * 
+ * InitialFirstResponder ðÝè·éÖðÔ·B
+ * ±ÌÖÍÀs³êéÆAwindow.initialFirstResponder É»ÌtH[vfði[µA
+ * »ÌtH[vfð focus() ·éB
+ * window.onload Ågíêé±Æðzè
+ * 
+ */
+UtilKit.makeInitialFirstResponder = function(formName, elementName)
+{
+	return function() {
+		var frm = document.forms[formName];
+	
+		if (frm == null) return;
+		frm = frm[elementName];
+		if (frm == null) return;
+		
+		window.initialFirstResponder = frm;
+		setTimeout("window.initialFirstResponder.focus()", 500);
+	};
+}
+
+
+//---------------------------------------------------------------------------------
+// ContentsChangedListener
+//---------------------------------------------------------------------------------
+/**
+ * 
+ * y[WÌàeªÏX³ê½©Ç¤©ðL^
+ * 
+ * @author Takanori Ishikawa
+ * @version 2004/04/20
+ */
+function ContentsChangedListener(/* Optional */ aName)
+{
+	this.name = aName;
+	if (this.name == null) {
+		this.name = '[undefined listener]';
+	}
+	this.changed = false;
+}
+ContentsChangedListener.prototype.toString = function()
+{ return '[ContentsChangedListener] ' + this.name; }
+
+ContentsChangedListener.prototype.isChanged = function() { return this.changed; }
+ContentsChangedListener.prototype.setChanged = function(b) {
+	if (this.changed != b) {
+		//alert(this + " changed: " + b);
+	}
+	this.changed = b; 
+}
+
+/**
+ * Cxgðo^µAo^µ½Cxgª­¶µ½Æ«É
+ * ÏXtOð true É·éB
+ * 
+ * åÉ html vfÌ onchange CxgÈÇðß¨µA
+ * ÏXtOð§ÄéÌÉg¤B
+ */
+ContentsChangedListener.prototype.listenEvent = function(anObject, eventName)
+{
+//	2004-04-20  Takanori Ishikawa  
+//	------------------------------------------------------------------------
+//	this ÍÖàÅÀsÉðß³êé½ßAêxÏÉüêÄ
+//	ÃIXR[vÉ©·éKvª éiðú³êÈ¢Hj
+	var me = this
+	var callback = function(){ me.setChanged(true); };
+	
+	UtilKit.addhook(anObject, eventName, callback);
+}
+
+
+//---------------------------------------------------------------------------------
+// Common
+//---------------------------------------------------------------------------------
+/**
+ * AvP[VSÌÌÝè
+ * 
+ * @author  Takanori Ishikawa
+ * @version 1.0
+ */
+OEMBlogGlobal = new Object();
+
+/**
+ * LÒWÅ Blog |[^EJeSÌIððNbL[ÉÛ¶·é©
+ */
+OEMBlogGlobal.saveTbCategoryToCookie = false;
+
+/**
+ * LÒWÅ^OÒW@\i^O²ÆíAÚ®ÈÇjð HTML ^OÅàLøÉ·é©
+ */
+OEMBlogGlobal.enableTagEditingOnHTML = false;
+
+
+/**
+ * ÚÝèÌfBXN[WgCAOÈÇÅAj[VðLøÉ·é©
+ */
+OEMBlogGlobal.enableAnimationFeedback = true;
+
+/**
+ * æðAbv[h·éfBNgÌpX
+ * jsp ¤ÅKXXV³êéB
+ */
+OEMBlogGlobal.uploadImageDirectory = null;
+
+/**
+ * Abv[hÅ«éæt@C¼Ì`®
+ */
+OEMBlogGlobal.IMAGE_FILE_PATTERN = /{(¶:|E:)?([a-zA-Z0-9-_.!~'()]+\.[a-zA-Z]+)}/;
+
+/**
+ * TCho[FzuÅ«éÚÌÅå
+ * 
+ * @see sidefunc_order.js BoxConfig.maxNBoxes
+ */
+OEMBlogGlobal.PANEL_DISABLE_MAX_NBOXES	= 50;	// ugpµÈ¢@\v
+OEMBlogGlobal.PANEL_LEFT_MAX_NBOXES		= 50;	// ugp·é@\v¶
+OEMBlogGlobal.PANEL_RIGHT_MAX_NBOXES	= 50;	// ugp·é@\vE
+
+
+/**
+ * 
+ * LÒWAVKì¬ÅÍÈºÌ¶ñðÜÞNðNbNµ½êA
+ * Ü¾ÏXªÛ¶³êÄ¢È¯êÎmF_CAOðo·B
+ * 
+ * @see entry_write_edit.js, entry_save_confirm.jsp
+ * @see OEMBlogGlobal.watchOtherLinks
+ */
+OEMBlogGlobal.DOCUMENT_EDITED_WARNING = "ÏXÍÛ¶³êÄ¢Ü¹ñB<br>Ìy[WÖÚÁÄàæëµ¢Å·©H"
+OEMBlogGlobal.WATCH_OTHER_LINK_LIST = [
+					/* ã */
+					'MyPage',			/* }Cy[W */
+					'EntryWrite',		/* LVKì¬ */
+					'EntryList',		/* Lê */
+					'TopicList',		/* NXg */
+					'SidefuncOrder',	/* TCho[ */
+					'DesignChange',		/* fUC */
+					'BlogSetup',		/* Ýè */
+					
+					/* ¶ */
+					'SidefuncOrder',	/* @\IðEÀÑÖ¦ */
+					'SidefuncSetup',	/* \¦¼ÏX */
+					'SidefuncEditList',		/* @\ÇÁ */
+					'LinksList',		/* NW  ÒW */
+					'CategoryList'		/* JeS  ÒW */
+					];
+
+
+/**
+ * eLXgÌu·ÈÇÅgp·éüsR[h
+ */
+/** TODO: dlÉµ½ªÁÄA»ÊR[hð­±ÆBÆè ¦¸ACRLF ÉµÄ¨­ */
+OEMBlogGlobal.lineSeparator = "\r\n";
+
+
+OEMBlogGlobal.makeWatchOtherLinkFunction = function(aListener, prevFunc)
+{
+	return function(e) {
+		var ret = true;
+			
+		if (prevFunc != null) {
+			ret = prevFunc(e);
+		}
+		if (aListener.isChanged() == false)
+			return ret;
+			
+		return (htmlConfirm(OEMBlogGlobal.DOCUMENT_EDITED_WARNING))
+	};
+}
+OEMBlogGlobal.watchOtherLinks = function(aDocument, aListener)
+{
+	var linkArray = aDocument.links;
+	var nms = OEMBlogGlobal.WATCH_OTHER_LINK_LIST;
+	var link;
+	var count = 0;
+	
+	for (var i = 0; i < linkArray.length; i++) {
+		
+		link = linkArray[i];
+		if (null == link) continue;
+		
+		for (var j = 0; j < nms.length; j++) {
+			if (link.href.indexOf(nms[j]) != -1) {
+				var prevFunc = link.onclick;
+				
+				if (typeof prevFunc != 'function') {
+					prevFunc = null;
+				}
+				link.onclick = OEMBlogGlobal.makeWatchOtherLinkFunction(aListener, prevFunc);
+				
+				count++;
+				break;
+			}
+		}
+		if (count == nms.length) {
+			break;
+		}
+	}
+}
Index: /temp/trunk/html/drecomcms/style.js
===================================================================
--- /temp/trunk/html/drecomcms/style.js	(revision 1328)
+++ /temp/trunk/html/drecomcms/style.js	(revision 1328)
@@ -0,0 +1,23 @@
+
+var d = document;
+var n = navigator;
+var Mac = n.appVersion.indexOf('Mac');
+var MSIE = n.userAgent.indexOf('MSIE');
+var Safari = n.userAgent.indexOf('Safari');
+var Netscape = n.userAgent.indexOf('Netscape');
+var css = null;
+	
+if(Mac>-1){
+	if((Safari>1)||(MSIE>1)){
+		css = 'mac-webkit.css';
+	}else{
+		css = 'mac.css';
+	}
+}else{
+	if(MSIE>1){
+		css = 'win-ie.css';
+	}else{
+		css = 'win.css';
+	}
+}
+d.write('<link rel="stylesheet" href="/drecomcms/css/' + css + '" type="text/css">\n');
Index: /temp/trunk/html/drecomcms/popup.js
===================================================================
--- /temp/trunk/html/drecomcms/popup.js	(revision 1328)
+++ /temp/trunk/html/drecomcms/popup.js	(revision 1328)
@@ -0,0 +1,73 @@
+/*
+ * PopUp for tooltip
+ *
+ *
+ * Copyright (c) 2003-2004 DRECOM CO.,LTD. All rights reserved.
+ * 
+ * info@drecom.co.jp
+ * http://www.drecom.co.jp/
+ */
+
+var POPUP_ID       = 'popup';
+var POPUP_HTML     = '<div id="'+POPUP_ID+'" class="popup" align="left"></div>';
+
+var POPUP_OFFSET   = 15;
+// div Ìå«³ªÂÏÌ½ßAXBSLayer.LEFT_TOP µ©wèÅ«Ü¹ñ
+var POPUP_POSITION = XBSLayer.LEFT_TOP; // |bvAbvÌ¶ãª}EXÊu
+
+var gPopUpLayer = null;
+
+
+/**
+ * |bvAbvð\¦·éÖ
+ * 
+ * @param theEvent CxgIuWFNgiK{j
+ * @param text |bvAbvÉ\¦·éàeiK{j
+ *
+ * @param offsetX XûüÉ±Ì£¾¯CxgÌÊu©ç£·iIvVj
+ * @param offsetY YûüÉ±Ì£¾¯CxgÌÊu©ç£·iIvVj
+ * @param axisType |bvAbvÌæÌ¸_Ì¤¿AÇêðîÉ\¦·é©BiIvVj
+ * <ul>
+ * <li>XBSLayer.LEFT_TOP     ¶ã¸_ðî</li>
+ * <li>XBSLayer.LEFT_BOTTOM  ¶º¸_ðî</li>
+ * <li>XBSLayer.RIGHT_TOP    Eã¸_ðî</li>
+ * <li>XBSLayer.RIGHT_BOTTOM Eº¸_ðî</li>
+ * </ul>
+ * 
+ */
+function showPopup(theEvent, text, axisType, offsetX, offsetY)
+{
+	var position;
+	var x, y;
+	
+	if (null == gPopUpLayer) {
+		gPopUpLayer = XBSLayer.makeLayer(POPUP_ID);
+	}
+	gPopUpLayer.setInnerHTML(text);
+	
+	if (axisType == null) {
+		axisType = POPUP_POSITION;
+	}
+	if (offsetX == null) {
+		offsetX = POPUP_OFFSET;
+	}
+	if (offsetY == null) {
+		offsetY = POPUP_OFFSET;
+	}
+	
+	gPopUpLayer.popUpAtEventLocation(theEvent, axisType, offsetX, offsetY);
+}
+
+/**
+  * hidePopup()
+  * 
+  * C[Å|bvAbvð\¦·éÖ
+  */
+function hidePopup(e) 
+{
+	if (gPopUpLayer != null) {
+		gPopUpLayer.setVisible(false);
+	}
+}
+// |bvAbvp html ðoÍµÄ¨­
+document.write(POPUP_HTML);
Index: /temp/trunk/html/privacy/index.php
===================================================================
--- /temp/trunk/html/privacy/index.php	(revision 1328)
+++ /temp/trunk/html/privacy/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/privacy/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'privacy/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¸Ä¿Í¾ðÊó¤Î¼è¤ê°·¤¤¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/fax/index.php
===================================================================
--- /temp/trunk/html/fax/index.php	(revision 1328)
+++ /temp/trunk/html/fax/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/fax/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'fax/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'fax';				
+		$this->tpl_title = 'FAXÃíÊ¸¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/preview/index.php
===================================================================
--- /temp/trunk/html/preview/index.php	(revision 1328)
+++ /temp/trunk/html/preview/index.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+
+if ($_SESSION['preview'] === "ON") {
+	// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+	$objPage = sfGetPageLayout($objPage, true);
+	
+	// ²èÌÌ¤ÎÉ½¼¨
+	$objView->assignobj($objPage);
+	$objView->display(SITE_FRAME);
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/trunk/html/mypage/delivery.php
===================================================================
--- /temp/trunk/html/mypage/delivery.php	(revision 1328)
+++ /temp/trunk/html/mypage/delivery.php	(revision 1328)
@@ -0,0 +1,86 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "mypage/delivery.tpl";
+		$this->tpl_css = "/css/layout/mypage/delivery.css";
+		$this->tpl_rightnavi = "frontparts/rightnavi.tpl";
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¤ªÆÏ¤±ÀèÄÉ²Ã¥ÊÑ¹¹";
+		$this->tpl_navi = 'mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'delivery';
+		global $arrPref;
+		$this->arrPref= $arrPref;
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+$objQuery = new SC_Query();
+$objConn = new SC_DBConn();
+
+//¥í¥°¥¤¥óÈ½Äê
+if(!$objCustomer->isLoginSuccess()) {
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//ºï½ü
+if($_POST['mode'] == 'delete') {
+	//ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
+	$flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
+	if($flag > 0) {
+		//ºï½ü
+		$objQuery->delete("dtb_other_deliv", "other_deliv_id=?", array($_POST['other_deliv_id']));
+	} else {
+		sfDispSiteError(CUSTOMER_ERROR);
+	}
+}
+
+$objPage->tpl_pageno = $_POST['pageno'];
+
+$from = "dtb_other_deliv";
+$where = "customer_id=?";
+$arrval = array($objCustomer->getValue('customer_id'));
+$order = "other_deliv_id DESC";
+
+// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+$page_max = SEARCH_PMAX;
+
+//¤ªÆÏ¤±ÀèÅÐÏ¿·ï¿ô¼èÆÀ
+$linemax = $objQuery->count($from, $where, $arrval);
+$objPage->tpl_linemax = $linemax;
+
+// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $page_max, "fnSearchPageNavi", NAVI_PMAX);
+$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+$startno = $objNavi->start_row;
+
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objQuery->setlimitoffset($page_max, $startno);
+// É½¼¨½ç½ø
+$objQuery->setorder($order);
+
+//ÊÌ¤Î¤ªÆÏ¤±Àè¾ðÊóÉ½¼¨
+$objPage->arrOtherDeliv = $objQuery->select("*", $from, $where, $arrval);
+//¤ªÆÏ¤±ÀèÅÐÏ¿¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤ËÅÏ¤¹
+$objPge->deliv_cnt = count($objPage->arrOtherDeliv);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/trunk/html/mypage/change.php
===================================================================
--- /temp/trunk/html/mypage/change.php	(revision 1328)
+++ /temp/trunk/html/mypage/change.php	(revision 1328)
@@ -0,0 +1,335 @@
+<?php
+//¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¦ÉÊ¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡£¡ÊEC¥­¥Ã¥ÈÆ°ºî»î¸³ÍÑ¤Î³«È¯¡Ë
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/mypage/change.css';
+		$this->tpl_mainpage = 'mypage/change.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(ÆþÎÏ¥Ú¡¼¥¸)';
+		$this->tpl_navi = 'mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'change';
+		global $arrReminder;
+		global $arrPref;
+		global $arrJob;
+		global $arrMAILMAGATYPE;
+		global $arrSex;
+		$this->arrReminder = $arrReminder;
+		$this->arrPref = $arrPref;
+		$this->arrJob = $arrJob;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		$this->arrSex = $arrSex;
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();				
+$objView = new SC_SiteView();			
+$objQuery = new SC_Query();             
+$objCustomer = new SC_Customer();
+$objFormParam = new SC_FormParam();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objDate = new SC_Date(1901);
+$objPage->arrYear = $objDate->getYear();	
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR); 
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "email",		"convert" => "a" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+							 array(  "column" => "fax01",		"convert" => "n" ),
+							 array(  "column" => "fax02",		"convert" => "n" ),
+							 array(  "column" => "fax03",		"convert" => "n" ),
+							 array(  "column" => "sex",			"convert" => "n" ),
+							 array(  "column" => "job",			"convert" => "n" ),
+							 array(  "column" => "birth",		"convert" => "n" ),
+							 array(  "column" => "password",	"convert" => "an" ),
+							 array(  "column" => "reminder",	"convert" => "n" ),
+							 array(  "column" => "reminder_answer", "convert" => "aKV" ),
+						);
+
+
+switch ($_POST['mode']){
+	
+case 'confirm':
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	
+	//ÃÂÀ¸ÆüÉÔÀµÊÑ¹¹¤Î¥Á¥§¥Ã¥¯
+	$arrCustomer = lfGetCustomerData();
+	if ($arrCustomer['birth'] != "" && ($objPage->arrForm['year'] != $arrCustomer['year'] || $objPage->arrForm['month'] != $arrCustomer['month'] || $objPage->arrForm['day'] != $arrCustomer['day'])){
+		sfDispSiteError(CUSTOMER_ERROR);
+	}else{
+		//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+		$email_flag = true;
+		//¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÊÑ¹¹¤·¤Æ¤¤¤ë¾ì¹ç¡¢¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ÅÊ£¥Á¥§¥Ã¥¯
+		if ($objPage->arrForm['email'] != $objCustomer->getValue('email')){
+			$email_cnt = $objQuery->count("dtb_customer","delete=0 AND email=?", array($objPage->arrForm['email']));
+			if ($email_cnt > 0){
+				$email_flag = false;
+			}
+		}
+		//¥¨¥é¡¼¤Ê¤·¤Ç¤«¤Ä¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if ($objPage->arrErr == "" && $email_flag == true){
+			//³ÎÇ§¥Ú¡¼¥¸¤Ø
+			$objPage->tpl_mainpage = 'mypage/change_confirm.tpl';
+			$objPage->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(³ÎÇ§¥Ú¡¼¥¸)';
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+		} else {
+			lfFormReturn($objPage->arrForm,$objPage);
+			if ($email_flag == false){
+				$objPage->arrErr['email'].="´û¤Ë»ÈÍÑ¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+			}
+		}
+	}
+	break;
+	
+case 'return':
+	$objPage->arrForm = $_POST;
+	lfFormReturn($objPage->arrForm,$objPage);
+	break;
+	
+case 'complete':
+
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+	$arrForm['email'] = strtolower($arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	//ÃÂÀ¸ÆüÉÔÀµÊÑ¹¹¤Î¥Á¥§¥Ã¥¯
+	$arrCustomer = lfGetCustomerData();
+	if ($arrCustomer['birth'] != "" && ($arrForm['year'] !=  $arrCustomer['year'] || $arrForm['month'] != $arrCustomer['month'] || $arrForm['day'] != $arrCustomer['day'])){
+		sfDispSiteError(CUSTOMER_ERROR);
+	} else {
+		//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+		$email_flag = true;
+		if($objPage->arrForm['email'] != $objCustomer->getValue('email')) {
+			//¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ÅÊ£¥Á¥§¥Ã¥¯
+			$email_cnt = $objQuery->count("dtb_customer","delete=0 AND email=?", array($objPage->arrForm['email']));
+			if ($email_cnt > 0){
+				$email_flag = false;
+			}
+		}
+		//¥¨¥é¡¼¤Ê¤·¤Ç¤«¤Ä¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if($objPage->arrErr == "" && $email_flag) {
+			$arrForm['customer_id'] = $objCustomer->getValue('customer_id');
+			//-- ÊÔ½¸ÅÐÏ¿
+			sfEditCustomerData($arrForm, $arrRegistColumn);
+			//¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾õÂÖ¤Ë¹¹¿·¤¹¤ë
+			$objCustomer->updateSession();
+			//´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: ./change_complete.php");
+			exit;
+		} else {
+			sfDispSiteError(CUSTOMER_ERROR);
+		}
+	}
+	break;
+	
+default:
+	//¸ÜµÒ¾ðÊó¼èÆÀ
+	$objPage->arrForm = lfGetCustomerData();
+	$objPage->arrForm['password'] = DEFAULT_PASSWORD;
+	$objPage->arrForm['password02'] = DEFAULT_PASSWORD;
+	break;
+}
+
+//ÃÂÀ¸Æü¥Ç¡¼¥¿ÅÐÏ¿¤ÎÍ­Ìµ
+$arrCustomer = lfGetCustomerData();
+if ($arrCustomer['birth'] != ""){	
+	$objPage->birth_check = true;
+}
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+//-------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ªÌ¾Á°(À«)", "name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°(Ì¾)", "name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê(¥»¥¤)", "kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê(¥á¥¤)", "kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤´½»½ê1", "addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤´½»½ê2", "addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÅÅÏÃÈÖ¹æ1", "tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¤ªÅÅÏÃÈÖ¹æ2", "tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¤ªÅÅÏÃÈÖ¹æ3", "tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+}
+											
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK","NO_SPTAB" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¤´¿¦¶È", "job") ,array("NUM_CHECK"));
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", '¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)', 'password', 'password02'), array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¥ê¥Þ¥¤¥ó¥À¡¼ ¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¥ê¥Þ¥¤¥ó¥À¡¼ Åú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag") ,array("SELECT_CHECK", "NUM_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//¸ÜµÒ¾ðÊó¤Î¼èÆÀ
+function lfGetCustomerData(){
+	global $objQuery;
+	global $objCustomer;
+	//¸ÜµÒ¾ðÊó¼èÆÀ
+	$ret = $objQuery->select("*","dtb_customer","customer_id=?", array($objCustomer->getValue('customer_id')));
+	$arrForm = $ret[0];
+
+	//¥á¥ë¥Þ¥¬¥Õ¥é¥°¼èÆÀ
+	$arrForm['mail_flag'] = $objQuery->get("dtb_customer_mail","mail_flag","email=?", array($objCustomer->getValue('email')));
+	
+	//ÃÂÀ¸Æü¤ÎÇ¯·îÆü¼èÆÀ
+	if (isset($arrForm['birth'])){
+		$arrDate = sfDispDBDate($arrForm['birth'],false);
+		list($year, $month, $day) = split("/", $arrDate);
+		
+		$arrForm['year'] = $year;
+		$arrForm['month'] = $month;
+		$arrForm['day'] = $day;
+	}
+	return $arrForm;
+}
+	
+// ÊÔ½¸ÅÐÏ¿
+function lfRegistData($array, $arrRegistColumn) {
+	global $objQuery;
+	global $objCustomer;
+	
+	foreach ($arrRegistColumn as $data) {
+		if ($data["column"] != "password") {
+			if($array[ $data['column'] ] == "") {
+				$arrRegist[ $data['column'] ] = NULL;
+			} else {
+				$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+			}
+		}
+	}
+	if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	} else {
+		$arrRegist["birth"] = NULL;
+	}
+
+	//-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEÊ¸¤ò¹½À®¤·¤Ê¤¤¡Ë
+	if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = crypt($array["password"]);
+	$arrRegist["update_date"] = "NOW()";
+	
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($objCustomer->getValue('customer_id')));
+	$objQuery->commit();
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+//¥¨¥é¡¼¡¢Ìá¤ë»þ¤Ë¥Õ¥©¡¼¥à¤ËÆþÎÏ¾ðÊó¤òÊÖ¤¹
+function lfFormReturn($array,$objPage){
+	foreach($array as $key => $val){
+		switch ($key){
+			case 'password':
+			case 'password02':
+			$objPage->$key = $val;
+			break;
+			default:
+			$array[ $key ] = $val;
+			break;
+		}
+	}
+}
+
+?>
Index: /temp/trunk/html/mypage/login_check.php
===================================================================
--- /temp/trunk/html/mypage/login_check.php	(revision 1328)
+++ /temp/trunk/html/mypage/login_check.php	(revision 1328)
@@ -0,0 +1,56 @@
+<?php
+
+require_once("../require.php");
+
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'login':
+	$objFormParam->toLower('mypage_login_email');
+	$arrErr = $objFormParam->checkError();
+	$arrForm =  $objFormParam->getHashArray();
+	
+	// ¥¯¥Ã¥­¡¼ÊÝÂ¸È½Äê
+	if ($arrForm['mypage_login_memory'] == "1" && $arrForm['mypage_login_email'] != "") {
+		$objCookie->setCookie('login_email', $_POST['mypage_login_email']);
+	} else {
+		$objCookie->setCookie('login_email', '');
+	}
+	if ($count == 0){
+		if($objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'])) {
+			header("Location: ./index.php");
+			exit;
+		} else {
+			$objQuery = new SC_Query;
+			$where = "email = ? AND status = 1 AND delete = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['mypage_login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		}
+	}
+	
+	break;
+
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("µ­²±¤¹¤ë", "mypage_login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "mypage_login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "mypage_login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+?>
Index: /temp/trunk/html/mypage/index.php
===================================================================
--- /temp/trunk/html/mypage/index.php	(revision 1328)
+++ /temp/trunk/html/mypage/index.php	(revision 1328)
@@ -0,0 +1,77 @@
+<?php
+//¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¦ÉÊ¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡£¡ÊEC¥­¥Ã¥ÈÆ°ºî»î¸³ÍÑ¤Î³«È¯¡Ë
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/index.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/¹ØÆþÍúÎò°ìÍ÷';
+		$this->tpl_navi = ROOT_DIR . 'data/Smarty/templates/mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'index';
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();			
+$objQuery = new SC_Query();             
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if(!isset($_SESSION['customer'])) {
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+//¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->tpl_pageno = $_POST['pageno'];
+	
+$col = "order_id, create_date, payment_id, payment_total";
+$from = "dtb_order";
+$where = "delete = 0 AND customer_id=?";
+$arrval = array($objCustomer->getvalue('customer_id'));
+$order = "order_id DESC";
+
+$linemax = $objQuery->count($from, $where, $arrval);
+$objPage->tpl_linemax = $linemax;
+
+// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
+$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+$startno = $objNavi->start_row;
+
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+// É½¼¨½ç½ø
+$objQuery->setorder($order);
+
+//¹ØÆþÍúÎò¤Î¼èÆÀ
+$objPage->arrOrder = $objQuery->select($col, $from, $where, $arrval);
+
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+
+//-------------------------------------------------------------------------------------------------------------------------
+											
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+			$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK"));
+			$objErr->dofunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK"));
+	return $objErr->arrErr;
+}
+				
+?>
Index: /temp/trunk/html/mypage/login.php
===================================================================
--- /temp/trunk/html/mypage/login.php	(revision 1328)
+++ /temp/trunk/html/mypage/login.php	(revision 1328)
@@ -0,0 +1,58 @@
+<?php
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/login.tpl';
+		$this->tpl_css = '/css/layout/mypage/login.css';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸(¥í¥°¥¤¥ó)';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+//SSLURLÈ½Äê
+if (SSLURL_CHECK == 1){
+	$ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
+	if (!ereg("^https://", $non_ssl_url)){
+		sfDispSiteError(URL_ERROR);
+	}
+}
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	header("location: ./index.php");
+} else {
+	// ¥¯¥Ã¥­¡¼È½Äê
+	$objPage->tpl_login_email = $objCookie->getCookie('login_email');
+		if($objPage->tpl_login_email != "") {
+		$objPage->tpl_login_memory = "1";
+	}
+	
+	// POST¤µ¤ì¤Æ¤­¤¿ID¤¬¤¢¤ë¾ì¹ç¤ÏÍ¥Àè¤¹¤ë¡£
+	if($_POST['mypage_login_email'] != "") {
+		$objPage->tpl_login_email = $_POST['mypage_login_email'];
+	}
+}
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+//-------------------------------------------------------------------------------------------------------------------------
+											
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+			$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK"));
+			$objErr->dofunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK"));
+	return $objErr->arrErr;
+}									
+											
+?> 
Index: /temp/trunk/html/mypage/reading.php
===================================================================
--- /temp/trunk/html/mypage/reading.php	(revision 1328)
+++ /temp/trunk/html/mypage/reading.php	(revision 1328)
@@ -0,0 +1,67 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage ="mypage/reading.tpl";
+		$this->tpl_css = '/css/layout/mypage/favorite.css';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸±ÜÍ÷ÍúÎò';
+		$this->tpl_mypageno = 'reading';
+		session_cache_limiter('private-no-expire');
+		$this->tpl_navi = 'mypage/navi.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objQuery = new SC_Query();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+$objSiteInfo = new SC_SiteInfo();
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+// ´ðËÜ¾ðÊó¤Î¼èÆÀ
+$objPage->arrInfo = $objSiteInfo->data;
+
+//ÍúÎò¤Îºï½ü
+if ($_POST['mode'] == 'delete'){
+	$objQuery->delete("dtb_customer_reading","customer_id=? AND reading_product_id=?", array($objCustomer->getValue('customer_id'), $_POST['product_id']));
+}
+
+$objPage->tpl_pageno = $_POST['pageno'];
+
+$select = "customer_id, reading_product_id, A.update_date, name, price02_min, price02_max ";
+$from = "dtb_customer_reading AS A INNER JOIN vw_products_allclass AS B ON reading_product_id = B.product_id";
+//¸ø³«¾¦ÉÊ¤ò¸¡º÷
+$where = "A.customer_id = ? AND status = 1";
+$arrval = array($objCustomer->getValue('customer_id'));
+$order = "A.update_date DESC";
+//É½¼¨½ç½ø
+$objQuery->setorder($order);
+	
+$linemax = $objQuery->count($from, $where, $arrval);
+$objPage->tpl_linemax = $linemax;
+	
+// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
+$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+$startno = $objNavi->start_row;
+	
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+
+//ÍúÎò¾ðÊó¤Î¼èÆÀ
+$objPage->arrForm = $objQuery->select($select, $from, $where, $arrval);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
+
Index: /temp/trunk/html/mypage/refusal_complete.php
===================================================================
--- /temp/trunk/html/mypage/refusal_complete.php	(revision 1328)
+++ /temp/trunk/html/mypage/refusal_complete.php	(revision 1328)
@@ -0,0 +1,36 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "mypage/refusal_complete.tpl";
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(´°Î»¥Ú¡¼¥¸)";
+		$this->tpl_css = '/css/layout/mypage/refusal_complete.css';
+		$this->tpl_navi = 'mypage/navi.tpl';
+		$this->tpl_mypageno = 'refusal';
+		$this->point_disp = false;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objCustomer = new SC_Customer();
+//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+$objPage->CustomerPoint = $objCustomer->getvalue('point');
+
+// ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+$objPage->arrInfo = $arrInfo;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/mypage/change_complete.php
===================================================================
--- /temp/trunk/html/mypage/change_complete.php	(revision 1328)
+++ /temp/trunk/html/mypage/change_complete.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'mypage/change_complete.tpl';
+		$this->tpl_css = '/css/layout/mypage/change_complete.css';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(´°Î»¥Ú¡¼¥¸)';
+		$this->tpl_navi = 'mypage/navi.tpl';
+		$this->tpl_mypageno = 'change';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/mypage/delivery_addr.php
===================================================================
--- /temp/trunk/html/mypage/delivery_addr.php	(revision 1328)
+++ /temp/trunk/html/mypage/delivery_addr.php	(revision 1328)
@@ -0,0 +1,161 @@
+<?php
+
+require_once("../require.php");
+
+session_start();
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "mypage/delivery_addr.tpl";
+		$this->tpl_title = "¿·¤·¤¤¤ªÆÏ¤±Àè¤ÎÄÉ²Ã¥ÊÑ¹¹";
+		global $arrPref;
+		$this->arrPref = $arrPref;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+$objConn = new SC_DBConn();
+$ParentPage = MYPAGE_DELIVADDR_URL;
+
+// GET¤Ç¥Ú¡¼¥¸¤ò»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï»ØÄê¥Ú¡¼¥¸¤ËÌá¤¹
+if (isset($_GET['page'])) {
+	$ParentPage = $_GET['page'];
+}
+$objPage->ParentPage = $ParentPage;
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+if ($_POST['mode'] == ""){
+	$_SESSION['other_deliv_id'] = $_GET['other_deliv_id'];
+}
+
+if ($_GET['other_deliv_id'] != ""){
+	//ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
+	$flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']));
+	if (!$objCustomer->isLoginSuccess() || $flag == 0){
+		sfDispSiteError(CUSTOMER_ERROR);
+	}
+}
+
+//ÊÌ¤Î¤ªÆÏ¤±Àè£Ä£ÂÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+						);
+
+switch ($_POST['mode']){
+	case 'edit':
+		$_POST = lfConvertParam($_POST,$arrRegistColumn);
+		$objPage->arrErr =lfErrorCheck($_POST);
+		if ($objPage->arrErr){
+			foreach ($_POST as $key => $val){
+				$objPage->$key = $val;
+			}
+		}else{
+			//ÊÌ¤Î¤ªÆÏ¤±ÀèÅÐÏ¿¿ô¤Î¼èÆÀ
+			$deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
+			if ($deliv_count < DELIV_ADDR_MAX){
+				lfRegistData($_POST,$arrRegistColumn);
+			}
+			$objPage->tpl_onload = "fnUpdateParent('".$_POST['ParentPage']."'); window.close();";
+		}
+		break;
+}
+
+if ($_GET['other_deliv_id'] != ""){
+	//ÊÌ¤Î¤ªÆÏ¤±Àè¾ðÊó¼èÆÀ
+	$arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id']));
+	$objPage->arrOtherDeliv = $arrOtherDeliv[0];
+}
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+//-------------------------------------------------------------------------------------------------------------
+
+/* ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÀ«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÌ¾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê1¡Ë", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê2¡Ë", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+/* ÅÐÏ¿¼Â¹Ô */
+function lfRegistData($array, $arrRegistColumn) {
+	global $objConn;
+	global $objCustomer;
+	
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+	}
+	
+	$arrRegist['customer_id'] = $objCustomer->getvalue('customer_id');
+	
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	if ($array['other_deliv_id'] != ""){
+	$objConn->autoExecute("dtb_other_deliv", $arrRegist, "other_deliv_id='" .addslashes($array["other_deliv_id"]). "'");
+	}else{
+	$objConn->autoExecute("dtb_other_deliv", $arrRegist);
+	}
+	$objConn->query("COMMIT");
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+?>
Index: /temp/trunk/html/mypage/history.php
===================================================================
--- /temp/trunk/html/mypage/history.php	(revision 1328)
+++ /temp/trunk/html/mypage/history.php	(revision 1328)
@@ -0,0 +1,90 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/history.tpl';
+		$this->tpl_rightnavi = 'frontparts/rightnavi.tpl'; 
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¹ØÆþÍúÎò¾ÜºÙ";
+		$this->tpl_navi = 'mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'index';
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
+$from = "dtb_order";
+$where = "delete = 0 AND customer_id = ? AND order_id = ? ";
+$arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']);
+//DB¤Ë¾ðÊó¤¬¤¢¤ë¤«È½Äê
+$cnt = $objQuery->count($from, $where, $arrval);
+//¥í¥°¥¤¥ó¤·¤Æ¤¤¤Ê¤¤¡¢¤Þ¤¿¤ÏDB¤Ë¾ðÊó¤¬Ìµ¤¤¾ì¹ç
+if (!$objCustomer->isLoginSuccess() || $cnt == 0){
+	sfDispSiteError(CUSTOMER_ERROR);
+} else {
+	//¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+	$objPage->arrDisp = lfGetOrderData($_POST['order_id']);
+	// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+	$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+	// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+	$arrRet = sfGetDelivTime($objPage->arrDisp['payment_id']);
+	$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'time');
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+	$objPage->arrInfo = $arrInfo;
+	
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+	
+}
+
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+//¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderData($order_id) {
+	//¼õÃíÈÖ¹æ¤¬¿ô»ú¤Ç¤¢¤ì¤Ð
+	if(sfIsInt($order_id)) {
+		// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
+		$objQuery = new SC_Query();
+		$col = "order_id, create_date, payment_id, subtotal, tax, use_point, add_point, discount, ";
+		$col .= "deliv_fee, charge, payment_total, deliv_name01, deliv_name02, deliv_kana01, deliv_kana02, ";
+		$col .= "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_time_id, deliv_date ";
+		$from = "dtb_order";
+		$where = "order_id = ?";
+		$arrRet = $objQuery->select($col, $from, $where, array($order_id));
+		$arrOrder = $arrRet[0];
+		// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+		$arrRet = lfGetOrderDetail($order_id);
+		$arrOrderDetail = sfSwapArray($arrRet);
+		$arrData = array_merge($arrOrder, $arrOrderDetail);
+	}
+	return $arrData;
+}
+
+// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderDetail($order_id) {
+	$objQuery = new SC_Query();
+	$col = "product_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
+	$where = "order_id = ?";
+	$objQuery->setorder("classcategory_id1, classcategory_id2");
+	$arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+	return $arrRet;
+}
+
+?>
Index: /temp/trunk/html/mypage/refusal.php
===================================================================
--- /temp/trunk/html/mypage/refusal.php	(revision 1328)
+++ /temp/trunk/html/mypage/refusal.php	(revision 1328)
@@ -0,0 +1,58 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "mypage/refusal.tpl";
+		$this->tpl_css = "/css/layout/mypage/refusal.css";
+		$this->tpl_rightnavi = "frontparts/rightnavi.tpl";
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(ÆþÎÏ¥Ú¡¼¥¸)";
+		$this->tpl_navi = 'mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'refusal';
+		//session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+$objQuery = new SC_Query();
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+switch ($_POST['mode']){
+	case 'confirm':
+	$objPage->tpl_mainpage = 'mypage/refusal_confirm.tpl';
+	$objPage->tpl_css = '/css/layout/mypage/refusal_confirm.css';
+	$objPage->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(³ÎÇ§¥Ú¡¼¥¸)";
+
+	break;
+	
+	case 'complete':
+	//²ñ°÷ºï½ü
+	$objQuery->exec("UPDATE dtb_customer SET delete=1 WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
+	$objQuery->delete("dtb_customer_mail", "email ILIKE ?", array($objCustomer->getValue('email')));
+	$objCustomer->EndSession();
+	//´°Î»¥Ú¡¼¥¸¤Ø
+	header("Location: ./refusal_complete.php");
+	exit;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/aboutshopping/index.php
===================================================================
--- /temp/trunk/html/aboutshopping/index.php	(revision 1328)
+++ /temp/trunk/html/aboutshopping/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/aboutshopping/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'aboutshopping/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'aboutshopping';					// º¸¥Ê¥Ó»ØÄêÍÑ
+		$this->tpl_title = '¤ªÇã¤¤Êª¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/upgrade/index.php
===================================================================
--- /temp/trunk/html/upgrade/index.php	(revision 1328)
+++ /temp/trunk/html/upgrade/index.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+
+require_once("../require.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'upgrade/index.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$con = ftp_connect("localhost");
+$res = ftp_login($con, "osuser", "password");
+if($con != false && $res != false) {
+	//¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É
+	if($_POST['filename'] != "") {
+		
+		$download_file = ROOT_DIR . "data/module/upload/" . $_POST['filename'];
+		
+		if(ftp_get($con, $download_file, $_POST['filename'], FTP_BINARY)) {
+			ftp_quit($con);
+			//¥Õ¥¡¥¤¥ë½êÍ­¼ÔÊÑ¹¹
+			echo "¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£";
+			sfPrintR(exec("tar zxvf " . $download_file . " ./", $arrRes));
+		} else
+			echo '¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£';
+		}
+	}
+	
+	//¥Ç¥£¥ì¥¯¥È¥êÆâ¤ÎÁ´¤Æ¤Î¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+	$arrRet = ftp_nlist($con, ".");
+	$i = 0;
+	//É¬Í×¤Ê¥Õ¥¡¥¤¥ë¾ðÊó¤ò¼èÆÀ
+	foreach($arrRet as $val) {
+		if(!ereg("^\.|^\..", $val)) {
+			$arrFile[$i]['filename'] = $val;
+			$arrFile[$i]['date'] = date("YÇ¯m·îdÆü", ftp_mdtm($con, $val));
+			$arrFile[$i]['filesize'] = number_format(ftp_size($con, $val))."Byte";
+			$i++;
+		}
+	}
+	$objPage->arrFile = $arrFile;
+}
+
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(SITE_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+
+//-------------------------------------------------------------------------------------------------------
+
+
+
+?>
Index: /temp/trunk/html/front/index.php
===================================================================
--- /temp/trunk/html/front/index.php	(revision 1328)
+++ /temp/trunk/html/front/index.php	(revision 1328)
@@ -0,0 +1,496 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../css/main.css" type="text/css" media="all" />
+<link rel="stylesheet" href="../css/layout/product/index.css" type="text/css" media="all" />
+<script type="text/javascript" src="../js/css.js"></script>
+<script type="text/javascript" src="../js/navi.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-</title>
+</head>
+	
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<a name="top" id="top"></a>
+<!--¢§HEADER-->
+<table width="780" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+		<td align="center" background="../img/header/bg.jpg">
+		<table width="778" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td bgcolor="#9f0000" height="3"></td></tr>
+			<tr><td bgcolor="#cc0000" height="5"></td></tr>
+		</table>
+		<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td height="9"></td></tr>
+			<tr>
+				<td width="171"><a href="http://www.tokado.jp/"><img src="../img/header/logo.gif" width="161" height="32" alt="¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°" /></a></td>
+				<td>
+				<table width="284" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td colspan="3"><img src="../img/header/login_top.gif" width="284" height="8" alt="" /></td>
+					</tr>
+					<!--¢§¥í¥°¥¤¥ó¥Õ¥©¡¼¥à¤³¤³¤«¤é-->
+					<form name="form1" id="form1" method="post" action="">
+					<tr>
+						<td background="../img/header/login_left.gif"><img src="../img/_.gif" width="8" height="1" alt="" /></td>
+						<td bgcolor="#eeeeee">
+						<table width="268" cellspacing="0" cellpadding="0" summary=" ">
+							<tr align="center">
+								<td><img src="../img/header/mailaddress.gif" width="62" height="9" alt="¥á¡¼¥ë¥¢¥É¥ì¥¹" /></td>
+								<td><img src="../img/header/password.gif" width="43" height="9" alt="¥Ñ¥¹¥ï¡¼¥É" /></td>
+								<td width="50"><input type="checkbox" name="memory" value="µ­²±" /><img src="../img/header/memory.gif" width="18" height="9" alt="µ­²±" /></td>
+							</tr>
+							<tr align="center">
+								<td><input type="text" name="mailaddress" size="20" class="box20" /></td>
+								<td><input type="password" name="password" size="6" class="box6" /></td>
+								<td><a href="#"><img src="../img/header/login.gif" width="44" height="21" alt="¥í¥°¥¤¥ó" /></a></td>
+							</tr>
+							<!--¢§¥í¥°¥¤¥ó»þ¤ÎÉ½¼¨¤³¤³¤«¤é-->
+							<!--¢¥¥í¥°¥¤¥ó»þ¤ÎÉ½¼¨¤³¤³¤Þ¤Ç-->
+						</table>
+						</td>
+						<td background="../img/header/login_right.gif"><img src="../img/_.gif" width="8" height="1" alt="" /></td>
+					</tr>
+					</form>
+					<!--¢¥¥í¥°¥¤¥ó¥Õ¥©¡¼¥à¤³¤³¤Þ¤Ç-->
+					<tr>
+						<td colspan="3"><img src="../img/header/login_bottom.gif" width="284" height="8" alt="" /></td>
+					</tr>
+				</table>
+				</td>
+				<td>
+				<table width="304" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td align="right" colspan="5" height="38"><img src="../img/header/tel.gif" width="295" height="26" alt="092-947-5575¡¡9:30¡Á17:00 ÅÚ¡¦Æü¡¦½Ëº×ÆüµÙ¤ß" /></td>
+					</tr>
+					<tr align="right">
+						<td><a href="../entry/index.php" onmouseover="chgImg('../img/header/entry_on.gif','entry');" onmouseout="chgImg('../img/header/entry.gif','entry');"><img src="../img/header/entry.gif" width="95" height="20" alt="²ñ°÷ÅÐÏ¿" name="entry" id="entry" /></a><img src="../img/_.gif" width="5" height="1" alt="" /><a href="../contact/index.php" onmouseover="chgImg('../img/header/contact_on.gif','contact');" onmouseout="chgImg('../img/header/contact.gif','contact');"><img src="../img/header/contact.gif" width="95" height="20" alt="¤ªÌä¤¤¹ç¤ï¤»" name="contact" id="contact" /></a><img src="../img/_.gif" width="5" height="1" alt="" /><a href="../cartin/index.php" onmouseover="chgImg('../img/header/cartin_on.gif','cartin');" onmouseout="chgImg('../img/header/cartin.gif','cartin');"><img src="../img/header/cartin.gif" width="95" height="20" alt="¥«¥´¤ÎÃæ¤ò¸«¤ë" name="cartin" id="cartin" /></a></td>
+					</tr>
+				</table>
+				</td>
+			</tr>
+		</table>
+		<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td height="3"></td></tr>
+			<tr>
+				<!--¢§NAVI-->
+				<td><a href="../product/index.php"><img src="../img/header/fashion_on.gif" width="109" height="39" alt="¥Õ¥¡¥Ã¥·¥ç¥ó" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/jewely_on.gif','jewely');" onmouseout="chgImg('../img/header/jewely.gif','jewely');"><img src="../img/header/jewely.gif" width="109" height="39" alt="¥¸¥å¥¨¥ê¡¼" name="jewely" id="jewely" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/electronic_on.gif','electronic');" onmouseout="chgImg('../img/header/electronic.gif','electronic');"><img src="../img/header/electronic.gif" width="109" height="39" alt="²ÈÅÅ" name="electronic" id="electronic" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/pc_on.gif','pc');" onmouseout="chgImg('../img/header/pc.gif','pc');"><img src="../img/header/pc.gif" width="109" height="39" alt="PC¼þÊÕµ¡´ï" name="pc" id="pc" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/beauty_on.gif','beauty');" onmouseout="chgImg('../img/header/beauty.gif','beauty');"><img src="../img/header/beauty.gif" width="109" height="39" alt="ÈþÍÆ·ò¹¯" name="beauty" id="beauty" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/food_on.gif','food');" onmouseout="chgImg('../img/header/food.gif','food');"><img src="../img/header/food.gif" width="106" height="39" alt="¿©ÉÊ" name="food" id="food" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/tv_on.gif','tv');" onmouseout="chgImg('../img/header/tv.gif','tv');"><img src="../img/header/tv.gif" width="109" height="39" alt="TV¥·¥ç¥Ã¥Ô¥ó¥°" name="tv" id="tv" /></a></td>
+				<!--¢¥NAVI-->
+			</tr>
+		</table>
+		<table width="778" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td bgcolor="#666666" height="1"></td></tr>
+			<tr><td bgcolor="#cccccc" height="4"></td></tr>
+		</table>
+		</td>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+	</tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§CONTENTS-->
+<table width="780" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#cccccc" width="1"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+		<td bgcolor="#ffffff" width="9"><img src="../img/_.gif" width="9" height="1" alt="" /></td>
+		<td bgcolor="#ffffff" align="left"> 
+		<!--¢§MAIN CONTENTS-->
+		<!--¥Ñ¥ó¥¯¥º-->
+		<div id="pan"><span class="fs12n"><a href="../index.php">¥È¥Ã¥×¥Ú¡¼¥¸</a>¡ä<span class="redst">¥Õ¥¡¥Ã¥·¥ç¥ó</span></span></div>
+		<!--¥Ñ¥ó¥¯¥º-->
+		<table cellspacing="0" cellpadding="0" summary=" " id="conteiner">
+			<tr><td height="10"></td></tr>
+			<tr valign="top">
+				<!--¢§LEFT CONTENTS-->
+				<td id="left">
+				<div id="free"><a href="#"><img src="../img/left/free.gif" width="170" height="68" alt="ÇÛÁ÷ÎÁÌµÎÁ¡ª" /></a></div>
+				<!--¢§¾¦ÉÊ¸¡º÷-->
+				<table cellspacing="0" cellpadding="0" summary=" " id="search">
+					<tr>
+						<td bgcolor="#0e3192" height="3" colspan="3"></td>
+					</tr>
+					<tr>
+						<td bgcolor="#cccccc" width="1"></td>
+						<td align="center">
+						<table width="168" cellspacing="0" cellpadding="0" summary=" ">
+							<tr>
+								<td><img src="../img/left/search_title.jpg" width="168" height="32" alt="¾¦ÉÊ¸¡º÷" /></td>
+							</tr>
+						</table>
+						<table width="150" cellspacing="0" cellpadding="0" summary=" ">
+							<tr><td height="5"></td></tr>
+							<!--¾¦ÉÊ¸¡º÷¥Õ¥©¡¼¥à-->
+							<form name="form1" id="form1" method="post" action="">
+							<tr>
+								<td align="center"><select name="search">
+								<option value="" selected>¾¦ÉÊ¥«¥Æ¥´¥ê ÁªÂò</option>
+								<option value="¥Õ¥¡¥Ã¥·¥ç¥ó">¥Õ¥¡¥Ã¥·¥ç¥ó</option>
+								<option value="¥¸¥å¥¨¥ê¡¼">¥¸¥å¥¨¥ê¡¼</option>
+								<option value="²ÈÅÅ">²ÈÅÅ</option>
+								<option value="PC¼þÊÕµ¡´ï">PC¼þÊÕµ¡´ï</option>
+								<option value="ÈþÍÆ·ò¹¯">ÈþÍÆ·ò¹¯</option>
+								<option value="¿©ÉÊ">¿©ÉÊ</option>
+								<option value="TV¥·¥ç¥Ã¥Ô¥ó¥°">TV¥·¥ç¥Ã¥Ô¥ó¥°</option>
+								</select></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td align="center"><input type="text" name="mailaddress" size="18" class="box18" /></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td align="center"><a href="#"><img src="../img/left/search_button.gif" width="51" height="22" alt="¸¡º÷" /></a></td>
+							</tr>
+							</form>
+							<!--¾¦ÉÊ¸¡º÷¥Õ¥©¡¼¥à-->
+						</table>
+						</td>
+						<td bgcolor="#cccccc" width="1"></td>
+					</tr>
+					<tr>
+						<td colspan="3"><img src="../img/left/search_bottom.gif" width="170" height="10" alt="" /></td>
+					</tr>
+				</table>
+				<!--¢¥¾¦ÉÊ¸¡º÷-->
+				
+				<!--¢§¥«¥Æ¥´¥ê-->
+				<table cellspacing="0" cellpadding="0" summary=" " id="category">
+					<tr><td height="15"></td></tr>
+					<tr>
+						<td bgcolor="#0e3192" height="3" colspan="3"></td>
+					</tr>
+					<tr>
+						<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+						<td>
+						<table width="168" cellspacing="0" cellpadding="0" summary=" ">
+							<tr>
+								<td><img src="../img/left/category_title.jpg" width="168" height="32" alt="¥«¥Æ¥´¥ê" /></td>
+							</tr>
+						</table>
+						</td>
+						<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+					</tr>
+				</table>
+				<table width="170" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+						<td bgcolor="#ecf5ff"><img src="../img/_.gif" width="9" height="1" alt="" /></td>
+						<td bgcolor="#ecf5ff">
+						<table width="150" cellspacing="0" cellpadding="0" summary=" ">
+							<tr>
+								<td height="12"><img src="../img/_.gif" width="20" height="1" alt="" /></td>
+								<td><img src="../img/_.gif" width="130" height="1" alt="" /></td>
+							</tr>
+							<tr>
+								<td><img src="../img/left/category_icon.gif" width="14" height="11" alt="" /></td>
+								<td class="fs12st"><a href="./list.php" class="link01">¥í¥ì¥Ã¥¯¥¹(31)</a></td>
+							</tr>
+							<tr>
+								<td colspan="2" height="15"><img src="../img/left/category_line.gif" width="150" height="1" alt="" /></td>
+							</tr>
+							<tr>
+								<td><img src="../img/left/category_icon.gif" width="14" height="11" alt="" /></td>
+								<td class="fs12st"><a href="#" class="link01">¥·¥ã¥Í¥ë(12)</a></td>
+							</tr>
+							<tr>
+								<td colspan="2" height="15"><img src="../img/left/category_line.gif" width="150" height="1" alt="" /></td>
+							</tr>
+							<tr>
+								<td><img src="../img/left/category_icon.gif" width="14" height="11" alt="" /></td>
+								<td class="fs12st"><a href="#" class="link01">¥³¡¼¥Á(8)</a></td>
+							</tr>
+							<tr>
+								<td colspan="2" height="15"><img src="../img/left/category_line.gif" width="150" height="1" alt="" /></td>
+							</tr>
+							<tr>
+								<td><img src="../img/left/category_icon.gif" width="14" height="11" alt="" /></td>
+								<td class="fs12st"><a href="#" class="link01">¥ë¥¤¡¦¥ô¥£¥È¥ó(3)</a></td>
+							</tr>
+							<tr>
+								<td colspan="2" height="15"><img src="../img/left/category_line.gif" width="150" height="1" alt="" /></td>
+							</tr>
+							<tr>
+								<td><img src="../img/left/category_icon.gif" width="14" height="11" alt="" /></td>
+								<td class="fs12st"><a href="#" class="link01">¥È¥ê¥¢¡¼¥Ë(11)</a></td>
+							</tr>
+						</table>
+						</td>
+						<td bgcolor="#ecf5ff"><img src="../img/_.gif" width="9" height="1" alt="" /></td>
+						<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+					</tr>
+					<tr>
+						<td colspan="5"><img src="../img/left/category_bottom.gif" width="170" height="10" alt="" /></td>
+					</tr>
+				</table>
+				<!--¢¥¥«¥Æ¥´¥ê-->
+				
+				<!--¢§º¸¥Ê¥Ó-->
+				<table cellspacing="0" cellpadding="0" summary=" " id="navi">
+					<tr><td height="15"></td></tr>
+					<tr>
+						<td><a href="../shopping/index.php" onmouseover="chgImg('../img/left/shopping_on.jpg','shopping');" onmouseout="chgImg('../img/left/shopping.jpg','shopping');"><img src="../img/left/shopping.jpg" width="170" height="29" alt="¤ªÇã¤¤Êª¤Ë¤Ä¤¤¤Æ" name="shopping" id="shopping" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../flow/index.php" onmouseover="chgImg('../img/left/flow_on.jpg','flow');" onmouseout="chgImg('../img/left/flow.jpg','flow');"><img src="../img/left/flow.jpg" width="170" height="30" alt="¤ªÇã¤¤Êª¤ÎÎ®¤ì" name="flow" id="flow" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../faq/index.php" onmouseover="chgImg('../img/left/faq_on.jpg','faq');" onmouseout="chgImg('../img/left/faq.jpg','faq');"><img src="../img/left/faq.jpg" width="170" height="30" alt="¤è¤¯¤¢¤ë¼ÁÌä" name="faq" id="faq" /></a></td>
+					</tr>
+					<tr>
+						// 2006/04/20 KAKINAKA-UPD:¥á¥ë¥Þ¥¬ÅÐÏ¿¤Î¥ê¥ó¥¯Àè¤ò²ñ°÷ÅÐÏ¿¤ËÊÑ¹¹ START
+						//<td><a href="../mailmagazine/index.php" onmouseover="chgImg('../img/left/mailmagazine_on.jpg','mailmagazine');" onmouseout="chgImg('../img/left/mailmagazine.jpg','mailmagazine');"><img src="../img/left/mailmagazine.jpg" width="170" height="30" alt="¥á¥ë¥Þ¥¬ÅÐÏ¿" name="mailmagazine" id="mailmagazine" /></a></td>
+						<td><a href="../entry/kiyaku.php" onmouseover="chgImg('../img/left/mailmagazine_on.jpg','mailmagazine');" onmouseout="chgImg('../img/left/mailmagazine.jpg','mailmagazine');"><img src="../img/left/mailmagazine.jpg" width="170" height="30" alt="¥á¥ë¥Þ¥¬ÅÐÏ¿" name="mailmagazine" id="mailmagazine" /></a></td>
+						// 2006/04/20 KAKINAKA-UPD:¥á¥ë¥Þ¥¬ÅÐÏ¿¤Î¥ê¥ó¥¯Àè¤ò²ñ°÷ÅÐÏ¿¤ËÊÑ¹¹ END
+					</tr>
+					<tr>
+						<td><a href="../point/index.php" onmouseover="chgImg('../img/left/point_on.jpg','point');" onmouseout="chgImg('../img/left/point.jpg','point');"><img src="../img/left/point.jpg" width="170" height="30" alt="¥Ý¥¤¥ó¥ÈÀ©ÅÙ¤Ë¤Ä¤¤¤Æ" name="point" id="point" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../fax/index.php" onmouseover="chgImg('../img/left/fax_on.jpg','fax');" onmouseout="chgImg('../img/left/fax.jpg','fax');"><img src="../img/left/fax.jpg" width="170" height="30" alt="FAXÃíÊ¸¤Ë¤Ä¤¤¤Æ" name="fax" id="fax" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../order/index.php" onmouseover="chgImg('../img/left/order_on.jpg','order');" onmouseout="chgImg('../img/left/order.jpg','order');"><img src="../img/left/order.jpg" width="170" height="30" alt="ÄÌ¿®ÈÎÇäË¡É½µ­" name="order" id="order" /></a></td>
+					</tr>
+				</table>
+				<!--¢¥º¸¥Ê¥Ó-->
+				</td>
+				<!--¢¥LEFT CONTENTS-->
+				
+				<!--¢§RIGHT CONTENTS-->
+				<td id="right">
+				<div id="maintitle"><img src="../img/right_product/title_fashion.jpg" width="570" height="40" alt="¥Õ¥¡¥Ã¥·¥ç¥ó" /></div>
+				<table cellspacing="0" cellpadding="0" summary=" " id="bestone">
+					<!--¢§Çä¤ì¶Ú1-->
+					<tr valign="top">
+						<td id="left"><div id="picture"><a href="./detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy260.jpg" width="260" height="260" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+						<td id="spacer"></td>
+						<td id="right">
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr>
+								<td><img src="../img/right_product/best01.gif" width="129" height="31" alt="Çä¤ì¶ÚBEST1" /></td>
+							</tr>
+							<tr><td height="6"></td></tr>
+						</table>
+						<div id="title"><span class="fs14st"><a href="./detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div>
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À­¤Î¹â¤µ¤«¤é¡¢À¤Âå¤ò±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td><span class="fs10">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß<br />
+								¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td><a href="./detail.php" onmouseover="chgImg('../img/right_product/detail_on.gif','detail01');" onmouseout="chgImg('../img/right_product/detail.gif','detail01');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail01" id="detail01" /></a></td>
+							</tr>
+						</table>
+						</td>
+					</tr>
+					<!--¢¥Çä¤ì¶Ú1-->
+				</table>
+				<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+					<tr>
+						<td height="30"><img src="../img/right_product/best_line.gif" width="277" height="1" alt="" /></td>
+						<td></td>
+						<td><img src="../img/right_product/best_line.gif" width="277" height="1" alt="" /></td>
+					</tr>
+					<tr valign="top">
+						<td id="left">
+						<!--¢§Çä¤ì¶Ú2-->
+						<table cellspacing="0" cellpadding="0" summary=" " id="besttwo">
+							<tr>
+								<td colspan="3"><img src="../img/right_product/best02.gif" width="117" height="19" alt="Çä¤ì¶ÚBEST2" /></td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td id="left"><div id="picture"><a href="./detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+								<td id="spacer"></td>
+								<td id="right"><div id="title"><span class="fs12st"><a href="./detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div></td>
+							</tr>
+							<tr><td height="10"></td></tr>
+							<tr>
+								<td colspan="3" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È2-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À¤Âå¤òÀ­¤Î¹â¤µ¤«¤é¡¢±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><span class="fs10">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß<br />
+								¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><a href="#" onmouseover="chgImg('../img/right_product/detail_on.gif','detail02');" onmouseout="chgImg('../img/right_product/detail.gif','detail02');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail02" id="detail02" /></a></td>
+							</tr>
+						</table>
+						<!--¢¥Çä¤ì¶Ú2-->
+						</td>
+						<td id="spacer"></td>
+						<td id="right">
+						<!--¢§Çä¤ì¶Ú3-->
+						<table cellspacing="0" cellpadding="0" summary=" " id="besttwo">
+							<tr>
+								<td colspan="3"><img src="../img/right_product/best03.gif" width="117" height="19" alt="Çä¤ì¶ÚBEST3" /></td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td id="left"><div id="picture"><a href="./detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+								<td id="spacer"></td>
+								<td id="right"><div id="title"><span class="fs12st"><a href="./detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div></td>
+							</tr>
+							<tr><td height="10"></td></tr>
+							<tr>
+								<td colspan="3" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È2-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À¤Âå¤òÀ­¤Î¹â¤µ¤«¤é¡¢±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><span class="fs10">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß<br />
+								¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><a href="#" onmouseover="chgImg('../img/right_product/detail_on.gif','detail03');" onmouseout="chgImg('../img/right_product/detail.gif','detail03');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail03" id="detail03" /></a></td>
+							</tr>
+						</table>
+						<!--¢¥Çä¤ì¶Ú3-->
+						</td>
+					</tr>
+					<tr>
+						<td height="30"><img src="../img/right_product/best_line.gif" width="277" height="1" alt="" /></td>
+						<td></td>
+						<td><img src="../img/right_product/best_line.gif" width="277" height="1" alt="" /></td>
+					</tr>
+					<tr valign="top">
+						<td id="left">
+						<!--¢§Çä¤ì¶Ú4-->
+						<table cellspacing="0" cellpadding="0" summary=" " id="besttwo">
+							<tr>
+								<td colspan="3"><img src="../img/right_product/best04.gif" width="117" height="19" alt="Çä¤ì¶ÚBEST4" /></td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td id="left"><div id="picture"><a href="./detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+								<td id="spacer"></td>
+								<td id="right"><div id="title"><span class="fs12st"><a href="./detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div></td>
+							</tr>
+							<tr><td height="10"></td></tr>
+							<tr>
+								<td colspan="3" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È2-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À¤Âå¤òÀ­¤Î¹â¤µ¤«¤é¡¢±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><span class="fs10">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß<br />
+								¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><a href="#" onmouseover="chgImg('../img/right_product/detail_on.gif','detail04');" onmouseout="chgImg('../img/right_product/detail.gif','detail04');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail04" id="detail04" /></a></td>
+							</tr>
+						</table>
+						<!--¢¥Çä¤ì¶Ú4-->
+						</td>
+						<td id="spacer"></td>
+						<td id="right">
+						<!--¢§Çä¤ì¶Ú5-->
+						<table cellspacing="0" cellpadding="0" summary=" " id="besttwo">
+							<tr>
+								<td colspan="3"><img src="../img/right_product/best05.gif" width="116" height="19" alt="Çä¤ì¶ÚBEST5" /></td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td id="left"><div id="picture"><a href="./detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+								<td id="spacer"></td>
+								<td id="right"><div id="title"><span class="fs12st"><a href="./detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div></td>
+							</tr>
+							<tr><td height="10"></td></tr>
+							<tr>
+								<td colspan="3" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È2-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À¤Âå¤òÀ­¤Î¹â¤µ¤«¤é¡¢±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><span class="fs10">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß<br />
+								¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td colspan="3"><a href="#" onmouseover="chgImg('../img/right_product/detail_on.gif','detail05');" onmouseout="chgImg('../img/right_product/detail.gif','detail05');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail05" id="detail05" /></a></td>
+							</tr>
+						</table>
+						<!--¢¥Çä¤ì¶Ú5-->
+						</td>
+					</tr>
+				</table>
+				</td>
+				<!--¢¥RIGHT CONTENTS-->
+				
+			</tr>
+		</table>
+		<!--¢¥MAIN CONTENTS-->
+		</td>
+		<td bgcolor="#ffffff" width="10"><img src="../img/_.gif" width="9" height="1" alt="" /></td>
+		<td bgcolor="#cccccc" width="1"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+	</tr>
+</table>
+<!--¢¥CONTENTS-->
+
+<!--¢§FOTTER-->
+<table width="780" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+		<td>
+		<table width="778" cellspacing="0" cellpadding="0" summary=" ">
+			<tr>
+				<td bgcolor="#ffffff" align="center">
+				<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td align="right" height="40"><a href="#top"><img src="../img/fotter/pagetop.gif" width="61" height="8" alt="PAGETOP" /></a></td>
+					</tr>
+				</table>
+				</td>
+			</tr>
+			<tr><td bgcolor="#cccccc" height="1"></td></tr>
+			<tr>
+				<td bgcolor="#eeeeee" align="center">
+				<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td height="38" align="left"><a href="../tokado/index.php" onmouseover="chgImg('../img/fotter/tokado_on.gif','tokado');" onmouseout="chgImg('../img/fotter/tokado.gif','tokado');"><img src="../img/fotter/tokado.gif" width="95" height="11" alt="¥È¡¼¥«Æ²¤Ë¤Ä¤¤¤Æ" name="tokado" id="tokado" /></a><img src="../img/_.gif" width="15" height="1" alt="" /><a href="../movement/index.php" onmouseover="chgImg('../img/fotter/movement_on.gif','movement');" onmouseout="chgImg('../img/fotter/movement.gif','movement');"><img src="../img/fotter/movement.gif" width="97" height="11" alt="Æ°ºî´Ä¶­¤Ë¤Ä¤¤¤Æ" name="movement" id="movement" /></a><img src="../img/_.gif" width="15" height="1" alt="" /><a href="../privacy/index.php" onmouseover="chgImg('../img/fotter/privacy_on.gif','privacy');" onmouseout="chgImg('../img/fotter/privacy.gif','privacy');"><img src="../img/fotter/privacy.gif" width="147" height="11" alt="¸Ä¿Í¾ðÊó¤Î¼è°·¤¤¤Ë¤Ä¤¤¤Æ" name="privacy" id="privacy" /></a></td>
+						<td align="right"><img src="../img/fotter/copyright.gif" width="278" height="10" alt="Copyright (C)2005 TOKADO CO.,LTD. All Rights Reserved." /></td>
+					</tr>
+				</table>
+				</td>
+			</tr>
+			<tr><td bgcolor="#cc0000" height="5"></td></tr>
+			<tr><td bgcolor="#9f0000" height="3"></td></tr>
+		</table>
+		</td>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+	</tr>
+	<tr><td bgcolor="#cccccc" height="1"></td></tr>
+	<tr><td height="20"></td></tr>
+</table>
+<!--¢¥FOTTER-->
+</div>
+
+</body>
+</html>
Index: /temp/trunk/html/front/format.php
===================================================================
--- /temp/trunk/html/front/format.php	(revision 1328)
+++ /temp/trunk/html/front/format.php	(revision 1328)
@@ -0,0 +1,22 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/product/detail.css';			// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'front/detail.tpl';					// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_search_products = 'frontparts/leftnavi.tpl';		// ¾¦ÉÊ¸¡º÷¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_category = 'frontparts/category.tpl';			// ¥«¥Æ¥´¥ê¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_leftnavi = 'frontparts/leftnavi.tpl';			// º¸¥Ê¥Ó		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/front/detail_image.php
===================================================================
--- /temp/trunk/html/front/detail_image.php	(revision 1328)
+++ /temp/trunk/html/front/detail_image.php	(revision 1328)
@@ -0,0 +1,32 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<link rel="stylesheet" href="../css/contents.css" type="text/css" />
+<script type="text/javascript">
+<!--
+self.moveTo(20,20);self.focus();
+//-->
+</script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-</title>
+</head>
+
+<body>
+
+<div align="center">
+<!--¢§CONTENTS-->
+<table width="100%" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#c2c2c2" height="5"></td></tr>
+	<tr><td bgcolor="#cc0000" height="4"></td></tr>
+	<tr>
+		<td align="center" height="520"><img src="../img/right_product/dummy500.jpg" width="500" height="500" alt="¡û¡û¡û¡û¡û" /></td>
+	</tr>
+	<tr><td bgcolor="#cc0000" height="5"></td></tr>
+</table>
+<!--¢¥CONTENTS-->
+</div>
+
+</body>
+</html>
Index: /temp/trunk/html/front/search.php
===================================================================
--- /temp/trunk/html/front/search.php	(revision 1328)
+++ /temp/trunk/html/front/search.php	(revision 1328)
@@ -0,0 +1,388 @@
+<!--¡¡-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../css/main.css" type="text/css" media="all" />
+<link rel="stylesheet" href="../css/layout/search/index.css" type="text/css" media="all" />
+<script type="text/javascript" src="../js/css.js"></script>
+<script type="text/javascript" src="../js/navi.js"></script>
+<title>-¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°-¸¡º÷·ë²Ì</title>
+</head>
+
+<body onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<a name="top" id="top"></a>
+<!--¢§HEADER-->
+<table width="780" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+		<td align="center" background="../img/header/bg.jpg">
+		<table width="778" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td bgcolor="#9f0000" height="3"></td></tr>
+			<tr><td bgcolor="#cc0000" height="5"></td></tr>
+		</table>
+		<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td height="9"></td></tr>
+			<tr>
+				<td width="171"><a href="http://www.tokado.jp/"><img src="../img/header/logo.gif" width="161" height="32" alt="¥È¡¼¥«Æ²¡¡¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°" /></a></td>
+				<td>
+				<table width="284" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td colspan="3"><img src="../img/header/login_top.gif" width="284" height="8" alt="" /></td>
+					</tr>
+					<!--¢§¥í¥°¥¤¥ó¥Õ¥©¡¼¥à¤³¤³¤«¤é-->
+					<form name="form1" id="form1" method="post" action="">
+					<tr>
+						<td background="../img/header/login_left.gif"><img src="../img/_.gif" width="8" height="1" alt="" /></td>
+						<td bgcolor="#eeeeee">
+						<table width="268" cellspacing="0" cellpadding="0" summary=" ">
+							<tr align="center">
+								<td><img src="../img/header/mailaddress.gif" width="62" height="9" alt="¥á¡¼¥ë¥¢¥É¥ì¥¹" /></td>
+								<td><img src="../img/header/password.gif" width="43" height="9" alt="¥Ñ¥¹¥ï¡¼¥É" /></td>
+								<td width="50"><input type="checkbox" name="memory" value="µ­²±" /><img src="../img/header/memory.gif" width="18" height="9" alt="µ­²±" /></td>
+							</tr>
+							<tr align="center">
+								<td><input type="text" name="mailaddress" size="20" class="box20" /></td>
+								<td><input type="password" name="password" size="6" class="box6" /></td>
+								<td><a href="#"><img src="../img/header/login.gif" width="44" height="21" alt="¥í¥°¥¤¥ó" /></a></td>
+							</tr>
+							<!--¢§¥í¥°¥¤¥ó»þ¤ÎÉ½¼¨¤³¤³¤«¤é-->
+							<!--¢¥¥í¥°¥¤¥ó»þ¤ÎÉ½¼¨¤³¤³¤Þ¤Ç-->
+						</table>
+						</td>
+						<td background="../img/header/login_right.gif"><img src="../img/_.gif" width="8" height="1" alt="" /></td>
+					</tr>
+					</form>
+					<!--¢¥¥í¥°¥¤¥ó¥Õ¥©¡¼¥à¤³¤³¤Þ¤Ç-->
+					<tr>
+						<td colspan="3"><img src="../img/header/login_bottom.gif" width="284" height="8" alt="" /></td>
+					</tr>
+				</table>
+				</td>
+				<td>
+				<table width="304" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td align="right" colspan="5" height="38"><img src="../img/header/tel.gif" width="295" height="26" alt="092-947-5575¡¡9:30¡Á17:00 ÅÚ¡¦Æü¡¦½Ëº×ÆüµÙ¤ß" /></td>
+					</tr>
+					<tr align="right">
+						<td><a href="../entry/index.php" onmouseover="chgImg('../img/header/entry_on.gif','entry');" onmouseout="chgImg('../img/header/entry.gif','entry');"><img src="../img/header/entry.gif" width="95" height="20" alt="²ñ°÷ÅÐÏ¿" name="entry" id="entry" /></a><img src="../img/_.gif" width="5" height="1" alt="" /><a href="../contact/index.php" onmouseover="chgImg('../img/header/contact_on.gif','contact');" onmouseout="chgImg('../img/header/contact.gif','contact');"><img src="../img/header/contact.gif" width="95" height="20" alt="¤ªÌä¤¤¹ç¤ï¤»" name="contact" id="contact" /></a><img src="../img/_.gif" width="5" height="1" alt="" /><a href="../cartin/index.php" onmouseover="chgImg('../img/header/cartin_on.gif','cartin');" onmouseout="chgImg('../img/header/cartin.gif','cartin');"><img src="../img/header/cartin.gif" width="95" height="20" alt="¥«¥´¤ÎÃæ¤ò¸«¤ë" name="cartin" id="cartin" /></a></td>
+					</tr>
+				</table>
+				</td>
+			</tr>
+		</table>
+		<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td height="3"></td></tr>
+			<tr>
+				<!--¢§NAVI-->
+				<td><a href="../product/index.php" onmouseover="chgImg('../img/header/fashion_on.gif','fashion');" onmouseout="chgImg('../img/header/fashion.gif','fashion');"><img src="../img/header/fashion.gif" width="109" height="39" alt="¥Õ¥¡¥Ã¥·¥ç¥ó" name="fashion" id="fashion" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/jewely_on.gif','jewely');" onmouseout="chgImg('../img/header/jewely.gif','jewely');"><img src="../img/header/jewely.gif" width="109" height="39" alt="¥¸¥å¥¨¥ê¡¼" name="jewely" id="jewely" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/electronic_on.gif','electronic');" onmouseout="chgImg('../img/header/electronic.gif','electronic');"><img src="../img/header/electronic.gif" width="109" height="39" alt="²ÈÅÅ" name="electronic" id="electronic" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/pc_on.gif','pc');" onmouseout="chgImg('../img/header/pc.gif','pc');"><img src="../img/header/pc.gif" width="109" height="39" alt="PC¼þÊÕµ¡´ï" name="pc" id="pc" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/beauty_on.gif','beauty');" onmouseout="chgImg('../img/header/beauty.gif','beauty');"><img src="../img/header/beauty.gif" width="109" height="39" alt="ÈþÍÆ·ò¹¯" name="beauty" id="beauty" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/food_on.gif','food');" onmouseout="chgImg('../img/header/food.gif','food');"><img src="../img/header/food.gif" width="106" height="39" alt="¿©ÉÊ" name="food" id="food" /></a></td>
+				<td><a href="#" onmouseover="chgImg('../img/header/tv_on.gif','tv');" onmouseout="chgImg('../img/header/tv.gif','tv');"><img src="../img/header/tv.gif" width="109" height="39" alt="TV¥·¥ç¥Ã¥Ô¥ó¥°" name="tv" id="tv" /></a></td>
+				<!--¢¥NAVI-->
+			</tr>
+		</table>
+		<table width="778" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td bgcolor="#666666" height="1"></td></tr>
+			<tr><td bgcolor="#cccccc" height="4"></td></tr>
+		</table>
+		</td>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+	</tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§CONTENTS-->
+<table width="780" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+		<td bgcolor="#ffffff"><img src="../img/_.gif" width="9" height="1" alt="" /></td>
+		<td bgcolor="#ffffff" align="left">
+		<!--¢§MAIN CONTENTS-->
+		<!--¥Ñ¥ó¥¯¥º-->
+		<div id="pan"><span class="fs12n"><a href="../index.php">¥È¥Ã¥×¥Ú¡¼¥¸</a>¡ä<span class="redst">¸¡º÷·ë²Ì</span></span></div>
+		<!--¥Ñ¥ó¥¯¥º-->
+		<table cellspacing="0" cellpadding="0" summary=" " id="container">
+			<tr><td height="10"></td></tr>
+			<tr valign="top">
+				<!--¢§LEFT CONTENTS-->
+				<td id="left">
+				<div id="free"><a href="#"><img src="../img/left/free.gif" width="170" height="68" alt="ÇÛÁ÷ÎÁÌµÎÁ¡ª" /></a></div>
+				<!--¢§¾¦ÉÊ¸¡º÷-->
+				<table cellspacing="0" cellpadding="0" summary=" " id="search">
+					<tr>
+						<td bgcolor="#0e3192" height="3" colspan="3"></td>
+					</tr>
+					<tr>
+						<td bgcolor="#cccccc" width="1"></td>
+						<td align="center">
+						<table width="168" cellspacing="0" cellpadding="0" summary=" ">
+							<tr>
+								<td><img src="../img/left/search_title.jpg" width="168" height="32" alt="¾¦ÉÊ¸¡º÷" /></td>
+							</tr>
+						</table>
+						<table width="150" cellspacing="0" cellpadding="0" summary=" ">
+							<tr><td height="5"></td></tr>
+							<!--¾¦ÉÊ¸¡º÷¥Õ¥©¡¼¥à-->
+							<form name="form1" id="form1" method="post" action="">
+							<tr>
+								<td align="center"><select name="search">
+								<option value="" selected>¾¦ÉÊ¥«¥Æ¥´¥ê ÁªÂò</option>
+								<option value="¥Õ¥¡¥Ã¥·¥ç¥ó">¥Õ¥¡¥Ã¥·¥ç¥ó</option>
+								<option value="¥¸¥å¥¨¥ê¡¼">¥¸¥å¥¨¥ê¡¼</option>
+								<option value="²ÈÅÅ">²ÈÅÅ</option>
+								<option value="PC¼þÊÕµ¡´ï">PC¼þÊÕµ¡´ï</option>
+								<option value="ÈþÍÆ·ò¹¯">ÈþÍÆ·ò¹¯</option>
+								<option value="¿©ÉÊ">¿©ÉÊ</option>
+								<option value="TV¥·¥ç¥Ã¥Ô¥ó¥°">TV¥·¥ç¥Ã¥Ô¥ó¥°</option>
+								</select></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td align="center"><input type="text" name="mailaddress" size="18" class="box18" /></td>
+							</tr>
+							<tr><td height="5"></td></tr>
+							<tr>
+								<td align="center"><a href="#"><img src="../img/left/search_button.gif" width="51" height="22" alt="¸¡º÷" /></a></td>
+							</tr>
+							</form>
+							<!--¾¦ÉÊ¸¡º÷¥Õ¥©¡¼¥à-->
+						</table>
+						</td>
+						<td bgcolor="#cccccc" width="1"></td>
+					</tr>
+					<tr>
+						<td colspan="3"><img src="../img/left/search_bottom.gif" width="170" height="10" alt="" /></td>
+					</tr>
+				</table>
+				<!--¢¥¾¦ÉÊ¸¡º÷-->
+	
+				<!--¢§º¸¥Ê¥Ó-->
+				<table cellspacing="0" cellpadding="0" summary=" " id="navi">
+					<tr><td height="15"></td></tr>
+					<tr>
+						<td><a href="../shopping/index.php" onmouseover="chgImg('../img/left/shopping_on.jpg','shopping');" onmouseout="chgImg('../img/left/shopping.jpg','shopping');"><img src="../img/left/shopping.jpg" width="170" height="29" alt="¤ªÇã¤¤Êª¤Ë¤Ä¤¤¤Æ" name="shopping" id="shopping" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../flow/index.php" onmouseover="chgImg('../img/left/flow_on.jpg','flow');" onmouseout="chgImg('../img/left/flow.jpg','flow');"><img src="../img/left/flow.jpg" width="170" height="30" alt="¤ªÇã¤¤Êª¤ÎÎ®¤ì" name="flow" id="flow" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../faq/index.php" onmouseover="chgImg('../img/left/faq_on.jpg','faq');" onmouseout="chgImg('../img/left/faq.jpg','faq');"><img src="../img/left/faq.jpg" width="170" height="30" alt="¤è¤¯¤¢¤ë¼ÁÌä" name="faq" id="faq" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../mailmagazine/index.php" onmouseover="chgImg('../img/left/mailmagazine_on.jpg','mailmagazine');" onmouseout="chgImg('../img/left/mailmagazine.jpg','mailmagazine');"><img src="../img/left/mailmagazine.jpg" width="170" height="30" alt="¥á¥ë¥Þ¥¬ÅÐÏ¿" name="mailmagazine" id="mailmagazine" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../point/index.php" onmouseover="chgImg('../img/left/point_on.jpg','point');" onmouseout="chgImg('../img/left/point.jpg','point');"><img src="../img/left/point.jpg" width="170" height="30" alt="¥Ý¥¤¥ó¥ÈÀ©ÅÙ¤Ë¤Ä¤¤¤Æ" name="point" id="point" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../fax/index.php" onmouseover="chgImg('../img/left/fax_on.jpg','fax');" onmouseout="chgImg('../img/left/fax.jpg','fax');"><img src="../img/left/fax.jpg" width="170" height="30" alt="FAXÃíÊ¸¤Ë¤Ä¤¤¤Æ" name="fax" id="fax" /></a></td>
+					</tr>
+					<tr>
+						<td><a href="../order/index.php" onmouseover="chgImg('../img/left/order_on.jpg','order');" onmouseout="chgImg('../img/left/order.jpg','order');"><img src="../img/left/order.jpg" width="170" height="30" alt="ÄÌ¿®ÈÎÇäË¡É½µ­" name="order" id="order" /></a></td>
+					</tr>
+				</table>
+				<!--¢¥º¸¥Ê¥Ó-->
+				</td>
+				<!--¢¥LEFT CONTENTS-->
+				
+				<!--¢§RIGHT CONTENTS-->
+				<td id="right">
+				<div id="maintitle"><img src="../img/right_search/title.jpg" width="570" height="40" alt="¸¡º÷·ë²Ì" /></div>
+				<div id="hit"><span class="red12st">¡Ö¥¸¥å¥¨¥ê¡¼¡×¡Ö¤¢¤¢¤¢¤¢¡×</span><span class="fs12">¤Î¸¡º÷·ë²Ì¤Ë</span><span class="red12st">15</span><span class="fs12">·ï¤¬³ºÅö¤·¤Þ¤·¤¿</span></div>
+				<div id="page"><span class="red12st">1</span><span class="fs12">¡Ã<a href="#">2</a>¡Ã<a href="#">3</a></span></div>
+				<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+					<!--¾¦ÉÊ1¤³¤³¤«¤é-->
+					<tr valign="top">
+						<td id="left"><div id="picture"><a href="../product/detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+						<td id="spacer"></td>
+						<td id="right"><div id="title"><span class="fs14st"><a href="../product/detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div>
+						<!--¥¢¥¤¥³¥ó-->
+						<img src="../img/right_product/icon01.gif" width="60" height="17" alt="NEW" id="icon" /><img src="../img/right_product/icon02.gif" width="60" height="17" alt="»Ä¤ê¤ï¤º¤«" id="icon" /><img src="../img/right_product/icon03.gif" width="60" height="17" alt="¥Ý¥¤¥ó¥È2ÇÜ" id="icon" /><img src="../img/right_product/icon04.gif" width="60" height="17" alt="¥ª¥¹¥¹¥á" id="icon" /><img src="../img/right_product/icon05.gif" width="60" height="17" alt="¸ÂÄêÉÊ" id="icon" />
+						<!--¥¢¥¤¥³¥ó-->
+						
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td colspan="2" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À­¤Î¹â¤µ¤«¤é¡¢À¤Âå¤ò±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td><span class="fs12">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß</span><br />
+								<span class="fs12">¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+								<td align="right"><a href="../product/detail.php" onmouseover="chgImg('../img/right_product/detail_on.gif','detail01');" onmouseout="chgImg('../img/right_product/detail.gif','detail01');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail01" id="detail01" /></a></td>
+							</tr>
+						</table>
+						</td>
+					</tr>
+					<tr><td height="25"></td></tr>
+					<!--¾¦ÉÊ1¤³¤³¤Þ¤Ç-->
+					<!--¾¦ÉÊ2¤³¤³¤«¤é-->
+					<tr valign="top">
+						<td id="left"><div id="picture"><a href="../product/detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+						<td id="spacer"></td>
+						<td id="right"><div id="title"><span class="fs14st"><a href="../product/detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div>
+						<!--¥¢¥¤¥³¥ó-->
+						<img src="../img/right_product/icon01.gif" width="60" height="17" alt="NEW" id="icon" /><img src="../img/right_product/icon02.gif" width="60" height="17" alt="»Ä¤ê¤ï¤º¤«" id="icon" /><img src="../img/right_product/icon03.gif" width="60" height="17" alt="¥Ý¥¤¥ó¥È2ÇÜ" id="icon" /><img src="../img/right_product/icon04.gif" width="60" height="17" alt="¥ª¥¹¥¹¥á" id="icon" /><img src="../img/right_product/icon05.gif" width="60" height="17" alt="¸ÂÄêÉÊ" id="icon" />
+						<!--¥¢¥¤¥³¥ó-->
+						
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td colspan="2" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À­¤Î¹â¤µ¤«¤é¡¢À¤Âå¤ò±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td><span class="fs12">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß</span><br />
+								<span class="fs12">¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+								<td align="right"><a href="../product/detail.php" onmouseover="chgImg('../img/right_product/detail_on.gif','detail02');" onmouseout="chgImg('../img/right_product/detail.gif','detail02');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail02" id="detail02" /></a></td>
+							</tr>
+						</table>
+						</td>
+					</tr>
+					<tr><td height="25"></td></tr>
+					<!--¾¦ÉÊ2¤³¤³¤Þ¤Ç-->
+					<!--¾¦ÉÊ3¤³¤³¤«¤é-->
+					<tr valign="top">
+						<td id="left"><div id="picture"><a href="../product/detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+						<td id="spacer"></td>
+						<td id="right"><div id="title"><span class="fs14st"><a href="../product/detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div>
+						<!--¥¢¥¤¥³¥ó-->
+						<img src="../img/right_product/icon01.gif" width="60" height="17" alt="NEW" id="icon" /><img src="../img/right_product/icon02.gif" width="60" height="17" alt="»Ä¤ê¤ï¤º¤«" id="icon" /><img src="../img/right_product/icon03.gif" width="60" height="17" alt="¥Ý¥¤¥ó¥È2ÇÜ" id="icon" /><img src="../img/right_product/icon04.gif" width="60" height="17" alt="¥ª¥¹¥¹¥á" id="icon" /><img src="../img/right_product/icon05.gif" width="60" height="17" alt="¸ÂÄêÉÊ" id="icon" />
+						<!--¥¢¥¤¥³¥ó-->
+						
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td colspan="2" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À­¤Î¹â¤µ¤«¤é¡¢À¤Âå¤ò±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td><span class="fs12">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß</span><br />
+								<span class="fs12">¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+								<td align="right"><a href="../product/detail.php" onmouseover="chgImg('../img/right_product/detail_on.gif','detail03');" onmouseout="chgImg('../img/right_product/detail.gif','detail03');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail03" id="detail03" /></a></td>
+							</tr>
+						</table>
+						</td>
+					</tr>
+					<tr><td height="25"></td></tr>
+					<!--¾¦ÉÊ3¤³¤³¤Þ¤Ç-->
+					<!--¾¦ÉÊ4¤³¤³¤«¤é-->
+					<tr valign="top">
+						<td id="left"><div id="picture"><a href="../product/detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+						<td id="spacer"></td>
+						<td id="right"><div id="title"><span class="fs14st"><a href="../product/detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div>
+						<!--¥¢¥¤¥³¥ó-->
+						<img src="../img/right_product/icon01.gif" width="60" height="17" alt="NEW" id="icon" /><img src="../img/right_product/icon02.gif" width="60" height="17" alt="»Ä¤ê¤ï¤º¤«" id="icon" /><img src="../img/right_product/icon03.gif" width="60" height="17" alt="¥Ý¥¤¥ó¥È2ÇÜ" id="icon" /><img src="../img/right_product/icon04.gif" width="60" height="17" alt="¥ª¥¹¥¹¥á" id="icon" /><img src="../img/right_product/icon05.gif" width="60" height="17" alt="¸ÂÄêÉÊ" id="icon" />
+						<!--¥¢¥¤¥³¥ó-->
+						
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td colspan="2" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À­¤Î¹â¤µ¤«¤é¡¢À¤Âå¤ò±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td><span class="fs12">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß</span><br />
+								<span class="fs12">¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+								<td align="right"><a href="../product/detail.php" onmouseover="chgImg('../img/right_product/detail_on.gif','detail04');" onmouseout="chgImg('../img/right_product/detail.gif','detail04');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail04" id="detail04" /></a></td>
+							</tr>
+						</table>
+						</td>
+					</tr>
+					<tr><td height="25"></td></tr>
+					<!--¾¦ÉÊ4¤³¤³¤Þ¤Ç-->
+					<!--¾¦ÉÊ5¤³¤³¤«¤é-->
+					<tr valign="top">
+						<td id="left"><div id="picture"><a href="../product/detail.php"><!--¾¦ÉÊ¼Ì¿¿--><img src="../img/right_product/dummy130.jpg" width="130" height="130" alt="¡û¡û¡û¡û¡û" /></a></div></td>
+						<td id="spacer"></td>
+						<td id="right"><div id="title"><span class="fs14st"><a href="../product/detail.php"><!--¾¦ÉÊÌ¾-->¥ª¥¤¥¹¥¿¡¼¥Ð¡¼¥Ù¥Á¥å¥¢¥ë¥¨¥¯¥¹¥×¥í¡¼¥é¡¼£±</a></span></div>
+						<!--¥¢¥¤¥³¥ó-->
+						<img src="../img/right_product/icon01.gif" width="60" height="17" alt="NEW" id="icon" /><img src="../img/right_product/icon02.gif" width="60" height="17" alt="»Ä¤ê¤ï¤º¤«" id="icon" /><img src="../img/right_product/icon03.gif" width="60" height="17" alt="¥Ý¥¤¥ó¥È2ÇÜ" id="icon" /><img src="../img/right_product/icon04.gif" width="60" height="17" alt="¥ª¥¹¥¹¥á" id="icon" /><img src="../img/right_product/icon05.gif" width="60" height="17" alt="¸ÂÄêÉÊ" id="icon" />
+						<!--¥¢¥¤¥³¥ó-->
+						
+						<table cellspacing="0" cellpadding="0" summary=" " id="contents">
+							<tr><td height="6"></td></tr>
+							<tr>
+								<td colspan="2" class="fs12"><!--°ìÍ÷¥á¥¤¥ó¥³¥á¥ó¥È-->¥·¥ó¥×¥ë¤ò¶Ë¤áÈþ¤·¤µ¤¹¤é´¶¤¸¤ë¥Ç¥¶¥¤¥ó¡¢¶Ë¤á¤Æ¹â¤¤»ëÇ§À­¤Î¹â¤µ¤«¤é¡¢À¤Âå¤ò±Û¤¨¤ÆÀäÂç¤Ê¿Íµ¤¤ò¸Ø¤Ã¤Æ¤¤¤ë¥â¥Ç¥ë¤Ç¤¹¡£</td>
+							</tr>
+							<tr><td height="6"></td></tr>
+							<tr valign="top">
+								<td><span class="fs12">¥È¡¼¥«Æ²²Á³Ê¡§</span><span class="red12st">27,800±ß</span><span class="red10">¡ÊÀÇ¹þ¡Ë</span><br />
+								<span class="fs10">»²¹Í»Ô¾ì²Á³Ê¡§460,000±ß</span><br />
+								<span class="fs12">¥Ý¥¤¥ó¥È¡§</span><span class="red12st">200</span><span class="red10">Pt</span></td>
+								<td align="right"><a href="../product/detail.php" onmouseover="chgImg('../img/right_product/detail_on.gif','detail05');" onmouseout="chgImg('../img/right_product/detail.gif','detail05');"><img src="../img/right_product/detail.gif" width="110" height="22" alt="¾¦ÉÊ¤ò¾Ü¤·¤¯¸«¤ë" name="detail05" id="detail05" /></a></td>
+							</tr>
+						</table>
+						</td>
+					</tr>
+					<tr><td height="25"></td></tr>
+					<!--¾¦ÉÊ5¤³¤³¤Þ¤Ç-->
+				</table>
+				<div id="page"><span class="red12st">1</span><span class="fs12">¡Ã<a href="#">2</a>¡Ã<a href="#">3</a></span></div>
+				<!--¢¥RIGHT CONTENTS-->
+			</tr>
+		</table>
+		<!--¢¥MAIN CONTENTS-->
+		</td>
+		<td bgcolor="#ffffff"><img src="../img/_.gif" width="9" height="1" alt="" /></td>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+	</tr>
+</table>
+<!--¢¥CONTENTS-->
+
+<!--¢§FOTTER-->
+<table width="780" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+		<td>
+		<table width="778" cellspacing="0" cellpadding="0" summary=" ">
+			<tr>
+				<td bgcolor="#ffffff" align="center">
+				<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td align="right" height="40"><a href="#top"><img src="../img/fotter/pagetop.gif" width="61" height="8" alt="PAGETOP" /></a></td>
+					</tr>
+				</table>
+				</td>
+			</tr>
+			<tr><td bgcolor="#cccccc" height="1"></td></tr>
+			<tr>
+				<td bgcolor="#eeeeee" align="center">
+				<table width="760" cellspacing="0" cellpadding="0" summary=" ">
+					<tr>
+						<td height="38" align="left"><a href="../tokado/index.php" onmouseover="chgImg('../img/fotter/tokado_on.gif','tokado');" onmouseout="chgImg('../img/fotter/tokado.gif','tokado');"><img src="../img/fotter/tokado.gif" width="95" height="11" alt="¥È¡¼¥«Æ²¤Ë¤Ä¤¤¤Æ" name="tokado" id="tokado" /></a><img src="../img/_.gif" width="15" height="1" alt="" /><a href="../movement/index.php" onmouseover="chgImg('../img/fotter/movement_on.gif','movement');" onmouseout="chgImg('../img/fotter/movement.gif','movement');"><img src="../img/fotter/movement.gif" width="97" height="11" alt="Æ°ºî´Ä¶­¤Ë¤Ä¤¤¤Æ" name="movement" id="movement" /></a><img src="../img/_.gif" width="15" height="1" alt="" /><a href="../privacy/index.php" onmouseover="chgImg('../img/fotter/privacy_on.gif','privacy');" onmouseout="chgImg('../img/fotter/privacy.gif','privacy');"><img src="../img/fotter/privacy.gif" width="147" height="11" alt="¸Ä¿Í¾ðÊó¤Î¼è°·¤¤¤Ë¤Ä¤¤¤Æ" name="privacy" id="privacy" /></a></td>
+						<td align="right"><img src="../img/fotter/copyright.gif" width="278" height="10" alt="Copyright (C)2005 TOKADO CO.,LTD. All Rights Reserved." /></td>
+					</tr>
+				</table>
+				</td>
+			</tr>
+			<tr><td bgcolor="#cc0000" height="5"></td></tr>
+			<tr><td bgcolor="#9f0000" height="3"></td></tr>
+		</table>
+		</td>
+		<td bgcolor="#cccccc"><img src="../img/_.gif" width="1" height="10" alt="" /></td>
+	</tr>
+	<tr><td bgcolor="#cccccc" height="1"></td></tr>
+	<tr><td height="20"></td></tr>
+</table>
+<!--¢¥FOTTER-->
+</div>
+
+</body>
+</html>
Index: /temp/trunk/html/admin/total/index.php
===================================================================
--- /temp/trunk/html/admin/total/index.php	(revision 1328)
+++ /temp/trunk/html/admin/total/index.php	(revision 1328)
@@ -0,0 +1,771 @@
+<?php
+require_once("../require.php");
+require_once("./index_sub.php");
+require_once("../batch/daily.php");
+
+require_once("./class/SC_GraphPie.php");
+require_once("./class/SC_GraphLine.php");
+require_once("./class/SC_GraphBar.php");
+
+class LC_Page {
+	var $arrResults;
+	var $keyname;
+	var $tpl_image;
+	var $arrTitle;
+	function LC_Page() {
+		$this->tpl_mainpage = 'total/index.tpl';
+		$this->tpl_subnavi = 'total/subnavi.tpl';
+		$this->tpl_graphsubtitle = 'total/subtitle.tpl';
+		$this->tpl_titleimage = '/img/title/title_sale.jpg';
+		$this->tpl_mainno = 'total';
+		global $arrWDAY;
+		$this->arrWDAY = $arrWDAY;
+		// ¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+		$this->arrTitle[''] = "´ü´ÖÊÌ½¸·×";
+		$this->arrTitle['term'] = "´ü´ÖÊÌ½¸·×";
+		$this->arrTitle['products'] = "¾¦ÉÊÊÌ½¸·×";
+		$this->arrTitle['age'] = "Ç¯ÂåÊÌ½¸·×";
+		$this->arrTitle['job'] = "¿¦¶ÈÊÌ½¸·×";
+		$this->arrTitle['member'] = "²ñ°÷ÊÌ½¸·×";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ÆþÎÏ´ü´Ö¤ò¥»¥Ã¥·¥ç¥ó¤Ëµ­Ï¿¤¹¤ë
+lfSaveDateSession();
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$objFormParam->setParam($_POST);
+$objFormParam->setParam($_GET);
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrHidden[$key] = $val;		
+	}
+}
+
+switch($_POST['mode']) {
+case 'pdf':
+case 'csv':
+case 'search':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	$arrRet = $objFormParam->getHashArray();
+	
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if (count($objPage->arrErr) == 0) {
+		foreach ($arrRet as $key => $val) {
+			if($val == "") {
+				continue;
+			}
+			switch ($key) {
+			case 'search_startyear':
+				$sdate = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+				break;
+			case 'search_endyear':
+				$edate = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday'], true);
+				break;
+			case 'search_startyear_m':
+				list($sdate, $edate) = sfTermMonth($_POST['search_startyear_m'], $_POST['search_startmonth_m'], CLOSE_DAY);
+				break;
+			default:
+				break;
+			}
+		}
+
+		if($_POST['type'] != "") {
+			$type = $_POST['type'];
+		}
+				
+		$page = $objFormParam->getValue('page');
+		switch($page) {
+		// ¾¦ÉÊÊÌ½¸·×
+		case 'products':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_products.tpl";
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderProducts($type, $sdate, $edate, $objPage);
+			break;
+		// ¿¦¶ÈÊÌ½¸·×
+		case 'job':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_job.tpl";
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderJob($type, $sdate, $edate, $objPage);
+			break;
+		// ²ñ°÷ÊÌ½¸·×
+		case 'member':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_member.tpl";
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderMember($type, $sdate, $edate, $objPage);
+			break;
+		// Ç¯ÂåÊÌ½¸·×
+		case 'age':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_age.tpl";
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderAge($type, $sdate, $edate, $objPage);
+			break;
+		// ´ü´ÖÊÌ½¸·×
+		default:
+			if($type == "") {
+				$type = 'day';
+			}
+
+			$objPage->tpl_page_type = "total/page_term.tpl";
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderTerm($type, $sdate, $edate, $objPage);
+			
+			break;
+		}
+
+		if($_POST['mode'] == 'csv') {
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤Î¼èÆÀ
+			list($arrTitleCol, $arrDataCol) = lfGetCSVColum($page, $objPage->keyname);
+			$head = sfGetCSVList($arrTitleCol);
+			$data = lfGetDataColCSV($objPage->arrResults, $arrDataCol);
+			// CSV¤òÁ÷¿®¤¹¤ë¡£
+			sfCSVDownload($head.$data, $page."_".$type);
+			exit;
+		}
+		
+		if($_POST['mode'] == 'pdf') {
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤Î¼èÆÀ
+			list($arrTitleCol, $arrDataCol, $arrColSize, $arrAlign, $title) = lfGetPDFColum($page, $type, $objPage->keyname);
+			$head = sfGetPDFList($arrTitleCol);
+			$data = lfGetDataColPDF($objPage->arrResults, $arrDataCol, 40);
+			// PDF½ÐÎÏÍÑ
+			$graph_name = basename($objPage->tpl_image);
+			lfPDFDownload($graph_name, $head . $data, $arrColSize, $arrAlign, $sdate, $edate, $title);
+			exit;	
+		}	
+	}
+	break;
+default:
+	if(count($_GET) == 0) {
+		// 1¥ö·îÊ¬¤Î½¸·×
+		lfStartDailyTotal(31,0);
+	}
+	break;
+}
+
+// ÅÐÏ¿¡¦¹¹¿·Æü¸¡º÷ÍÑ
+$objDate = new SC_Date();
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrYear = $objDate->getYear();
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objPage->tpl_subtitle = $objPage->arrTitle[$objFormParam->getValue('page')];
+
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------
+/* PDF½ÐÎÏ */
+function lfPDFDownload($image, $table, $arrColSize, $arrAlign, $sdate, $edate, $title) {
+	
+	$objPdf = new SC_Pdf();
+	$objPdf->setTableColor("CCCCCC", "F0F0F0", "D1DEFE");
+			
+	// ÅÚÂæ¤È¤Ê¤ëPDF¥Õ¥¡¥¤¥ë¤Î»ØÄê
+	$objPdf->setTemplate(PDF_DIR . "total.pdf");
+
+	$disp_sdate = sfDispDBDate($sdate, false);
+	$disp_edate = sfDispDBDate($edate, false);
+				
+	$arrText['title_block'] = $title;
+	$arrText['date_block'] = "$disp_sdate-$disp_edate";
+	$arrImage['graph_block'] = GRAPH_DIR . $image;
+	
+	// Ê¸Ëö¤Î\n¤òºï½ü¤¹¤ë
+	$table = ereg_replace("\n$", "", $table);
+	$arrRet = split("\n", $table);
+	$page_max = intval((count($arrRet) / 35) + 1);
+	
+	for($page = 1; $page <= $page_max; $page++) {
+		if($page > 1) {
+			// 2¥Ú¡¼¥¸°Ê¹ß
+			$start_no = 35 * ($page - 1) + 1;
+		} else {
+			// ³«»Ï¥Ú¡¼¥¸
+			$start_no = 1;			
+		}
+				
+		$arrText['page_block'] = $page . " / " . $page_max;
+		$objPdf->setTextBlock($arrText);
+		$objPdf->setImageBlock($arrImage);
+		// ¥Ö¥í¥Ã¥¯ÃÍ¤ÎÆþÎÏ
+		$objPdf->writeBlock();
+		// ºÇ½ª¥Ú¡¼¥¸¤Î¤ß¡¢¾¦ÉÊÊÌ½¸·×¤Ï¹ç·×¤¬¤Ê¤¤¤Î¤ÇºÇ½ª¹Ô¤Î¿§¤òÊÑ¹¹¤·¤Ê¤¤¡£
+		if($page == $page_max && $_POST['page'] != 'products') {
+			$last_color_flg = true;
+		} else {
+			$last_color_flg = false;
+		}	
+		$objPdf->writeTableCenter($table, 500, $arrColSize, $arrAlign, 35, $start_no, $last_color_flg);
+		$objPdf->closePage();
+	}
+
+	// PDF¤Î½ÐÎÏ
+	$objPdf->output();	
+}
+
+/* ¥»¥Ã¥·¥ç¥ó¤ËÆþÎÏ´ü´Ö¤òµ­Ï¿¤¹¤ë */
+function lfSaveDateSession() {
+	if($_POST['form'] == 1) {
+		$_SESSION['total']['startyear_m'] = $_POST['search_startyear_m'];
+		$_SESSION['total']['startmonth_m'] = $_POST['search_startmonth_m'];
+	}
+	
+	if($_POST['form'] == 2) {
+		$_SESSION['total']['startyear'] = $_POST['search_startyear'];
+		$_SESSION['total']['startmonth'] = $_POST['search_startmonth'];
+		$_SESSION['total']['startday'] = $_POST['search_startday'];
+		$_SESSION['total']['endyear'] = $_POST['search_endyear'];
+		$_SESSION['total']['endmonth'] = $_POST['search_endmonth'];
+		$_SESSION['total']['endday'] = $_POST['search_endday'];
+	}
+}
+
+/* ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Î¼èÆÀ */
+function lfGetDateDefault() {
+	$year = date("Y");
+	$month = date("m");
+	$day = date("d");
+	
+	$list = $_SESSION['total'];
+	
+	// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤Ë³«»Ï·îÅÙ¤¬ÊÝÂ¸¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+	if($_SESSION['total']['startyear_m'] == "") {
+		$list['startyear_m'] = $year;
+		$list['startmonth_m'] = $month;
+	}
+	
+	// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤Ë³«»ÏÆüÉÕ¡¢½ªÎ»ÆüÉÕ¤¬ÊÝÂ¸¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+	if($_SESSION['total']['startyear'] == "" && $_SESSION['total']['endyear'] == "") {
+		// Åö·î¤ÎËöÆü¤òµá¤á¤ë
+		$last_day = date("d", mktime(0, 0, 0, $month + 1, 0, $year));
+				
+		// 1¥ö·îÁ°¤òµá¤á¤ë
+		$day_sec = 3600 * 24;
+		list($syear, $smonth, $sday) = split("/", date("Y/m/d", (mktime(0, 0, 0, $month, $day, $year) - ($day_sec * $last_day))));
+		$list['startyear'] = $syear;
+		$list['startmonth'] = $smonth;
+		$list['startday'] = $sday;
+		
+		// ½ªÎ»Æü¤Ï¸½ºß¤ÎÆüÉÕ¤Î1ÆüÁ°¡Ê¥Ð¥Ã¥Á½¸·×¤¬Á°Æü¤Þ¤Ç¤Î¤¿¤á¡Ë
+		$list['endmonth'] = $month;
+		$list['endyear'] = $year;
+		$list['endday'] = date("d", (mktime(0, 0, 0, $month, $day, $year) - $day_sec));
+	}
+	
+	return $list;	
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+		
+	// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Î¼èÆÀ
+	$arrList = lfGetDateDefault();
+	
+	// ·îÅÙ½¸·×
+	$objFormParam->addParam("·îÅÙ", "search_startyear_m", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startyear_m']);
+	$objFormParam->addParam("·îÅÙ", "search_startmonth_m", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startmonth_m']);
+	// ´ü´Ö½¸·×
+	$objFormParam->addParam("³«»ÏÆü", "search_startyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startyear']);
+	$objFormParam->addParam("³«»ÏÆü", "search_startmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startmonth']);
+	$objFormParam->addParam("³«»ÏÆü", "search_startday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startday']);
+	$objFormParam->addParam("½ªÎ»Æü", "search_endyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endyear']);
+	$objFormParam->addParam("½ªÎ»Æü", "search_endmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endmonth']);
+	$objFormParam->addParam("½ªÎ»Æü", "search_endday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endday']);
+	
+	// hidden¥Ç¡¼¥¿¤Î¼èÆÀÍÑ
+	$objFormParam->addParam("", "page");
+	$objFormParam->addParam("", "type");
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÆÃ¼ì¹àÌÜ¥Á¥§¥Ã¥¯
+	if($_POST['form'] == 1) {
+		$objErr->doFunc(array("·îÅÙ", "search_startyear_m"), array("ONE_EXIST_CHECK"));
+	}
+	
+	if($_POST['form'] == 2) {
+		$objErr->doFunc(array("´ü´Ö", "search_startyear", "search_endyear"), array("ONE_EXIST_CHECK"));
+	}
+			
+	$objErr->doFunc(array("·îÅÙ", "search_startyear_m", "search_startmonth_m"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+	return $objErr->arrErr;
+}
+
+/* ÀÞ¤ìÀþ¥°¥é¥Õ¤ÎºîÀ® */
+function lfGetGraphLine($arrResults, $keyname, $type, $xtitle, $ytitle) {
+	
+	$ret_path = "";
+	
+	// ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£
+	if(count($arrResults) > 0) {
+		
+		// ¥°¥é¥Õ¤ÎÀ¸À®
+		$arrList = sfArrKeyValue($arrResults, $keyname, "total");
+
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$pngname = lfGetGraphPng($type);
+		
+		$path = GRAPH_DIR . $pngname;
+		
+		// ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë
+		if(!file_exists($path)) {
+						
+			// ¥é¥Ù¥ëÉ½¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤òµá¤á¤ë
+			$interval = intval(count($arrList) / 20);
+			if($interval < 1) {
+				$interval = 1;
+			}
+			$objGraphPie = new SC_GraphPie();
+			$objGraphLine = new SC_GraphLine();
+			
+			// ÃÍ¤Î¥»¥Ã¥È
+			$objGraphLine->setData($arrList);
+			$objGraphLine->setXLabel(array_keys($arrList));
+			
+			// ¥é¥Ù¥ë²óÅ¾(ÆüËÜ¸ìÉÔ²Ä)
+			if($keyname == "key_day"){
+				$objGraphLine->setXLabelAngle(-45);
+			}
+
+			// ¥¿¥¤¥È¥ë¥»¥Ã¥È
+			$objGraphLine->setXTitle($xtitle);
+			$objGraphLine->setYTitle($ytitle);
+			
+			// ¥°¥é¥ÕÉÁ²è
+			$objGraphLine->drawGraph();
+			$objGraphLine->outputGraph(false, $path);
+		}
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$ret_path = GRAPH_URL . $pngname;
+	}
+	return $ret_path;
+}
+
+// ±ß¥°¥é¥Õ¤ÎºîÀ® 
+function lfGetGraphPie($arrResults, $keyname, $type, $title = "") {
+	
+	$ret_path = "";
+	
+	// ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£
+	if(count($arrResults) > 0) {
+		// ¥°¥é¥Õ¤ÎÀ¸À®
+		$arrList = sfArrKeyValue($arrResults, $keyname, "total", GRAPH_PIE_MAX, GRAPH_LABEL_MAX);
+		
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$pngname = lfGetGraphPng($type);
+		$path = GRAPH_DIR . $pngname;
+		
+		// ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë
+		if(!file_exists($path)) {
+			$objGraphPie = new SC_GraphPie();
+			$objGraphLine = new SC_GraphLine();
+			
+			/* ¥Ç¥Ð¥Ã¥°É½¼¨ÍÑ by naka
+			foreach($arrList as $key => $val) {
+				$objGraphPie->debugPrint("key:$key val:$val");
+			}
+			*/
+			
+			// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+			$objGraphPie->setData($arrList);
+			// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+			$objGraphPie->setLegend(array_keys($arrList));
+		
+			// ±ß¥°¥é¥ÕÉÁ²è
+			$objGraphPie->drawGraph();
+			
+			// ¥°¥é¥Õ¤Î½ÐÎÏ
+			$objGraphPie->outputGraph(false, $path);			
+		}
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$ret_path = GRAPH_URL . $pngname;
+	}
+	return $ret_path;
+}
+
+// ËÀ¥°¥é¥Õ¤ÎºîÀ® 
+function lfGetGraphBar($arrResults, $keyname, $type, $xtitle, $ytitle) {
+	$ret_path = "";
+	
+	// ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£
+	if(count($arrResults) > 0) {
+		// ¥°¥é¥Õ¤ÎÀ¸À®
+		$arrList = sfArrKeyValue($arrResults, $keyname, "total", GRAPH_PIE_MAX, GRAPH_LABEL_MAX);
+		
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$pngname = lfGetGraphPng($type);
+		$path = GRAPH_DIR . $pngname;
+		
+		// ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë
+		if(!file_exists($path)) {
+			$objGraphBar = new SC_GraphBar();
+			
+			// ¥°¥é¥ÕÉÁ²è
+			$objGraphBar->setXLabel(array_keys($arrList));
+			$objGraphBar->setXTitle($xtitle);
+			$objGraphBar->setYTitle($ytitle);
+			$objGraphBar->setData($arrList);
+			$objGraphBar->drawGraph();
+
+			$objGraphBar->outputGraph(false,$path);
+		}
+
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$ret_path = GRAPH_URL . $pngname;
+	}
+	return $ret_path;
+}
+
+// ¥°¥é¥ÕÍÑ¤ÎPNG¥Õ¥¡¥¤¥ëÌ¾ 
+function lfGetGraphPng($keyname) {
+	if($_POST['search_startyear_m'] != "") {
+		$pngname = sprintf("%s_%02d%02d.png", $keyname, substr($_POST['search_startyear_m'],2), $_POST['search_startmonth_m']);
+	} else {
+		$pngname = sprintf("%s_%02d%02d%02d_%02d%02d%02d.png", $keyname, substr($_POST['search_startyear'], 2), $_POST['search_startmonth'], $_POST['search_startday'], substr($_POST['search_endyear'],2), $_POST['search_endmonth'], $_POST['search_endday']);
+	}
+	return $pngname;
+}
+
+// ²ñ°÷¡¢Èó²ñ°÷½¸·×¤ÎWHEREÊ¬¤ÎºîÀ®
+function lfGetWhereMember($col_date, $sdate, $edate, $type, $col_member = "customer_id") {
+	// ¼èÆÀÆüÉÕ¤Î»ØÄê
+	if($sdate != "") {
+		if ($where != "") {
+			$where.= " AND ";
+		}			
+		$where.= " $col_date >= ? ";
+		$arrval[] = $sdate;
+	}
+		
+	if($edate != "") {
+		if ($where != "") {
+			$where.= " AND ";
+		}			
+		$where.= " $col_date <= ? ";
+		$arrval[] = $edate;
+	}
+	
+	// ²ñ°÷¡¢Èó²ñ°÷¤ÎÈ½Äê
+	switch($type) {
+	// Á´ÂÎ
+	case 'all':
+		break;
+	case 'member':
+		if ($where != "") {
+			$where.= " AND ";
+		}
+		$where.= " $col_member <> 0";
+		break;
+	case 'nonmember':
+		if ($where != "") {
+			$where.= " AND ";
+		}
+		$where.= " $col_member = 0";
+		break;
+	default:
+		break;
+	}
+	
+	return array($where, $arrval);
+}
+
+/** ²ñ°÷ÊÌ½¸·× **/
+function lfGetOrderMember($type, $sdate, $edate, $objPage, $graph = true) {
+	global $arrSex;
+		
+	list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type);
+	
+	// ²ñ°÷½¸·×¤Î¼èÆÀ
+	$col = "COUNT(*) AS order_count, SUM(total) AS total, int4(AVG(total)) AS total_average, order_sex";
+	$from = "dtb_order";
+	$objQuery = new SC_Query();
+	$objQuery->setGroupBy("order_sex");
+	
+	$tmp_where = $where . " AND customer_id <> 0 AND delete = 0 ";
+	$arrRet = $objQuery->select($col, $from, $tmp_where, $arrval);
+	
+	// ²ñ°÷¹ØÆþ¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤¹¤ë¡£
+	$max = count($arrRet);
+	for($i = 0; $i < $max; $i++) {
+		$arrRet[$i]['member_name'] = '²ñ°÷'.$arrSex[$arrRet[$i]['order_sex']];
+	}
+	$objPage->arrResults = $arrRet;
+	
+	// Èó²ñ°÷½¸·×¤Î¼èÆÀ
+	$tmp_where = $where . " AND customer_id = 0 AND delete = 0 ";
+	$arrRet = $objQuery->select($col, $from, $tmp_where, $arrval);
+	// Èó²ñ°÷¹ØÆþ¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤¹¤ë¡£
+	$max = count($arrRet);
+	for($i = 0; $i < $max; $i++) {
+		$arrRet[$i]['member_name'] = 'Èó²ñ°÷'.$arrSex[$arrRet[$i]['order_sex']];
+	}
+	
+	$objPage->arrResults = array_merge($objPage->arrResults, $arrRet);
+	
+	// ±ß¥°¥é¥Õ¤ÎÀ¸À®
+	if($graph) {	
+		$image_key = "member";
+		$objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "member_name", $image_key, "(Çä¾åÈæÎ¨)");
+	}
+	
+	return $objPage;
+}
+
+/** ¾¦ÉÊÊÌ½¸·× **/
+function lfGetOrderProducts($type, $sdate, $edate, $objPage, $graph = true) {
+	
+	list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type);
+	
+	$sql = "SELECT product_id, T1.product_code, T2.name, T1.products_count, T1.order_count, T1.price, T1.total ";
+	$sql.= "FROM ( ";
+	$sql.= "SELECT product_id, product_code, price, ";
+	$sql.= "COUNT(*) AS order_count, ";
+	$sql.= "SUM(quantity) AS products_count, ";
+	$sql.= "(price * sum(quantity)) AS total ";
+	$sql.= "FROM dtb_order_detail WHERE order_id IN (SELECT order_id FROM dtb_order WHERE $where ) ";
+	$sql.= "GROUP BY product_id, product_code, price ";
+	$sql.= ") ";
+	$sql.= "AS T1 LEFT JOIN dtb_products AS T2 USING (product_id) WHERE T2.name IS NOT NULL AND status = 1 ORDER BY T1.total DESC ";
+	
+	if($_POST['mode'] != "csv") {
+		$sql.= "LIMIT " . PRODUCTS_TOTAL_MAX;
+	}
+	
+	$objQuery = new SC_Query();
+	$objPage->arrResults = $objQuery->getall($sql, $arrval);
+	
+	// ±ß¥°¥é¥Õ¤ÎÀ¸À®
+	if($graph) {
+		$image_key = "products_" . $type;
+		$objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "name", $image_key, "(Çä¾åÈæÎ¨)");
+	}
+	
+	return $objPage;
+}
+
+/** ¿¦¶ÈÊÌ½¸·× **/
+function lfGetOrderJob($type, $sdate, $edate, $objPage, $graph = true) {
+	global $arrJob;	
+		
+	list($where, $arrval) = lfGetWhereMember('T2.create_date', $sdate, $edate, $type);
+	
+	$sql = "SELECT job, count(*) AS order_count, SUM(total) AS total, int4(AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_customer AS T1 LEFT JOIN dtb_order AS T2 USING ( customer_id ) WHERE $where AND T2.delete = 0";
+	$sql.= "GROUP BY job ORDER BY total DESC";
+	
+	$objQuery = new SC_Query();
+	$objPage->arrResults = $objQuery->getall($sql, $arrval);
+			
+	$max = count($objPage->arrResults);
+	for($i = 0; $i < $max; $i++) {
+		$job_key = $objPage->arrResults[$i]['job'];
+		if($job_key != "") {
+			$objPage->arrResults[$i]['job_name'] = $arrJob[$job_key];
+		} else {
+			$objPage->arrResults[$i]['job_name'] = "Ì¤²óÅú";
+		}
+	}
+	
+	// ±ß¥°¥é¥Õ¤ÎÀ¸À®	
+	if($graph) {
+		$image_key = "job_" . $type;
+		$objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "job_name", $image_key, "(Çä¾åÈæÎ¨)");
+	}
+	
+	return $objPage;
+}
+
+/** Ç¯ÂåÊÌ½¸·× **/
+function lfGetOrderAge($type, $sdate, $edate, $objPage, $graph = true) {
+
+	list($where, $arrval) = lfGetWhereMember('order_date', $sdate, $edate, $type, "member");
+	
+	$sql = "SELECT SUM(order_count) AS order_count, SUM(total) AS total, start_age, end_age ";
+	$sql.= "FROM dtb_bat_order_daily_age WHERE $where ";
+	$sql.= "GROUP BY start_age, end_age ORDER BY start_age, end_age";
+
+	$objQuery = new SC_Query();
+	$objPage->arrResults = $objQuery->getall($sql, $arrval);
+	
+	$max = count($objPage->arrResults);
+	for($i = 0; $i < $max; $i++) {
+		if($objPage->arrResults[$i]['order_count'] > 0) {
+			$objPage->arrResults[$i]['total_average'] = intval($objPage->arrResults[$i]['total'] / $objPage->arrResults[$i]['order_count']);
+		}	
+		$start_age = $objPage->arrResults[$i]['start_age'];
+		$end_age = $objPage->arrResults[$i]['end_age'];
+		if($start_age != "" || $end_age != "") {
+			if($end_age != 999) {
+				$objPage->arrResults[$i]['age_name'] = $start_age . "¡Á" . $end_age . "ºÐ";
+			} else {
+				$objPage->arrResults[$i]['age_name'] = $start_age . "ºÐ¡Á";
+			}
+		} else {
+			$objPage->arrResults[$i]['age_name'] = "Ì¤²óÅú";
+		}
+	}
+	
+	// ËÀ¥°¥é¥Õ¤ÎÀ¸À®
+	if($graph) {
+		$image_key = "age_" . $type;
+		$xtitle = "(Ç¯Îð)";
+		$ytitle = "(Çä¾å¹ç·×)";
+		$objPage->tpl_image = lfGetGraphBar($objPage->arrResults, "age_name", $image_key, $xtitle, $ytitle);
+	}
+	
+	return $objPage;
+}
+
+/** ´ü´ÖÊÌ½¸·× **/
+function lfGetOrderTerm($type, $sdate, $edate, $objPage, $graph = true) {
+		
+		$tmp_col = "sum(total_order) as total_order, sum(men) as men, sum(women) as women,";
+		$tmp_col.= "sum(men_member) as men_member, sum(men_nonmember) as men_nonmember,";
+		$tmp_col.= "sum(women_member) as women_member, sum(women_nonmember) as women_nonmember,";
+		$tmp_col.= "sum(total) as total, int4(avg(total_average)) as total_average";
+		$objQuery = new SC_Query();
+		
+		switch($type) {
+		// ·îÊÌ
+		case 'month':
+			$col = $tmp_col . ",key_month";
+			$objQuery->setgroupby("key_month");
+			$objQuery->setOrder("key_month");
+			$objPage->keyname = "key_month";
+			$objPage->tpl_tail = "·î";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(·îÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		// Ç¯ÊÌ
+		case 'year':
+			$col = $tmp_col . ",key_year";
+			$objQuery->setgroupby("key_year");
+			$objQuery->setOrder("key_year");
+			$objPage->keyname = "key_year";
+			$objPage->tpl_tail = "Ç¯";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(Ç¯ÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		// ÍËÆüÊÌ
+		case 'wday':
+			$col = $tmp_col . ",key_wday, wday";
+			$objQuery->setgroupby("key_wday, wday");
+			$objQuery->setOrder("wday");
+			$objPage->keyname = "key_wday";
+			$objPage->tpl_tail = "ÍËÆü";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(ÍËÆüÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		// »þ´ÖÊÌ
+		case 'hour':
+			$col = $tmp_col . ",hour";
+			$objQuery->setgroupby("hour");
+			$objQuery->setOrder("hour");
+			$objPage->keyname = "hour";
+			$objPage->tpl_tail = "»þ";
+			$from = "dtb_bat_order_daily_hour";
+			$xtitle = "(»þ´ÖÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		default:
+			$col = "*";
+			$objQuery->setOrder("key_day");
+			$objPage->keyname = "key_day";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(ÆüÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		}
+		
+		if($sdate != "") {
+			if ($where != "") {
+				$where.= " AND ";
+			}			
+			$where.= " order_date >= ? ";
+			$arrval[] = $sdate;
+		}
+		
+		if($edate != "") {
+			if ($where != "") {
+				$where.= " AND ";
+			}			
+			$where.= " order_date <= ? ";
+			$arrval[] = $edate;
+		}
+					
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$objPage->arrResults = $objQuery->select($col, $from, $where, $arrval);
+		
+		// ÀÞ¤ìÀþ¥°¥é¥Õ¤ÎÀ¸À®	
+		if($graph) {
+			$image_key = "term_" . $type;
+			$objPage->tpl_image = lfGetGraphLine($objPage->arrResults, $objPage->keyname, $image_key, $xtitle, $ytitle);
+		}
+		
+		// ¸¡º÷·ë²Ì¤¬0¤Ç¤Ê¤¤¾ì¹ç
+		if(count($objPage->arrResults) > 0) {
+			// ºÇ½ª½¸·×¹Ô¼èÆÀ¤¹¤ë
+			$col = $tmp_col;
+			$objQuery = new SC_Query();
+			$arrRet = $objQuery->select($col, $from, $where, $arrval);
+			$arrRet[0][$objPage->keyname] = "¹ç·×";
+			$objPage->arrResults[] = $arrRet[0];
+		}
+
+		// Ê¿¶ÑÃÍ¤Î·×»»
+		$max = count($objPage->arrResults);
+		for($i = 0; $i < $max; $i++) {
+			if($objPage->arrResults[$i]['total_order'] > 0) {
+				$objPage->arrResults[$i]['total_average'] = intval($objPage->arrResults[$i]['total'] / $objPage->arrResults[$i]['total_order']);
+			}
+		}
+		
+		return $objPage;
+}
+
+?>
Index: /temp/trunk/html/admin/total/line.php
===================================================================
--- /temp/trunk/html/admin/total/line.php	(revision 1328)
+++ /temp/trunk/html/admin/total/line.php	(revision 1328)
@@ -0,0 +1,178 @@
+<?php
+require_once("./class/SC_GraphPie.php");
+require_once("./class/SC_GraphLine.php");
+
+class LC_Page {
+	function LC_Page($arrData) {
+		$this->arrData = $arrData;
+	}
+}
+
+
+$objGraphPie = new SC_GraphPie();
+$objGraphLine = new SC_GraphLine();
+
+$arrData1 = array(
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	23,
+	33,
+	58,
+	120,
+	3300,
+	4223,
+	5120,
+	2300,
+	3223,
+	100,
+	4250,
+	100
+);
+
+$arrData2 = array(
+	3300,
+	4223,
+	5120,
+	2300,
+	3223,
+	100,
+	4250,
+	23,
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	23,
+	33,
+	58,
+	120,
+	100
+);
+
+$arrData3 = array(
+	6223,
+	6223,
+	6223,
+	6300,
+	3223,
+	2223,
+	6300,
+	6223,
+	5120,
+	2300,
+	3223,
+	6223,
+	6223,
+	3300,
+	4223,
+	5120,
+	6300,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+);
+
+$arrXLabel = array(
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',	
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î'
+
+);
+$arrYLabel = array(
+	1000,
+	2000,
+	3000,
+	4000,
+	5000,
+	6000,
+	7000,
+	8000,
+	9000,
+	10000
+);
+
+$arrLegend = array(
+	'»î¸³1',
+	'»î¸³2',
+	'»î¸³3',
+	'»î¸³4',
+	'»î¸³5',
+	'»î¸³6',
+	'»î¸³7'
+);
+
+// ¥°¥é¥ÕÉÁ²è
+$objGraphLine->setXLabel($arrXLabel);
+//$objGraphLine->setYScale($arrYLabel);
+$objGraphLine->setXTitle("´ü´Ö(·î)");
+$objGraphLine->setYTitle("Çä¾å¤²(±ß)");
+$objGraphLine->setData($arrData1);
+//$objGraphLine->setData($arrData1);
+//$objGraphLine->setData($arrData3);
+
+// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+//$objGraphLine->setLegend($arrLegend);
+$objGraphLine->drawGraph();
+
+$objGraphLine->outputGraph(false, "/home/web/os-test.lockon.co.jp/html/upload/graph_image/test.png");
+
+?>
Index: /temp/trunk/html/admin/total/class/SC_GraphBase.php
===================================================================
--- /temp/trunk/html/admin/total/class/SC_GraphBase.php	(revision 1328)
+++ /temp/trunk/html/admin/total/class/SC_GraphBase.php	(revision 1328)
@@ -0,0 +1,220 @@
+<?php
+/*
+$SC_GRAPHPIE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHPIE_DIR . "/config.php");
+require_once($SC_GRAPHPIE_DIR . "/lib.php");	
+*/
+require_once(realpath(dirname( __FILE__)) . "/config.php");
+require_once(realpath(dirname( __FILE__)) . "/lib.php");	
+
+// SC_Graph¶¦ÄÌ¥¯¥é¥¹
+class SC_GraphBase {
+	var $arrRGB;
+	var $arrColor;
+	var $arrDarkColor;
+	var $image;
+	var $left;
+	var $top;
+	var $shade_color;
+	var $flame_color;
+	var $shade_on;
+	var $text_color;
+	var $labelbg_color;
+	var $bgw;
+	var $bgh;
+	var $clabelbg_color;
+	var $title_color;
+	var $text_top;
+	var $mark_color;
+	var $arrLegend;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphBase($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left, $top) {
+		global $ARR_GRAPH_RGB;
+		global $ARR_BG_COLOR;
+		global $ARR_SHADE_COLOR;
+		global $ARR_FLAME_COLOR;
+		global $ARR_TEXT_COLOR;
+		global $ARR_LABELBG_COLOR;
+		global $ARR_LEGENDBG_COLOR;
+		global $ARR_TITLE_COLOR;
+		global $ARR_GRID_COLOR;
+		
+		// ²èÁüºîÀ®
+		$this->bgw = $bgw;
+		$this->bgh = $bgh;	
+		$this->image = imagecreatetruecolor($bgw, $bgh);
+		// ¥¢¥ó¥Á¥¨¥¤¥ê¥¢¥¹Í­¸ú
+		imageantialias($this->image, true);
+		// ÇØ·Ê¿§¤ò¥»¥Ã¥È
+		imagefill($this->image, 0, 0, lfGetImageColor($this->image, $ARR_BG_COLOR));
+		
+		// »ÈÍÑ¿§¤ÎÀ¸À®
+		$this->setColorList($ARR_GRAPH_RGB);
+		// ¥°¥é¥ÕÉÁ²è°ÌÃÖ¤ÎÀßÄê
+		$this->left = $left;
+		$this->top = $top;
+		$this->shade_color = lfGetImageColor($this->image, $ARR_SHADE_COLOR);
+		$this->flame_color = lfGetImageColor($this->image, $ARR_FLAME_COLOR);
+		$this->text_color = lfGetImageColor($this->image, $ARR_TEXT_COLOR);
+		$this->labelbg_color = lfGetImageColor($this->image, $ARR_LABELBG_COLOR);
+		$this->clabelbg_color = lfGetImageColor($this->image, $ARR_LEGENDBG_COLOR);
+		$this->title_color = lfGetImageColor($this->image, $ARR_TITLE_COLOR);
+		$this->grid_color = lfGetImageColor($this->image, $ARR_GRID_COLOR);
+			
+		// ±Æ¤¢¤ê
+		$this->shade_on = true;
+    }
+	
+	// ¥ª¥Ö¥¸¥§¥¯¥È¥«¥é¡¼¤ÎÀßÄê
+	function setColorList($arrRGB) {
+		$this->arrRGB = $arrRGB;
+		$count = count($this->arrRGB);
+		// ÄÌ¾ï¿§¤ÎÀßÄê
+		for($i = 0; $i < $count; $i++) {
+			$this->arrColor[$i] = lfGetImageColor($this->image, $this->arrRGB[$i]);
+		}
+		// °Å¿§¤ÎÀßÄê
+		for($i = 0; $i < $count; $i++) {
+			$this->arrDarkColor[$i] = lfGetImageDarkColor($this->image, $this->arrRGB[$i]);
+		}		
+	}
+	
+	// ±Æ¤Î¤¢¤ê¤Ê¤·
+	function setShadeOn($shade_on) {
+		$this->shade_on = $shade_on;
+	}
+	
+	// ²èÁü¤ò½ÐÎÏ¤¹¤ë
+	function outputGraph($header = true, $filename = "") {
+		if($header) {
+			header('Content-type: image/png');
+		}
+		
+		if ($filename != "") {
+			imagepng($this->image, $filename);
+		}else{
+			imagepng($this->image);
+		}
+		
+		imagedestroy($this->image);
+	}
+
+	// ÉÁ²è»þ¤Î¥Æ¥­¥¹¥ÈÉý¤òµá¤á¤ë
+	function getTextWidth($text, $font_size) {
+		$text_len = strlen($text);
+		$ret = $font_size * $text_len * TEXT_RATE;	
+		/*
+			¢¨Àµ³Î¤ÊÃÍ¤¬¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¤Î¤ÇÇÑ»ß
+			// ¥Æ¥­¥¹¥ÈÉý¤Î¼èÆÀ
+			$arrPos = imagettfbbox($font_size, 0, FONT_PATH, $text);
+			$ret = $arrPos[2] - $arrPos[0];
+		*/
+		return $ret;
+	}
+	
+	// ¥Æ¥­¥¹¥È¤ò½ÐÎÏ¤¹¤ë
+	function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) {
+		// »þ·×²ó¤ê¤Ë³ÑÅÙ¤òÊÑ¹¹
+		$angle = -$angle;		
+		// ¥é¥Ù¥ëÇØ·Ê
+		if($labelbg) {
+			$text_width = $this->getTextWidth($text, $font_size);
+			imagefilledrectangle($this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color);
+		}
+		$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+		if($color != NULL) {
+			ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_PATH, $text);
+		} else {
+			ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $this->text_color, FONT_PATH, $text);			
+		}
+	}
+	
+	// ¥¿¥¤¥È¥ë¤ò½ÐÎÏ¤¹¤ë
+	function drawTitle($text, $font_size = TITLE_FONT_SIZE) {
+		// ½ÐÎÏ°ÌÃÖ¤Î»»½Ð
+		$text_width = $this->getTextWidth($text, $font_size);
+		$left = ($this->bgw - $text_width) / 2;
+		$top = TITLE_TOP;
+		$this->setText($font_size, $left, $top, $text, $this->title_color);		
+	}
+	
+	// ¥í¥°¤ò½ÐÎÏ¤¹¤ë
+	function debugPrint($text) {
+		$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+		if(!isset($this->text_top)) {
+			$this->text_top = FONT_SIZE + LINE_PAD;
+		}		
+		// ¥Æ¥­¥¹¥ÈÉÁ²è
+		ImageTTFText($this->image, FONT_SIZE, 0, LINE_PAD, $this->text_top, $this->text_color, FONT_PATH, $text);
+		$this->text_top += FONT_SIZE + LINE_PAD;
+	}
+		
+	// ¥«¥é¡¼¥é¥Ù¥ë¤òÉÁ²è
+	function drawLegend($legend_max = "", $clabelbg = true) {
+		// ËÞÎã¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐÃæ»ß
+		if(count($this->arrLegend) <= 0) {
+			return;
+		}		
+		
+		if($legend_max != "") {
+			$label_max = $legend_max;
+		} else {
+			$label_max = count($this->arrLegend);
+		}
+
+		$height_max = 0;
+		$text_max = 0;
+		$width_max = 0;
+		
+		// °ìÈÖÊ¸»ú¿ô¤¬Â¿¤¤¤â¤Î¤ò¼èÆÀ
+		for($i = 0; $i < $label_max; $i++) {
+			$text_len = strlen($this->arrLegend[$i]);
+			if($text_max < $text_len) {
+				$text_max = $text_len;
+			}
+			$height_max += FONT_SIZE + LINE_PAD;
+		}
+		$width_max = FONT_SIZE * $text_max * TEXT_RATE;		
+
+		// 	¥«¥é¡¼¥¢¥¤¥³¥ó¤ÈÊ¸»ú´Ö¤ò´Þ¤á¤¿Éý
+		$width_max += FONT_SIZE + (LINE_PAD * 2);	
+		$left = $this->bgw - $width_max - LEGEND_RIGHT;
+		$top = LEGEND_TOP;
+		// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+		if($clabelbg) {
+			$this->drawClabelBG($left - LINE_PAD, $top, $left + $width_max, $top + $height_max + LINE_PAD);
+		}
+		$top += LINE_PAD;
+				
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		for($i = 0; $i < $label_max; $i++) {			
+			// ¥«¥é¡¼¥¢¥¤¥³¥ó¤ÎÉ½¼¨
+			imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color);
+			imagefilledrectangle($this->image, $left + 1, $top + 1, $left + FONT_SIZE - 1, $top + FONT_SIZE - 1, $this->arrColor[($i % $c_max)]);
+			// ¥é¥Ù¥ë¤ÎÉ½¼¨
+			$this->setText(FONT_SIZE, $left + FONT_SIZE + LINE_PAD, $top, $this->arrLegend[$i]);
+			$top += FONT_SIZE + LINE_PAD;
+		}
+	}
+	
+	// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+	function drawClabelBG($left, $top, $right, $bottom) {
+		// ±Æ¤ÎÉÁ²è
+		if($this->shade_on) {
+			imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color);
+		}
+		// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+		imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->clabelbg_color);
+		imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color);
+	}
+	
+	// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+	function setLegend($arrLegend) {
+		$this->arrLegend = array_values((array)$arrLegend);
+	}
+
+}
+
+?>
Index: /temp/trunk/html/admin/total/class/SC_GraphPie.php
===================================================================
--- /temp/trunk/html/admin/total/class/SC_GraphPie.php	(revision 1328)
+++ /temp/trunk/html/admin/total/class/SC_GraphPie.php	(revision 1328)
@@ -0,0 +1,196 @@
+<?php
+
+$SC_GRAPHPIE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHPIE_DIR . "/SC_GraphBase.php");	
+
+// ±ß¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphPie extends SC_GraphBase{
+	var $cw;
+	var $ch;
+	var $cz;
+	var $cx;
+	var $cy;
+	var $arrLabel;
+	var $arrData;
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphPie($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT, $top = PIE_TOP) {
+		parent::SC_GraphBase($bgw, $bgh, $left, $top);
+		// ¥µ¥¤¥ºÀßÄê
+		$this->setSize(PIE_WIDTH, PIE_HEIGHT, PIE_THICK);
+		// °ÌÃÖÀßÄê
+		$this->setPosition($this->left + ($this->cw / 2), $this->top + ($this->ch / 2));
+    }
+	
+	// ¥Ç¡¼¥¿¤ò360¡ëÃÍ¤ËÊÑ´¹¤¹¤ë
+	function getCircleData($array) {
+		if(!is_array($array)) {
+			return;
+		}
+		$arrRet = array();
+		foreach($array as $val) {
+			$total += $val;			
+		}
+		if($total <= 0) {
+			return;
+		}		
+		$rate = 360 / $total;
+		// ¥é¥Ù¥ëÉ½¼¨ÍÑ
+		$p_rate = 100 / $total;
+		$cnt = 0;
+		foreach($array as $val) {
+			$ret = round($val * $rate);
+			$new_total+= $ret;
+			$arrRet[] = $ret;
+			// ¥Ñ¡¼¥»¥ó¥ÈÉ½¼¨ÍÑ
+			$this->arrLabel[] = round($val * $p_rate) . " %";
+			$cnt++;
+		}
+		// ¹ç·×¤¬360¤Ë¤Ê¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤ª¤¯
+		$arrRet[0] -= $new_total - 360;
+		return $arrRet;
+	}	
+		
+	// ±ß¤Î°ÌÃÖÀßÄê¤ò¹Ô¤¦
+	function setPosition($cx, $cy) {
+		$this->cx = $cx;
+		$this->cy = $cy;
+	}
+		
+	// ±ß¤Î¥µ¥¤¥ºÀßÄê¤ò¹Ô¤¦
+	function setSize($cw, $ch, $cz = 0) {
+		$this->cw = $cw;
+		$this->ch = $ch;
+		$this->cz = $cz;
+	}
+	
+	// ±Æ¤ÎÉÁ²è
+	function drawShade() {
+		$move = 1;
+		for($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) {
+			imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE);
+			$move += 0.5;
+		}
+	}
+	
+	// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+	function setData($arrData) {
+		$this->arrData = array_values($arrData);
+	}
+	
+	// ±ß¥°¥é¥Õ¤òÉÁ²è¤¹¤ë
+	function drawGraph() {
+		$x = $this->cx;
+		$y = $this->cy;
+		$z = $this->cz;
+		$h = $this->ch;
+		$w = $this->cw;
+		
+		// ¥Ç¡¼¥¿¤Î³ÑÅÙ¤ò¼èÆÀ¤¹¤ë
+		$arrRad = $this->getCircleData($this->arrData);
+		$rd_max = count($arrRad);
+		
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç
+		if($rd_max <= 0) {
+			return;
+		}
+		
+		// ±Æ¤ÎÉÁ²è
+		if($this->shade_on) {
+			$this->drawShade();
+		}
+			
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		$dc_max = count($this->arrDarkColor);
+		
+		// Â¦ÌÌ¤ÎÉÁ²è		
+		for ($i = ($y + $z - 1); $i >= $y; $i--) {
+			$start = 0;
+			for($j = 0; $j < $rd_max; $j++) {
+				// ³ÑÅÙ¤¬0ÅÙ°Ê¾å¤Î¾ì¹ç¤Î¤ßÂ¦ÌÌ¤òÉÁ²è¤¹¤ë¡£
+				if($arrRad[$j] > 0) {
+					$end = $start + $arrRad[$j];
+					if($start == 0 && $end == 360) {
+						// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+						imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]);
+					} else {
+						// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë
+						imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[($j % $dc_max)]);	
+					}			
+					$start = $end;
+				}
+			}
+		}
+		// ÄìÌÌ¤ÎÉÁ²è
+		imagearc($this->image, $x, $y + $z, $w, $h, 0, 180 , $this->flame_color);
+
+		// ¾åÌÌ¤ÎÉÁ²è
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			if($start == 0 && $end == 360) {
+				// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+				imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);			
+			} else {
+				// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£		
+				imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);
+			}
+			$start = $end;
+		}
+
+		// ¾åÌÌ¤Î±ï¼è¤ê
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			if($start == 0 && $end == 360) {
+				// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+				imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color);
+			}
+			// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£
+			imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL);
+			$start = $end;
+		}
+
+		// Â¦ÌÌ¤Î±ï¼è¤ê
+		imageline($this->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $this->flame_color);
+		imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color);
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			// Á°ÌÌ¤Î¤ß
+			if($end > 90 && $end < 270) {
+				list($ax, $ay) = lfGetArcPos($x, $y, $w, $h, $end);
+				// ¥é¥¤¥ó¤Î¤º¤ì¤òÊäÀµ¤¹¤ë
+				if($end > 180) {
+					$ax = $ax + 1;
+				}
+				imageline($this->image, $ax, $ay, $ax, $ay + $z, $this->flame_color);
+			}
+			$start = $end;	
+		}
+				
+		// ¥é¥Ù¥ë¤ÎÉÁ²è
+		$this->drawLabel($arrRad);
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend(count($this->arrData));			
+	}
+	
+	// ±ß¥°¥é¥Õ¤Î¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($arrRad) {
+		$rd_max = count($arrRad);
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$center = $start + ($arrRad[$i] / 2);
+			$end = $start + $arrRad[$i];
+			list($sx, $sy) = lfGetArcPos($this->cx, $this->cy, ($this->cw / 1.5), ($this->ch / 1.5), $center);
+			list($ex, $ey) = lfGetArcPos($this->cx, $this->cy, ($this->cw * 1.5), ($this->ch * 1.5), $center);
+			// »Ø¼¨Àþ¤ÎÉÁ²è
+			imageline($this->image, $sx, $sy, $ex + 2, $ey - PIE_LABEL_UP, $this->flame_color);
+			$this->setText(FONT_SIZE, $ex - 10, $ey - PIE_LABEL_UP - FONT_SIZE, $this->arrLabel[$i], NULL, 0, true);
+			$start = $end;
+		}
+	}	
+}
+
+?>
Index: /temp/trunk/html/admin/total/class/config.php
===================================================================
--- /temp/trunk/html/admin/total/class/config.php	(revision 1328)
+++ /temp/trunk/html/admin/total/class/config.php	(revision 1328)
@@ -0,0 +1,93 @@
+<?php
+
+/*
+	¶¦ÄÌ 
+*/
+// TTF¥Õ¥©¥ó¥È¥Õ¥¡¥¤¥ë
+define("FONT_PATH", ROOT_DIR . "/data/fonts/ipag.ttf");
+define("FONT_SIZE", 8);			// ¥Õ¥©¥ó¥È¥µ¥¤¥º
+define("TITLE_FONT_SIZE", 10);	// ¥¿¥¤¥È¥ë¥Õ¥©¥ó¥È¥µ¥¤¥º
+define("BG_WIDTH", 720);		// ÇØ·ÊÉý
+define("BG_HEIGHT", 400);		// ÇØ·Ê¹â¤µ
+define("LINE_PAD", 5);			// ¹Ô´Ö
+define("TEXT_RATE", 0.75);		// ¥Õ¥©¥ó¥ÈÊäÀµÃÍ(¼ÂºÝ¤ÎÉÁ²èÉý/¥Õ¥©¥ó¥È¥µ¥¤¥º)
+
+/*
+	±ß¥°¥é¥Õ
+*/
+define("PIE_LEFT", 200);			// ±ß¥°¥é¥Õ°ÌÃÖ
+define("PIE_TOP", 150);				// ±ß¥°¥é¥Õ°ÌÃÖ
+define("PIE_WIDTH", 230);			// ±ß¥°¥é¥ÕÉý
+define("PIE_HEIGHT", 100);			// ±ß¥°¥é¥Õ¹â¤µ
+define("PIE_THICK", 30);			// ±ß¥°¥é¥ÕÂÀ¤µ
+define("PIE_LABEL_UP", 20);			// ±ß¥°¥é¥Õ¤Î¥é¥Ù¥ë°ÌÃÖ¤ò¾å¤Ë¤¢¤²¤ë
+define("PIE_SHADE_IMPACT", 0.1);	// ÃÍ¤¬Âç¤­¤¤¤Û¤É±Æ¤¬Ä¹¤¯¤Ê¤ë
+
+/*
+	ÀÞ¤ìÀþ¥°¥é¥Õ
+*/
+define("LINE_Y_SCALE", 10);			// Y¼´¤ÎÌÜÀ¹¤ê¿ô
+define("LINE_X_SCALE", 10);			// X¼´¤ÎÌÜÀ¹¤ê¿ô
+define("LINE_LEFT", 60);			// Àþ¥°¥é¥Õ°ÌÃÖ
+define("LINE_TOP", 50);				// Àþ¥°¥é¥Õ°ÌÃÖ
+define("LINE_AREA_WIDTH", 600);		// Àþ¥°¥é¥ÕÇØ·Ê¤Î¥µ¥¤¥º
+define("LINE_AREA_HEIGHT", 300);	// Àþ¥°¥é¥ÕÇØ·Ê¤Î¥µ¥¤¥º
+define("LINE_MARK_SIZE", 6);		// Àþ¥°¥é¥Õ¥Þ¡¼¥¯¤Î¥µ¥¤¥º
+define("LINE_SCALE_SIZE", 6);		// ÌÜÀ¹¤êÉý
+define("LINE_XLABEL_MAX", 30);		// X¼´¤Î¥é¥Ù¥ë¤ÎÉ½¼¨À©¸Â¿ô
+define("LINE_XTITLE_PAD", 25);		// X¼´¤Î¥¿¥¤¥È¥ë¤È¼´¤Î´Ö³Ö
+define("LINE_YTITLE_PAD", 15);		// Y¼´¤Î¥¿¥¤¥È¥ë¤È¼´¤Î´Ö³Ö
+
+/* 
+	ËÀ¥°¥é¥Õ
+*/
+define("BAR_PAD", 6);				// ¥°¥é¥Õ¤ÈÌÜÀ¹¤ê¤Î´Ö³Ö
+
+/*
+	¥¿¥¤¥È¥ë¥é¥Ù¥ë
+*/
+define("TITLE_TOP", 10);	// ÇØ·ÊÏÈ¤È¤Î¾åÉý
+
+/*
+	ËÞÎã
+*/
+define("LEGEND_TOP", 10); 	// ÇØ·ÊÏÈ¤È¤Î¾åÉý
+define("LEGEND_RIGHT", 10); // ÇØ·ÊÏÈ¤È¤Î±¦Éý
+
+
+/*
+	É½¼¨¿§
+*/
+// ËÞÎãÇØ·Ê
+$ARR_LEGENDBG_COLOR = array(245,245,245);
+// ¥é¥Ù¥ëÇØ·Ê
+$ARR_LABELBG_COLOR = array(255,255,255);
+// ¥°¥é¥Õ¥«¥é¡¼
+$ARR_GRAPH_RGB = array(
+	array(200,50,50),
+	array(50,50,200),
+	array(50,200,50),
+	array(255,255,255),
+	array(244,200,200),
+	array(200,200,255),
+	array(50,200,50),
+	array(255,255,255),
+	array(244,244,244),
+);
+// ±Æ¤Î¿§
+$ARR_SHADE_COLOR = array(100,100,100);
+// ±ï¤Î¿§
+$ARR_FLAME_COLOR = array(100, 100, 140);
+// Ê¸»ú¿§
+$ARR_TEXT_COLOR = array(55, 55, 55);
+// ÇØ·Ê¥«¥é¡¼
+$ARR_BG_COLOR = array(255,255,255);	
+// ¥¿¥¤¥È¥ëÊ¸»ú¿§
+$ARR_TITLE_COLOR = array(100, 50, 50);
+// ¥°¥ê¥Ã¥ÉÀþ¿§
+$ARR_GRID_COLOR = array(200, 200, 200);
+// ¥Þ¡¼¥¯¤Î¿§
+$ARR_MARK_COLOR = array(130, 130, 255);
+
+
+?>
Index: /temp/trunk/html/admin/total/class/lib.php
===================================================================
--- /temp/trunk/html/admin/total/class/lib.php	(revision 1328)
+++ /temp/trunk/html/admin/total/class/lib.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+
+// ±ß¤ÎÃæ¿´ÅÀ¤ÈÄ¾·Â¤«¤é¸Ì¤Î½ªÃ¼ºÂÉ¸¤ò»»½Ð¤¹¤ë¡£
+/*
+	$cx	: Ãæ¿´ÅÀXºÂÉ¸
+	$cy	: Ãæ¿´ÅÀYºÂÉ¸
+	$r	: È¾·Â
+	$e	: ³ÑÅÙ
+*/
+function lfGetArcPos($cx, $cy, $cw, $ch, $e) {
+	// »°³Ñ´Ø¿ôÍÑ¤Î³ÑÅÙ¤òµá¤á¤ë
+	$s = 90 - $e;
+	$r = $cw / 2;
+	// °ÌÃÖ¤òµá¤á¤ë
+	$x = $cx + ($r * cos(deg2rad($s)));
+	$y = $cy - (($r * sin(deg2rad($s))) * ($ch / $cw));		
+	return array(round($x), round($y));
+}
+
+
+
+/* ²èÁü¤Ë¥Æ¥­¥¹¥È¤òÉÁ²è¤¹¤ë */
+function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) {
+	$color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]);
+	$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+	// É½¼¨³ÑÅÙ	
+	$angle = 0;
+	// ¥Æ¥­¥¹¥ÈÉÁ²è
+	ImageTTFText($dst_image, $font_size, $angle, $left, $top, $color, $font, $text);
+}
+
+// É½¼¨¿§¤Î¼èÆÀ
+function lfGetImageColor($image, $array) {
+	if(count($array) != 3) {
+		return NULL;
+	}
+	$ret = imagecolorallocate($image, $array[0], $array[1], $array[2]);
+	return $ret;
+}
+
+// ±ÆÍÑÉ½¼¨¿§¤Î¼èÆÀ
+function lfGetImageDarkColor($image, $array) {
+	if(count($array) != 3) {
+		return NULL;
+	}
+	$i = 0;
+	foreach($array as $val) {
+		$dark[$i] = $val - 45;
+		if($dark[$i] < 0) {
+			$dark[$i] = 0;
+		}
+		$i++;
+	}
+	$ret = imagecolorallocate($image, $dark[0], $dark[1], $dark[2]);
+	return $ret;
+}
+?>
Index: /temp/trunk/html/admin/total/class/SC_GraphBar.php
===================================================================
--- /temp/trunk/html/admin/total/class/SC_GraphBar.php	(revision 1328)
+++ /temp/trunk/html/admin/total/class/SC_GraphBar.php	(revision 1328)
@@ -0,0 +1,78 @@
+<?
+$SC_GRAPHBAR_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHBAR_DIR . "/SC_GraphLine.php");	
+
+// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphBar extends SC_GraphLine{
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphLine(
+		$bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP,
+		$area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
+		parent::SC_GraphLine($bgw, $bgh, $left, $top, $area_width, $area_height);	
+	}
+	
+	// ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawGraph() {
+		$this->drawYLine();
+		$this->drawXLine(true);
+		
+		// ËÀ¥°¥é¥Õ¤ÎÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawBar($i);
+		}
+		
+		// ¥é¥Ù¥ë¤ÎÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLabel($i);
+		}
+		
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend();	
+	}
+	
+	// ËÀ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawBar($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		// ¥Ç¡¼¥¿¿ô¤ò¿ô¤¨¤ë
+		$count = count($arrPointList);
+		// È¾ÌÜÀ¹¤ê¤ÎÉý¤òµá¤á¤ë
+		$half_scale = intval($this->area_width / ($count + 1) / 2);
+		// ÌÜÀ¹¤ê¤ÎÉý¤òµá¤á¤ë
+		$scale_width = intval($this->area_width / ($count + 1));
+		// ËÀ¥°¥é¥Õ¤Î¥µ¥¤¥º¤òµá¤á¤ë
+		$bar_width = intval(($scale_width - (BAR_PAD * 2)) / $this->line_max);
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		for($i = 0; $i < $count; $i++) {
+			$left = $arrPointList[$i][0] - $half_scale + BAR_PAD + ($bar_width * $line_no);
+			$top = $arrPointList[$i][1];
+			$right = $left + $bar_width;
+			$bottom = $this->top + $this->area_height;
+			
+			// ±Æ¤ÎÉÁ²è
+			if($this->shade_on) {
+				imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom, $this->shade_color);
+			}
+			//imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[($i % $c_max)]);
+			imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[$line_no]);			
+			imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color);					
+		}
+	}
+	
+	// ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($line_no) {
+		$arrData = $this->arrDataList[$line_no];
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			$text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE);
+			$y_pos = $y - FONT_SIZE - 5;
+			$x_pos = $x - $text_width / 2;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i]));
+		}
+	}
+	
+}
+?>
Index: /temp/trunk/html/admin/total/class/SC_GraphLine.php
===================================================================
--- /temp/trunk/html/admin/total/class/SC_GraphLine.php	(revision 1328)
+++ /temp/trunk/html/admin/total/class/SC_GraphLine.php	(revision 1328)
@@ -0,0 +1,286 @@
+<?
+$SC_GRAPHLINE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHLINE_DIR . "/SC_GraphBase.php");	
+
+// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphLine extends SC_GraphBase{
+	var $area_width;
+	var $area_height;
+	var $ygrid_on;
+	var $graph_max;		// ¥°¥é¥Õ¤Î¥¨¥ê¥¢ºÇÂçÃÍ(Y¼´ÄºÅÀ¤ÎÃÍ)
+	var $arrXLabel;	
+	var $XLabelAngle;	// X¼´¥é¥Ù¥ë³ÑÅÙ	
+	var $XTitle;		// X¼´¥¿¥¤¥È¥ë
+	var $YTitle;		// Y¼´¥¿¥¤¥È¥ë
+	var $arrDataList;	// ¥°¥é¥Õ¥Ç¡¼¥¿¤ò³ÊÇ¼
+	var $arrPointList;	// ÀÞ¤ìÀþºÂÉ¸¤ò³ÊÇ¼
+	var $line_max;		// Ê£¿ô¤ÎÉÁ²è¤Î¾ì¹ç¤Ë²Ã»»¤·¤Æ¤¤¤¯
+	
+	var $x_margin;
+	var $y_margin;
+			
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphLine(
+		$bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP,
+		$area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
+		parent::SC_GraphBase($bgw, $bgh, $left, $top);	
+		$this->area_width = $area_width;
+		$this->area_height = $area_height;
+		$this->ygrid_on = true;
+		$this->line_max = 0;
+		$this->graph_max = 0;
+		$this->XLabelAngle = 0;
+		$this->x_margin = 0;
+		$this->y_margin = 0;
+	}
+	
+	// X¼´¥é¥Ù¥ë¤Î³ÑÅÙ¥»¥Ã¥È
+	function setXLabelAngle($Angle) {
+		$this->XLabelAngle = $Angle;
+	}
+	
+	// Y¼´¥¿¥¤¥È¥ë
+	function drawYTitle() {
+		// Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë
+		if($this->YTitle != "") {
+			$text_width = $this->getTextWidth($this->YTitle, FONT_SIZE);
+			$x_pos = $this->left - ($text_width / 2);
+			$y_pos = $this->top - FONT_SIZE - LINE_YTITLE_PAD;		
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, $this->YTitle);
+		}
+	}
+	
+	// X¼´¥¿¥¤¥È¥ë
+	function drawXTitle() {
+		// Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë
+		if($this->XTitle != "") {
+			$text_width = $this->getTextWidth($this->XTitle, FONT_SIZE);
+			$x_pos = $this->left + $this->area_width - ($text_width / 2);
+			$y_pos = $this->top + $this->area_height + LINE_XTITLE_PAD;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, $this->XTitle);
+		}
+	}
+	
+	// Y¼´¤ÎÉÁ²è
+	function drawYLine() {
+		imageline($this->image, $this->left, $this->top, $this->left, $this->top + $this->area_height, $this->flame_color);
+		// ÌÜÀ¹¤êÉý¤òµá¤á¤ë(Ãæ´ÖÅÀ¤Ï¼«Æ°)
+		$size = $this->area_height / (LINE_Y_SCALE * 2);
+		// ¾å¤«¤éÌÜÀ¹¤ê¤òÆþ¤ì¤Æ¤¤¤¯
+		$pos = 0;
+		for($i = 0; $i < (LINE_Y_SCALE * 2); $i++) {
+			// ÌÜÀ¹¤êÉý
+			if(($i % 2) == 0) {
+				$sw = LINE_SCALE_SIZE;
+				if($this->ygrid_on) {
+					imageline($this->image, $this->left, $this->top + $pos, $this->left + $this->area_width, $this->top + $pos, $this->grid_color);
+				}
+			} else {
+				$sw = LINE_SCALE_SIZE / 2;
+			}
+			imageline($this->image, $this->left, $this->top + $pos, $this->left + $sw, $this->top + $pos, $this->flame_color);
+			$pos += $size;
+		}
+		// Y¼´¤ËÌÜÀ¹¤êÃÍ¤òÆþ¤ì¤ë
+		$this->setYScale();
+		$this->drawYTitle();	
+	}
+	
+	// X¼´¤ÎÉÁ²è
+	function drawXLine($bar = false) {
+		imageline($this->image, $this->left, $this->top + $this->area_height, $this->left + $this->area_width, $this->top + $this->area_height, $this->flame_color);
+		$arrPointList = $this->arrPointList[0];
+		$count = count($arrPointList);
+		
+		// ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏÈ¾ÌÜÀ¹¤ê¤º¤é¤¹
+		if($bar) {
+			$half_scale = intval($this->area_width / ($count + 1) / 2);
+		} else {
+			$half_scale = 0;
+		}
+		
+		// ¥é¥Ù¥ë¤ÎÉ½¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤ò»»½Ð
+		$interval = ceil($count / LINE_XLABEL_MAX);	// ÀÚ¤ê¾å¤²				
+		for($i = 0; $i < $count; $i++) {
+			// X¼´¤ËÌÜÀ¹¤ê¤òÆþ¤ì¤ë
+			$x = $arrPointList[$i][0];
+			$pos = $this->top + $this->area_height;
+			imageline($this->image, $x - $half_scale, $pos, $x - $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);			
+			// ¥é¥Ù¥ë¤òÆþ¤ì¤ë
+			if(($i % $interval) == 0) {
+				$text_width = $this->getTextWidth($this->arrXLabel[$i], FONT_SIZE);
+				$x_pos = $x - ($text_width / 2);
+				
+				if ($this->XLabelAngle == "-45"){
+					$this->x_margin = - $text_width / 4;
+					$this->y_margin = $text_width / 2 + 5;
+				}
+				
+				$this->setText(FONT_SIZE, $x_pos + $this->x_margin, $pos + FONT_SIZE + $this->y_margin, $this->arrXLabel[$i], NULL, $this->XLabelAngle);
+			}
+		}
+		
+		// ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏºÇ¸å¤ÎÌÜÀ¹¤ê¤ò°ì¤ÄÄÉ²Ã¤¹¤ë
+		if($bar) {
+			imageline($this->image, $x + $half_scale, $pos, $x + $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);	
+		}
+		
+		$this->drawXTitle();
+	}
+		
+	// ¥°¥ê¥Ã¥ÉÉ½¼¨
+	function setYGridOn($ygrid_on) {
+		$this->ygrid_on = $ygrid_on;
+	}
+	
+	// ¥Ý¥¤¥ó¥È¤ÎÉÁ²è
+	function setMark($line_no, $left, $top, $size = LINE_MARK_SIZE) {
+		// ¶ö¿ô¤ËÊÑ´¹¤·¤Æ¤ª¤¯
+		$size += $size % 2;
+		$array = array(
+			$left, $top - ($size / 2),
+			$left + ($size / 2), $top,
+			$left, $top + ($size / 2),
+			$left - ($size / 2), $top,
+		);		
+		imagefilledpolygon($this->image, $array, 4, $this->arrColor[$line_no]);
+		imagepolygon($this->image, $array, 4, $this->flame_color);
+ 		imagesetpixel ($this->image, $left, $top + ($size / 2), $this->flame_color);
+	}	
+	
+	// Y¼´ÌÜÀ¹¤ê¤ËÃÍ¤òÆþ¤ì¤ë
+	function setYScale() {
+		// 1ÌÜÀ¹¤ê¤ÎÃÍ
+		$number = intval($this->graph_max / LINE_Y_SCALE);				
+		// ÌÜÀ¹¤êÉý¤òµá¤á¤ë
+		$size = $this->area_height / LINE_Y_SCALE;
+		$pos = 0;
+		for($i = 0; $i <= LINE_Y_SCALE; $i++) {
+			$snumber = $number * (LINE_Y_SCALE - $i);
+			$disp_number = number_format($snumber);
+			$num_width = $this->getTextWidth($disp_number, FONT_SIZE);
+			$this->setText(FONT_SIZE, $this->left - $num_width - 2, $this->top + $pos - (FONT_SIZE / 2), $disp_number);
+			$pos += $size;
+		}
+	}
+	
+	// 
+	function setMax($arrData) {
+		// ¥Ç¡¼¥¿¤ÎºÇÂçÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+		$data_max = max($arrData);
+		// 10¤Î²¿ÇÜ¤«¤ò¼èÆÀ
+		$figure = strlen($data_max) - 1;
+		// ¼¡¤Î·å¤ò·×»»¤¹¤ë
+		$tenval = pow(10, $figure);
+		// ¥°¥é¥Õ¾å¤Ç¤ÎºÇÂçÃÍ¤òµá¤á¤ë
+		$this->graph_max = $tenval * (intval($data_max / $tenval) + 1);
+		// ºÇÂçÃÍ¤¬10Ì¤Ëþ¤Î¾ì¹ç¤ÎÂÐ±þ
+		if($this->graph_max < 10) {
+			$this->graph_max = 10;
+		}	
+	}
+	
+	// ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawGraph() {
+		// ¥°¥é¥ÕÇØ·Ê¤òÉÁ²è
+		$this->drawYLine();
+		$this->drawXLine();
+		
+		// ÀÞ¤ìÀþ¥°¥é¥ÕÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLine($i);
+		}
+		
+		// ¥Þ¡¼¥¯¤òÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawMark($i);
+		}
+		
+		// ¥é¥Ù¥ë¤òÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLabel($i);		
+		}
+
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend();	
+	}
+	
+	// ¥é¥¤¥ó¤òÉÁ²è¤¹¤ë
+	function drawLine($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			if(isset($arrPointList[$i + 1])) {
+				$next_x = $arrPointList[$i + 1][0];
+				$next_y = $arrPointList[$i + 1][1];
+				imageline($this->image, $x, $y, $next_x, $next_y, $this->arrColor[$line_no]);
+			}
+		}
+	}
+	
+	// ¥Þ¡¼¥¯¤òÉÁ²è¤¹¤ë
+	function drawMark($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];			
+			$this->setMark($line_no, $x, $y);
+		}
+	}
+	
+	// ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($line_no) {
+		$arrData = $this->arrDataList[$line_no];
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			$text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE);
+			$y_pos = $y - FONT_SIZE - 5;
+			$x_pos = $x - $text_width / 2;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i]));
+		}
+	}
+	
+	// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+	function setData($arrData) {
+		$this->arrDataList[$this->line_max] = array_values((array)$arrData);
+		$this->setMax($this->arrDataList[$this->line_max]);
+		// ÃÍ¤ÎÉÁ²èÊÑ´¹Î¨
+		$rate = $this->area_height / $this->graph_max;
+		// ÉÁ²èÎ¨¤ò·×»»
+		$count = count($this->arrDataList[$this->line_max]);
+		$scale_width = $this->area_width / ($count + 1);		
+		$this->arrPointList[$this->line_max] = array();
+		for($i = 0; $i < $count; $i++) {
+			// XºÂÉ¸¤òµá¤á¤ë
+			$x = intval($this->left + ($scale_width * ($i + 1)));
+			// YºÂÉ¸¤òµá¤á¤ë
+			$y = intval($this->top + $this->area_height - ($this->arrDataList[$this->line_max][$i] * $rate));
+			// XYºÂÉ¸¤òÊÝÂ¸¤¹¤ë
+			$this->arrPointList[$this->line_max][] = array($x, $y);
+		}
+		$this->line_max++;
+	}
+	
+	// X¼´¥é¥Ù¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setXLabel($arrXLabel) {
+		$this->arrXLabel = array_values((array)$arrXLabel);
+	}
+	
+	// X¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setXTitle($title) {
+		$this->XTitle = $title;
+	}
+	
+	// Y¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setYTitle($title) {
+		$this->YTitle = $title;
+	}	
+}
+?>
Index: /temp/trunk/html/admin/total/index_sub.php
===================================================================
--- /temp/trunk/html/admin/total/index_sub.php	(revision 1328)
+++ /temp/trunk/html/admin/total/index_sub.php	(revision 1328)
@@ -0,0 +1,242 @@
+<?php
+
+function lfGetPDFColum($page, $type, $key = "") {
+	
+	$arrSUBNAME['day'] = "ÆüÊÌ";
+	$arrSUBNAME['month'] = "·îÊÌ";
+	$arrSUBNAME['year'] = "Ç¯ÊÌ";
+	$arrSUBNAME['hour'] = "»þ´ÖÊÌ";
+	$arrSUBNAME['wday'] = "ÍËÆüÊÌ";
+	$arrSUBNAME['all'] = "Á´ÂÎ";
+	$arrSUBNAME['member'] = "²ñ°÷";
+	$arrSUBNAME['nonmember'] = "Èó²ñ°÷";
+			
+	switch($page) {
+	// ¾¦ÉÊÊÌ½¸·×
+	case 'products':
+		$title = "¾¦ÉÊÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			60,
+			120,
+			220,
+			80,
+			80,
+			80,
+		);
+		$arrAlign = array(
+			'right',
+			'center',
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// ¿¦¶ÈÊÌ½¸·×
+	case 'job':
+		$title = "¿¦¶ÈÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			100,
+			100,
+			100,
+			100,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// ²ñ°÷ÊÌ½¸·×
+	case 'member':
+		$title = "²ñ°÷ÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			100,
+			100,
+			100,
+			100,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// Ç¯ÂåÊÌ½¸·×
+	case 'age':
+		$title = "Ç¯ÂåÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			80,
+			100,
+			100,
+			100,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// ´ü´ÖÊÌ½¸·×
+	default:
+		$title = "´ü´ÖÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			60,
+			60,
+			50,
+			50,
+			80,
+			80,
+			80,
+			80,
+			80,
+			80,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	}
+	
+	list($arrTitleCol, $arrDataCol) = lfGetCSVColum($page, $key);
+		
+	return array($arrTitleCol, $arrDataCol, $arrColSize, $arrAlign, $title);
+}
+
+
+function lfGetCSVColum($page, $key = "") {
+	switch($page) {
+	// ¾¦ÉÊÊÌ½¸·×
+	case 'products':
+		$arrTitleCol = array(
+			'¾¦ÉÊÈÖ¹æ',
+			'¾¦ÉÊÌ¾',
+			'¹ØÆþ·ï¿ô',
+			'ÅÀ¿ô',
+			'Ã±²Á',
+			'¶â³Û'			
+		);
+		$arrDataCol = array(
+			'product_code',
+			'name',
+			'order_count',
+			'products_count',
+			'price',
+			'total',
+		);
+		break;
+	// ¿¦¶ÈÊÌ½¸·×
+	case 'job':
+		$arrTitleCol = array(
+			'¿¦¶È',
+			'¹ØÆþ·ï¿ô',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',
+		);
+		$arrDataCol = array(
+			'job_name',
+			'order_count',
+			'total',
+			'total_average',
+		);
+		break;
+	// ²ñ°÷ÊÌ½¸·×
+	case 'member':
+		$arrTitleCol = array(
+			'²ñ°÷',
+			'¹ØÆþ·ï¿ô',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',
+		);
+		$arrDataCol = array(
+			'member_name',
+			'order_count',
+			'total',
+			'total_average',
+		);
+		break;
+	// Ç¯ÂåÊÌ½¸·×
+	case 'age':
+		$arrTitleCol = array(
+			'Ç¯Îð',
+			'¹ØÆþ·ï¿ô',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',
+		);
+		$arrDataCol = array(
+			'age_name',
+			'order_count',
+			'total',
+			'total_average',
+		);
+		break;
+	// ´ü´ÖÊÌ½¸·×
+	default:
+		$arrTitleCol = array(
+			'´ü´Ö',
+			'¹ØÆþ·ï¿ô',
+			'ÃËÀ­',
+			'½÷À­',
+			'ÃËÀ­(²ñ°÷)',
+			'ÃËÀ­(Èó²ñ°÷)',
+			'½÷À­(²ñ°÷)',
+			'½÷À­(Èó²ñ°÷)',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',		
+		);
+		$arrDataCol = array(
+			$key,
+			'total_order',
+			'men',
+			'women',
+			'men_member',
+			'men_nonmember',
+			'women_member',
+			'women_nonmember',
+			'total',
+			'total_average'
+		);
+		break;
+	}
+	
+	return array($arrTitleCol, $arrDataCol);
+}
+
+// É¬Í×¤Ê¥«¥é¥à¤Î¤ßÃê½Ð¤¹¤ë(CSV¥Ç¡¼¥¿¤Ç¼èÆÀ¤¹¤ë)
+function lfGetDataColCSV($arrData, $arrDataCol) {
+	$max = count($arrData);
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrDataCol as $val) {		
+			$arrRet[$i][$val] = $arrData[$i][$val];
+		}
+		$csv_data.= sfGetCSVList($arrRet[$i]);
+	}
+	return $csv_data;
+}
+
+// É¬Í×¤Ê¥«¥é¥à¤Î¤ßÃê½Ð¤¹¤ë(PDF¥Ç¡¼¥¿¤Ç¼èÆÀ¤¹¤ë)
+function lfGetDataColPDF($arrData, $arrDataCol, $len) {
+	$max = count($arrData);
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrDataCol as $val) {		
+			$arrRet[$i][$val] = sfCutString($arrData[$i][$val], $len);
+		}
+		$csv_data.= sfGetPDFList($arrRet[$i]);
+	}
+	return $csv_data;
+}
+
+
+?>
Index: /temp/trunk/html/admin/system/index.php
===================================================================
--- /temp/trunk/html/admin/system/index.php	(revision 1328)
+++ /temp/trunk/html/admin/system/index.php	(revision 1328)
@@ -0,0 +1,65 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $tpl_category;	// Ê¬Îà(HOME:1,¿ÍÊªÅÐÏ¿:2,¿ÍÊª¸¡º÷:3,¥·¥¹¥Æ¥à:4,¥í¥°¥¢¥¦¥È:5)
+	var $list_data;		// ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¼èÆÀÍÑ
+	var $arrAUTHORITY;
+	var $tpl_onload;
+	var $tpl_disppage;	// É½¼¨Ãæ¤Î¥Ú¡¼¥¸ÈÖ¹æ
+	var $tpl_strnavi;
+	function LC_Page() {
+		$this->tpl_mainpage = 'system/index.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';
+		$this->tpl_subno = 'index';
+		$this->tpl_onload = 'fnGetRadioChecked();';
+		$this->tpl_subtitle = '¥á¥ó¥Ð¡¼´ÉÍý';
+		global $arrAUTHORITY;
+		$this->arrAUTHORITY = $arrAUTHORITY;
+	}
+}
+
+// ¥»¥Ã¥·¥ç¥ó¥¯¥é¥¹
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$conn = new SC_DbConn();
+
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤ÎÊÝ»ý¥¯¥é¥¹
+$objPage = new LC_Page();
+// SQLºîÀ®ÍÑ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+$objSql = new SC_SelectSql();
+$objSql->setSelect("SELECT member_id,name,department,login_id,authority,rank,work FROM dtb_member");
+$objSql->setOrder("rank DESC");
+$objSql->setWhere("delete <> 1 AND member_id <> ". ADMIN_ID);
+
+//´Ê°×¥¯¥¨¥ê¼Â¹Ô¥ª¥Ö¥¸¥§¥¯¥È
+$oquery = new SC_Query();
+// ¹Ô¿ô¤Î¼èÆÀ
+$linemax = $oquery->count("dtb_member", "delete <> 1 AND member_id <>".ADMIN_ID);
+
+// ·ï¿ô¤¬°ì·ï¤·¤«¤Ê¤¤¾ì¹ç¤Ï¡¢°ÜÆ°Í÷¤Ë"-"¤òÉ½¼¨¤¹¤ë¡£
+if($linemax == 1){
+	$objPage->tpl_nomove = "-";
+}
+
+// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+$objNavi = new SC_PageNavi($_GET['pageno'], $linemax, MEMBER_PMAX, "fnMemberPage", NAVI_PMAX);
+$objPage->tpl_strnavi = $objNavi->strnavi;
+$objPage->tpl_disppage = $objNavi->now_page;
+$objPage->tpl_pagemax = $objNavi->max_page;
+$startno = $objNavi->start_row;
+
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objSql->setLimitOffset(MEMBER_PMAX, $startno);
+$objPage->list_data = $conn->getAll($objSql->getSql());
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$objView = new SC_AdminView();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+?>
Index: /temp/trunk/html/admin/system/csv.php
===================================================================
--- /temp/trunk/html/admin/system/csv.php	(revision 1328)
+++ /temp/trunk/html/admin/system/csv.php	(revision 1328)
@@ -0,0 +1,8 @@
+"¥¢¥Ã¥×¥Ç¡¼¥Èµ¡Ç½ID","¥Õ¥¡¥¤¥ëÌ¾","µ¡Ç½Ì¾","µ¡Ç½ÀâÌÀ","¥Ð¡¼¥¸¥ç¥ó","ºÇ½ª¹¹¿·Æü»þ"
+"1","DB.tgz","DB´ÉÍýµ¡Ç½","DB¤ò´ÉÍý¤¹¤ëµ¡Ç½¤Ç¤¹¡£","1.0","2006Ç¯£µ·î£±£¶Æü"
+"2","Smarty.tar.gz","¥¹¥Þ¡¼¥Æ¥£¡¼µ¡Ç½","¥¹¡¼¥Þ¡¼¥Æ¥£¡¼µ¡Ç½¤Ç¤¹","2.3","£²£°£°£¶Ç¯£µ·î£±£¶Æü"
+"3","Mail.tgz","¥á¡¼¥ë","¤³¤ì¤Þ¤¿¥Û¥²µ¡Ç½¤Î¥ê¥ê¡¼¥¹¤Ç¤¹","3.5","2006Ç¯5·î£²£³Æü"
+"4","PEAR.tgz","PEARµ¡Ç½","Íü¤Ç¤Ï¤Ê¤¤¤è¤ó","2.2","2006Ç¯8·î1Æü"
+"5","upload_file.tgz","¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë·²","¤­¤ç¡¼¤ì¤Ä¤Ñ¤Ã¤±¡¼¤¸¡ª","10.3","2006/4/5"
+"6","Mail_Mime.tgz","¤á¡¼¤ë¤Þ¤¤¤à","¤­¤ç¡¼¤ì¤Ä¤Ñ¤Ã¤±¡¼¤¸¡ª¤á¡¼¤ë¤Þ¤¤¤à","10.3","2006/4/5"
+"7","point.tgz","¥Ý¥¤¥ó¥ÈÉÕÍ¿µ¡Ç½","¾¦ÉÊ¤Ë¥Ý¥¤¥ó¥È¤òÉÕÍ¿¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£","10.3","2006/4/5"
Index: /temp/trunk/html/admin/system/rank.php
===================================================================
--- /temp/trunk/html/admin/system/rank.php	(revision 1328)
+++ /temp/trunk/html/admin/system/rank.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+require_once("../require.php");
+
+$conn = new SC_DbConn();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥é¥ó¥­¥ó¥°¤ÎÊÑ¹¹
+if($_GET['move'] == 'up') {
+	// ÀµÅö¤Ê¿ôÃÍ¤Ç¤¢¤Ã¤¿¾ì¹ç
+	if(sfIsInt($_GET['id'])){
+		lfRunkUp($conn, $_GET['id']);
+	} else {
+		// ¥¨¥é¡¼½èÍý
+		gfPrintLog("error id=".$_GET['id']);
+	}
+} else if($_GET['move'] == 'down') {
+	if(sfIsInt($_GET['id'])){
+		lfRunkDown($conn, $_GET['id']);
+	}  else {
+		// ¥¨¥é¡¼½èÍý
+		gfPrintLog("error id=".$_GET['id']);
+	}
+}
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
+header($location);
+
+// ¥é¥ó¥­¥ó¥°¤ò¾å¤²¤ë¡£
+function lfRunkUp($conn, $id) {
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$rank = $conn->getOne("SELECT rank FROM dtb_member WHERE member_id = ".$id);
+	// ¥é¥ó¥¯¤ÎºÇÂçÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+	$maxno = $conn->getOne("SELECT max(rank) FROM dtb_member");
+	// ¥é¥ó¥¯¤¬ºÇÂçÃÍ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank < $maxno) {
+		// ¥é¥ó¥¯¤¬¤Ò¤È¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$sqlse = "SELECT member_id FROM dtb_member WHERE rank = ?";
+		$up_id = $conn->getOne($sqlse, $rank + 1);
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$conn->query("BEGIN");
+		$sqlup = "UPDATE dtb_member SET rank = ? WHERE member_id = ?";
+		$conn->query($sqlup, array($rank + 1, $id));
+		$conn->query($sqlup, array($rank, $up_id));
+		$conn->query("COMMIT");
+	}
+}
+
+// ¥é¥ó¥­¥ó¥°¤ò²¼¤²¤ë¡£
+function lfRunkDown($conn, $id) {
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$rank = $conn->getOne("SELECT rank FROM dtb_member WHERE member_id = ".$id);
+	// ¥é¥ó¥¯¤ÎºÇ¾®ÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+	$minno = $conn->getOne("SELECT min(rank) FROM dtb_member");
+	// ¥é¥ó¥¯¤¬ºÇÂçÃÍ¤è¤ê¤âÂç¤­¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank > $minno) {
+		// ¥é¥ó¥¯¤¬¤Ò¤È¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$sqlse = "SELECT member_id FROM dtb_member WHERE rank = ?";
+		$down_id = $conn->getOne($sqlse, $rank - 1);
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$conn->query("BEGIN");
+		$sqlup = "UPDATE dtb_member SET rank = ? WHERE member_id = ?";
+		$conn->query($sqlup, array($rank - 1, $id));
+		$conn->query($sqlup, array($rank, $down_id));
+		$conn->query("COMMIT");
+	}
+}	
+?>
Index: /temp/trunk/html/admin/system/check.php
===================================================================
--- /temp/trunk/html/admin/system/check.php	(revision 1328)
+++ /temp/trunk/html/admin/system/check.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+/*
+ *		check.php ²ÔÆ¯¡¦Èó²ÔÆ¯¤ÎÀÚÂØ
+ */
+require_once("../require.php");
+
+$conn = new SC_DbConn();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// GETÃÍ¤ÎÀµÅöÀ­¤òÈ½Äê¤¹¤ë
+if(sfIsInt($_GET['id']) && ($_GET['no'] == 1 || $_GET['no'] == 0)){
+	$sqlup = "UPDATE dtb_member SET work = ? WHERE member_id = ?";
+	$conn->query($sqlup, array($_GET['no'], $_GET['id']));
+} else {
+	// ¥¨¥é¡¼½èÍý
+	gfPrintLog("error id=".$_GET['id']);
+}
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
+header($location);
+?>
Index: /temp/trunk/html/admin/system/input.php
===================================================================
--- /temp/trunk/html/admin/system/input.php	(revision 1328)
+++ /temp/trunk/html/admin/system/input.php	(revision 1328)
@@ -0,0 +1,192 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	var $arrErr;		// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸½ÐÎÏÍÑ
+	var $tpl_recv;		// ÆþÎÏ¾ðÊóPOSTÀè
+	var $tpl_onload;	// ¥Ú¡¼¥¸ÆÉ¤ß¹þ¤ß»þ¤Î¥¤¥Ù¥ó¥È
+	var $arrForm;		// ¥Õ¥©¡¼¥à½ÐÎÏÍÑ
+	var $tpl_mode;		// ¿·µ¬ºîÀ®:new or ÊÔ½¸:edit
+	var $tpl_member_id; // ÊÔ½¸»þ¤Ë»ÈÍÑ¤¹¤ë¡£
+	var $tpl_pageno;
+	var $tpl_onfocus;	// ¥Ñ¥¹¥ï¡¼¥É¹àÌÜÁªÂò»þ¤Î¥¤¥Ù¥ó¥ÈÍÑ
+	var $tpl_old_login_id;
+	function LC_Page() {
+		$this->tpl_recv =  'input.php';
+		$this->tpl_pageno = $_REQUEST['pageno'];
+		$this->SHORTTEXT_MAX = STEXT_LEN;
+		$this->MIDDLETEXT_MAX = MTEXT_LEN;
+		$this->LONGTEXT_MAX = LTEXT_LEN;
+		global $arrAUTHORITY;
+		$this->arrAUTHORITY = $arrAUTHORITY;
+	}
+}
+
+$conn = new SC_DbConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// member_id¤¬»ØÄê¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢ÊÔ½¸¥â¡¼¥É¤È¤¹¤ë¡£
+if(sfIsInt($_GET['id'])) {
+	$objPage->tpl_mode = 'edit';
+	$objPage->tpl_member_id = $_GET['id'];
+	$objPage->tpl_onfocus = "fnClearText(this.name);";
+	// DB¤Î¥á¥ó¥Ð¡¼¾ðÊó¤òÆÉ¤ß½Ð¤¹
+	$data_list = fnGetMember($conn, $_GET['id']);
+	// ³ºÅö¥æ¡¼¥¶¤òÉ½¼¨¤µ¤»¤ë
+	$objPage->arrForm = $data_list[0];
+	// ¥À¥ß¡¼¤Î¥Ñ¥¹¥ï¡¼¥É¤ò¥»¥Ã¥È¤·¤Æ¤ª¤¯¡£
+	$objPage->arrForm['password'] = DUMMY_PASS;
+	// ¥í¥°¥¤¥óID¤òÊÝ´É¤·¤Æ¤ª¤¯¡£
+	$objPage->tpl_old_login_id = $data_list[0]['login_id'];
+} else {
+	// ¿·µ¬ºîÀ®¥â¡¼¥É
+	$objPage->tpl_mode = "new";
+	$objPage->arrForm['authority'] = -1;
+}
+
+// ¿·µ¬ºîÀ®¥â¡¼¥É or ÊÔ½¸¥â¡¼¥É
+if( $_POST['mode'] == 'new' || $_POST['mode'] == 'edit') {
+	// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = fnErrorCheck($conn);
+	
+	// ÆþÎÏ¤¬Àµ¾ï¤Ç¤¢¤Ã¤¿¾ì¹ç¤Ï¡¢DB¤Ë½ñ¤­¹þ¤à
+	if(count($objPage->arrErr) == 0) {
+		if($_POST['mode'] == 'new') {
+			// ¥á¥ó¥Ð¡¼¤ÎÄÉ²Ã
+			fnInsertMember();
+			// ¥ê¥í¡¼¥É¤Ë¤è¤ëÆó½ÅÅÐÏ¿ÂÐºö¤Î¤¿¤á¡¢Æ±¤¸¥Ú¡¼¥¸¤ËÈô¤Ð¤¹¡£
+			header("Location: ". $_SERVER['PHP_SELF'] . "?mode=reload");	
+			exit;
+		}
+		if($_POST['mode'] == 'edit') {
+			// ¥á¥ó¥Ð¡¼¤ÎÄÉ²Ã
+			if(fnUpdateMember($_POST['member_id'])) {
+				// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¹¹¿·¸å¡¢¼«¥¦¥£¥ó¥É¥¦¤òÊÄ¤¸¤ë¡£
+				$url = URL_SYSTEM_TOP . "?pageno=".$_POST['pageno'];
+				$objPage->tpl_onload="fnUpdateParent('".$url."'); window.close();";
+			}
+		}
+	// ÆþÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç
+	} else {
+		// ¥â¡¼¥É¤ÎÀßÄê
+		$objPage->tpl_mode = $_POST['mode'];
+		$objPage->tpl_member_id = $_POST['member_id'];
+		$objPage->tpl_old_login_id = $_POST['old_login_id'];
+		// ¤¹¤Ç¤ËÆþÎÏ¤·¤¿ÃÍ¤òÉ½¼¨¤¹¤ë¡£
+		$objPage->arrForm = $_POST;
+		// ÄÌ¾ïÆþÎÏ¤Î¥Ñ¥¹¥ï¡¼¥É¤Ï°ú¤­·Ñ¤¬¤Ê¤¤¡£
+		if($objPage->arrForm['password'] != DUMMY_PASS) {
+			$objPage->arrForm['password'] = '';
+		}
+	}
+}
+
+// ¥ê¥í¡¼¥É¤Î»ØÄê¤¬¤¢¤Ã¤¿¾ì¹ç
+if( $_GET['mode'] == 'reload') {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¹¹¿·¤¹¤ë¤è¤¦¤Ë¥»¥Ã¥È¤¹¤ë¡£
+	$url = URL_SYSTEM_TOP;
+	$objPage->tpl_onload="fnUpdateParent('".$url."')";
+}
+
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÍÑÊÑ¿ô¤Î³ä¤êÅö¤Æ
+$objView->assignobj($objPage);
+$objView->display('system/input.tpl');
+
+/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
+function fnErrorCheck($conn) {
+	
+	$objErr = new SC_CheckError();
+	
+	$_POST["name"] = mb_convert_kana($_POST["name"] ,"KV");
+	$_POST["department"] = mb_convert_kana($_POST["department"] ,"KV");
+	
+	// Ì¾Á°¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("Ì¾Á°",'name'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("Ì¾Á°",'name',STEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
+	
+	// ÊÔ½¸¥â¡¼¥É¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢½ÅÊ£¥Á¥§¥Ã¥¯
+	if (!isset($objErr->arrErr['name']) && $_POST['mode'] != 'edit') {
+		$sql = "SELECT name FROM dtb_member WHERE delete <> 1 AND name = ?";
+		$result = $conn->getOne($sql, array($_POST['name'])); 
+		if ( $result ) {
+			$objErr->arrErr['name'] = "´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÌ¾Á°¤Ê¤Î¤ÇÍøÍÑ¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+		
+	// ¥í¥°¥¤¥óID¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("¥í¥°¥¤¥óID",'login_id'), array("EXIST_CHECK", "ALNUM_CHECK"));
+	$objErr->doFunc(array("¥í¥°¥¤¥óID",'login_id',ID_MIN_LEN , ID_MAX_LEN) ,array("NUM_RANGE_CHECK"));
+	
+	// ¿·µ¬¥â¡¼¥É¤â¤·¤¯¤Ï¡¢ÊÔ½¸¥â¡¼¥É¤Ç¥í¥°¥¤¥óID¤¬ÊÑ¹¹¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	if (!isset($objErr->arrErr['login_id']) && $_POST['mode'] != 'edit' || ($_POST['mode'] == 'edit' && $_POST['login_id'] != $_POST['old_login_id'])) {
+		$sql = "SELECT login_id FROM dtb_member WHERE delete <> 1 AND login_id = ?";
+		$result = $conn->getOne($sql, array($_POST['login_id'])); 
+		if ( $result != "" ) {
+			$objErr->arrErr['login_id'] = "´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëID¤Ê¤Î¤ÇÍøÍÑ¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¥Á¥§¥Ã¥¯(ÊÔ½¸¥â¡¼¥É¤ÇDUMMY_PASS¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥¹¥ë¡¼¤¹¤ë)
+	if(!($_POST['mode'] == 'edit' && $_POST['password'] == DUMMY_PASS)) { 
+		$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É",'password'), array("EXIST_CHECK", "ALNUM_CHECK"));
+		if (!$arrErr['password']) {
+			// ¥Ñ¥¹¥ï¡¼¥É¤Î¥Á¥§¥Ã¥¯
+			$objErr->doFunc( array("¥Ñ¥¹¥ï¡¼¥É",'password',4 ,15 ) ,array( "NUM_RANGE_CHECK" ) );	
+		}
+	}
+	
+	// ¸¢¸Â¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("¸¢¸Â",'authority'),array("EXIST_CHECK"));
+	return $objErr->arrErr;
+}
+
+/* DB¤Ø¤Î¥Ç¡¼¥¿ÁÞÆþ */
+function fnInsertMember() {
+	// ¥¯¥¨¥ê¡¼¥¯¥é¥¹¤ÎÀë¸À
+	$oquery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['department'] = $_POST['department'];
+	$sqlval['login_id'] = $_POST['login_id'];
+	$sqlval['password'] = crypt($_POST['password']);
+	$sqlval['authority'] = $_POST['authority'];
+	$sqlval['rank']=  $oquery->max("dtb_member", "rank") + 1;
+	$sqlval['work'] = "1"; // ²ÔÆ¯¤ËÀßÄê
+	$sqlval['delete'] = "0";	// ºï½ü¥Õ¥é¥°¤òOFF¤ËÀßÄê
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	// INSERT¤Î¼Â¹Ô
+	$ret = $oquery->insert("dtb_member", $sqlval);
+	return $ret;
+}
+
+/* DB¤Ø¤Î¥Ç¡¼¥¿¹¹¿· */
+function fnUpdateMember($id) {
+	// ¥¯¥¨¥ê¡¼¥¯¥é¥¹¤ÎÀë¸À
+	$oquery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['department'] = $_POST['department'];
+	$sqlval['login_id'] = $_POST['login_id'];
+	if($_POST['password'] != DUMMY_PASS) {
+		$sqlval['password'] = crypt($_POST['password']);
+	}
+	$sqlval['authority'] = $_POST['authority'];
+	$sqlval['update_date'] = "now()";
+	// UPDATE¤Î¼Â¹Ô
+	$where = "member_id = " . $id;
+	$ret = $oquery->update("dtb_member", $sqlval, $where);
+	return $ret;
+}
+
+/* DB¤«¤é¥Ç¡¼¥¿¤ÎÆÉ¤ß¹þ¤ß */
+function fnGetMember($conn, $id) {
+	$sqlse = "SELECT name,department,login_id,authority FROM dtb_member WHERE member_id = ?";
+	$ret = $conn->getAll($sqlse, Array($id));
+	return $ret;
+}
+?>
Index: /temp/trunk/html/admin/system/Copy of update.php
===================================================================
--- /temp/trunk/html/admin/system/Copy of update.php	(revision 1328)
+++ /temp/trunk/html/admin/system/Copy of update.php	(revision 1328)
@@ -0,0 +1,266 @@
+<?php
+$now_dir = realpath(dirname(__FILE__));
+require_once($now_dir . "/../../../data/lib/slib.php");	
+require_once($now_dir . "/../../../data/class/SC_View.php");
+require_once($now_dir . "/../../../data/class/SC_Query.php");
+require_once($now_dir . "/../../../data/class/SC_CheckError.php");
+require_once($now_dir . "/../../../data/class/SC_FormParam.php");
+require_once($now_dir . "/../../../data/class/SC_Customer.php");
+require_once($now_dir . "/../../../data/class/SC_Cookie.php");
+//require_once($now_dir . "/../../../data/module/Archive/Tar.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'system/update.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';		
+		$this->tpl_subno = 'update';
+		$this->tpl_subtitle = '¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+/*
+//¥¢¥Ã¥×¥Ç¡¼¥È¾ðÊó¤ò¼èÆÀ
+$fp = fopen("csv.php", "r");
+$i = 0;
+$j = 0;
+$k = 0;
+//¥Õ¥¡¥¤¥ë¼èÆÀÀ®¸ù
+if($fp) {
+	//CSV¾ðÊó¤òÇÛÎó¤Ë³ÊÇ¼
+	while(!feof($fp)) {
+		$line = fgetcsv($fp, 40000);
+		$arrRet[$i]['update_id'] = $line[0];		//¥¢¥Ã¥×¥Ç¡¼¥Èµ¡Ç½ID
+		$arrRet[$i]['file_name'] = $line[1];		//¥Õ¥¡¥¤¥ëÌ¾
+		$arrRet[$i]['func_name'] = $line[2];		//µ¡Ç½Ì¾
+		$arrRet[$i]['func_explain'] = $line[3];		//µ¡Ç½ÀâÌÀ
+		$arrRet[$i]['version'] = $line[4];			//¥Ð¡¼¥¸¥ç¥ó
+		$arrRet[$i]['update_date'] = $line[5];		//ºÇ½ª¹¹¿·Æü»þ
+		if($i >= 1) {
+			$arrval = array($arrRet[$i]['update_id'], $arrRet[$i]['version']);
+			//´û¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ëµ¡Ç½¤«¤É¤¦¤«¥Á¥§¥Ã¥¯
+			$arrGet = $objQuery->select("*", "dtb_update_list", "update_id = ? AND version = ? ", $arrval);
+			//¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß
+			if(count($arrGet) > 0) {
+				$arrInstalled[$k] = $arrGet[0];
+				$k++;
+			} else {
+				$arrUpList[$j] = $arrRet[$i];
+				$j++;
+			}
+		}
+		$i++;
+	}
+	//¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß
+	$objPage->arrInstalled = $arrInstalled;
+	//¥¢¥Ã¥×¥Ç¡¼¥È²ÄÇ½µ¡Ç½°ìÍ÷
+	$objPage->arrUpList = $arrUpList;
+}
+
+//³ÎÇ§²èÌÌ
+if($_POST['mode'] == 'confirm' && sfIsInt($_POST['update_id'])) {
+	//¥Æ¥ó¥×¥ì¡¼¥È»ØÄê
+	$objPage->tpl_mainpage = "system/update_confirm.tpl";
+	//¥¢¥Ã¥×¥Ç¡¼¥Èµ¡Ç½ID
+	$update_id = $_POST['update_id'];
+	//¥Õ¥¡¥¤¥ëÌ¾
+	$comp_file = trim($arrRet[$update_id]['file_name']);
+	//FTPÀÜÂ³
+	$con = ftp_connect("localhost");
+	if($con != false) {
+		//FTP¥í¥°¥¤¥óÀ®¸ù
+		if(ftp_login($con, "osuser", "password")) {
+			//¥í¡¼¥«¥ë¤ËÊÝÂ¸¤¹¤ë¥Ñ¥¹
+			$objPage->local_save_dir = ROOT_DIR . "data/install/";
+			//¥í¡¼¥«¥ë¤ËÊÝÂ¸¤¹¤ë¥Õ¥¡¥¤¥ëÌ¾¤ò¥Ñ¥¹»ØÄê
+			$local_file = $objPage->local_save_dir . $comp_file;
+			//FTP¥À¥¦¥ó¥í¡¼¥ÉÀ®¸ù
+			if(ftp_get($con, $local_file, $comp_file, FTP_BINARY)) {
+				//FTPÀÜÂ³ÀÚÃÇ
+				ftp_quit($con);
+				//¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¡¢¥¤¥ó¥¹¥È¡¼¥ë¥Õ¥©¥ë¥À¤Ë°Ü¹Ô
+				$current_dir = getcwd();
+				//¥Ç¥£¥ì¥¯¥È¥ê¤Î°Ü¹Ô
+				chdir(ROOT_DIR . "data/install/");
+				//¥¢¡¼¥«¥¤¥Ö´ÉÍý¥¯¥é¥¹
+				$objTar = new Archive_Tar($comp_file);
+				//²òÅà¸å¤Î¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ(³ÈÄ¥»Ò¤òºï½ü¤·¤¿¥Õ¥¡¥¤¥ë)
+				$extract_file = ereg_replace("\.tar\.gz|\.tar|\.gz|\.tgz", "", $comp_file);
+				//¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤òÉ½¼¨
+				$arrRet = $objTar->listcontent();
+				foreach($arrRet as $data) {
+					//PHP¥Õ¥¡¥¤¥ë¤â¤·¤¯¤Ïtpl¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë
+					if(ereg("\.php$|\.tpl$", $data['filename'])) {
+						$main_file = ereg_replace($extract_file . "/", "", $data['filename']);
+						$arrFile[]['main_file'] = ROOT_DIR . $main_file; 
+					}
+					//sql¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë
+					if(ereg("\.sql$", $data['filename'])) {
+						//¥Õ¥¡¥¤¥ëÌ¾¤«¤éDBÌ¾¤ò¼èÆÀ¤¹¤ë
+						$sql_file = ereg_replace($extract_file . "/", "", $data['filename']);
+						$db_name = ereg_replace("\.sql$", "", $sql_file);
+						$arrFile[]['sql_file'] = $db_name;
+					}
+				}
+				$objPage->arrFile = $arrFile;
+				//°µ½Ì¥Õ¥¡¥¤¥ë¤Îºï½ü
+				unlink($comp_file);
+				//¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¸µ¤ËÌá¤¹
+				chdir($current_dir);
+			} else {
+				//FTP¥À¥¦¥ó¥í¡¼¥É¥¨¥é¡¼
+				sfDispSiteError(FTP_DOWNLOAD_ERROR);
+			}
+		} else {
+			//FTP¥í¥°¥¤¥ó¥¨¥é¡¼
+			sfDispSiteError(FTP_LOGIN_ERROR);
+		}
+	} else {
+		//FTPÀÜÂ³¥¨¥é¡¼
+		sfDispSiteError(FTP_CONNECT_ERROR);
+	}
+}
+
+
+
+//¥¢¥Ã¥×¥Ç¡¼¥Èµ¡Ç½¤Î¥¤¥ó¥¹¥È¡¼¥ë
+if($_POST['mode'] == 'install' && sfIsInt($_POST['update_id'])) {
+	//¥¢¥Ã¥×¥Ç¡¼¥Èµ¡Ç½ID
+	$update_id = $_POST['update_id'];
+	//¥Õ¥¡¥¤¥ëÌ¾
+	$comp_file = trim($arrRet[$update_id]['file_name']);
+	//FTPÀÜÂ³
+	$con = ftp_connect("localhost");
+	if($con != false) {
+		//FTP¥í¥°¥¤¥óÀ®¸ù
+		if(ftp_login($con, "osuser", "password")) {
+			//¥í¡¼¥«¥ë¤ËÊÝÂ¸¤¹¤ë¥Ñ¥¹¤ò»ØÄê
+			$objPage->local_save_dir = ROOT_DIR . "data/install/";
+			//¥í¡¼¥«¥ë¤ËÊÝÂ¸¤¹¤ë¥Õ¥¡¥¤¥ëÌ¾¤ò¥Ñ¥¹»ØÄê
+			$local_file = ROOT_DIR . "data/install/" . $comp_file;
+			//FTP¥À¥¦¥ó¥í¡¼¥ÉÀ®¸ù
+			if(ftp_get($con, $local_file, $comp_file, FTP_BINARY)) {
+				//FTPÀÜÂ³ÀÚÃÇ
+				ftp_quit($con);
+				//¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¡¢¥¤¥ó¥¹¥È¡¼¥ë¥Õ¥©¥ë¥À¤Ë°Ü¹Ô
+				$current_dir = getcwd();
+				//¥Ç¥£¥ì¥¯¥È¥ê¤Î°Ü¹Ô
+				chdir(ROOT_DIR . "data/install/");
+				//¥¢¡¼¥«¥¤¥Ö´ÉÍý¥¯¥é¥¹
+				$objTar = new Archive_Tar($comp_file, true);
+				//¥¨¥é¡¼¤Î¾ÜºÙ¤òÊÖ¤¹
+				//$objTar->setErrorHandling(PEAR_ERROR_PRINT);
+				//²òÅàÀ®¸ù
+				if($objTar->extract("./")) {
+					//°µ½Ì¥Õ¥¡¥¤¥ë¤òºï½ü
+					unlink($comp_file);
+					//²òÅà¸å¤Î¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ(³ÈÄ¥»Ò¤òºï½ü¤·¤¿¥Õ¥¡¥¤¥ë)
+					$extract_file = ereg_replace("\.tar\.gz|\.tar|\.gz|\.tgz", "", $comp_file);
+					//²òÅà¸å¤Î¿Æ¥Õ¥¡¥¤¥ë¤òÊÑ¿ô¤ËÅÏ¤¹
+					$extract_top_file = $extract_file;
+					//¥¤¥ó¥¹¥È¡¼¥ëÀ®¸ù¤Î¥Õ¥é¥°
+					$install_flag = true;
+					//²òÅà¥Õ¥¡¥¤¥ë¤Ë¤è¤ê¡¢¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤¹¤ë
+					$flag = lfSetExtractFile($extract_file, $extract_top_file, $install_flag);
+					//¥Õ¥¡¥¤¥ë¤Î¾å½ñ¤­¤¬À®¸ù
+					if($flag) {
+						//³ÊÇ¼¤¹¤ë¥­¡¼¤ÈÃÍ¤ò»ØÄê
+						$sqlval['update_id'] = $update_id;
+						$sqlval['func_name'] = $arrRet[$update_id]['func_name'];
+						$sqlval['func_explain'] = $arrRet[$update_id]['func_explain'];
+						$sqlval['version'] = $arrRet[$update_id]['version'];
+						$sqlval['update_date'] = 'now()';
+						
+						//¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍý¥Æ¡¼¥Ö¥ë¤Ë¾ðÊó¤ò³ÊÇ¼
+						$objQuery->insert("dtb_update_list", $sqlval);
+						//¥Õ¥¡¥¤¥ë¤Îºï½ü
+						system("rm -rf ". $extract_file);
+						//¾ðÊó¤ò¹¹¿·
+						sfReload();
+					} else {
+						sfDispSiteError(WRITE_FILE_ERROR);
+					}
+
+				} else {
+					//¥Õ¥¡¥¤¥ë²òÅà¥¨¥é¡¼
+					sfDispSiteError(EXTRACT_ERROR);
+				}
+				//¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¸µ¤ËÌá¤¹
+				chdir($current_dir);
+				
+			} else {
+				//FTP¥À¥¦¥ó¥í¡¼¥É¥¨¥é¡¼
+				sfDispSiteError(FTP_DOWNLOAD_ERROR);
+			}
+		} else {
+			//FTP¥í¥°¥¤¥ó¥¨¥é¡¼
+			sfDispSiteError(FTP_LOGIN_ERROR);
+		}
+	} else {
+		//FTPÀÜÂ³¥¨¥é¡¼
+		sfDispSiteError(FTP_CONNECT_ERROR);
+	}
+}
+*/
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(MAIN_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+
+//-------------------------------------------------------------------------------------------------------
+
+//²òÅà¥Õ¥¡¥¤¥ë¤Ë¤è¤ê¡¢¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤¹¤ë
+function lfSetExtractFile($extract_file, $extract_top_file, $install_success) {
+	//¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤±¤ì¤Ð
+	if(!is_dir($extract_file)) {
+		return false;
+	}
+
+	//¥Ç¥£¥ì¥¯¥È¥ê¤ò³«¤¯
+	if($handle = opendir($extract_file)) {
+		//¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¿È¤òÆÉ¤ß¹þ¤à
+		while($file = readdir($handle)) {
+			//'.'¤È'..'¥Õ¥¡¥¤¥ë¤Ï½ü³°
+			if($file != "." && $file != "..") {
+				//¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë
+				if(is_dir($extract_file . "/" . $file)) {
+					//ºÆµ¢¸Æ¤Ó½Ð¤·
+					lfSetExtractFile($extract_file . "/" . $file, $extract_top_file, $install_success);
+				} else {
+					//¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë
+					if(is_file($extract_file . "/" . $file)) {
+						//sql¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë
+						if(ereg("\.sql$", $file)) {
+							//¥Õ¥¡¥¤¥ë¤ò¼è¤êÆþ¤ì¤ë
+							require_once($extract_file . "/" . $file);
+							//¥¯¥¨¥ê¡¼¼Â¹Ô¥¯¥é¥¹
+							$objQuery = new SC_Query;
+							//¥¯¥¨¥ê¡¼¤Î¼Â¹Ô
+							$objQuery->query($sql);
+						} else {
+							//²òÅà¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê
+							$replace_file = ereg_replace("^" . $extract_top_file . "/", "", $extract_file);
+							//¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼(¾å½ñ¤­)¤¹¤ë
+							if(!copy($extract_file . "/" . $file, ROOT_DIR . $replace_file . "/" . $file)) {
+								$install_success = false;
+							}
+						} 
+					}
+				}
+			}
+		}
+		//¥Ç¥£¥ì¥¯¥È¥ê¤òÊÄ¤¸¤ë
+		closedir($handle);
+	} else {
+		$install_success = false;
+	}
+	return $install_success;
+	
+}	
+
+?>
Index: /temp/trunk/html/admin/system/delete.php
===================================================================
--- /temp/trunk/html/admin/system/delete.php	(revision 1328)
+++ /temp/trunk/html/admin/system/delete.php	(revision 1328)
@@ -0,0 +1,47 @@
+<?php
+require_once("../require.php");
+
+$conn = new SC_DbConn();
+$oquery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// member_id¤Î¥Á¥§¥Ã¥¯
+if(sfIsInt($_GET['id'])){
+	// ¥ì¥³¡¼¥É¤Îºï½ü
+	$conn->query("BEGIN");
+	fnRenumberRank($conn, $oquery, $_GET['id']);
+	fnDeleteRecord($conn, $_GET['id']);
+	$conn->query("COMMIT");
+} else {
+	// ¥¨¥é¡¼½èÍý
+	gfPrintLog("error id=".$_GET['id']);
+}
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
+header($location);
+
+// ¥é¥ó¥­¥ó¥°¤Î¿¶¤êÄ¾¤·
+function fnRenumberRank($conn, $oquery, $id) {
+	$where = "member_id = $id";
+	// ¥é¥ó¥¯¤Î¼èÆÀ
+	$rank = $oquery->get("dtb_member", "rank", $where);
+	// ºï½ü¤·¤¿¥ì¥³¡¼¥É¤è¤ê¾å¤Î¥é¥ó¥­¥ó¥°¤ò²¼¤²¤ÆRANK¤Î¶õ¤­¤òËä¤á¤ë¡£
+	$sqlup = "UPDATE dtb_member SET rank = (rank - 1) WHERE rank > $rank AND delete <> 1";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $conn->query($sqlup);
+	return $ret;
+}
+
+// ¥ì¥³¡¼¥É¤Îºï½ü(ºï½ü¥Õ¥é¥°¤òON¤Ë¤¹¤ë)
+function fnDeleteRecord($conn, $id) {
+	// ¥é¥ó¥¯¤òºÇ²¼°Ì¤Ë¤¹¤ë¡¢DEL¥Õ¥é¥°ON
+	$sqlup = "UPDATE dtb_member SET rank = 0, delete = 1 WHERE member_id = $id";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $conn->query($sqlup);
+	return $ret;
+}
+?>
Index: /temp/trunk/html/admin/system/member_csv.php
===================================================================
--- /temp/trunk/html/admin/system/member_csv.php	(revision 1328)
+++ /temp/trunk/html/admin/system/member_csv.php	(revision 1328)
@@ -0,0 +1,41 @@
+<?php
+require_once("../require.php");
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$data = lfGetCSVData();
+sfCSVDownload($data);
+exit();
+
+function lfGetCSVData() {
+	global $arrAUTHORITY;
+	global $arrWORK;
+	
+	$oquery = new SC_Query();
+	$cols = "authority,name,department,login_id,work";
+	$oquery->setwhere("delete <> 1");
+	$oquery->andwhere("member_id <> ".ADMIN_ID);
+	$oquery->setoption("ORDER BY rank DESC");
+	$list_data = $oquery->select($cols, "dtb_member");
+	$max = count($list_data);
+	
+	for($i = 0; $i < $max; $i++ ){
+		$line = "";
+		$line .= "\"".$arrAUTHORITY[$list_data[$i]['authority']]."\",";
+		$tmp = ereg_replace("\"","\"\"",$list_data[$i]['name']);
+		$line .= "\"".$tmp."\",";
+		$tmp = ereg_replace("\"","\"\"",$list_data[$i]['department']);
+		$line .= "\"".$tmp."\",";
+		$tmp = ereg_replace("\"","\"\"",$list_data[$i]['login_id']);
+		$line .= "\"".$tmp."\",";
+		$line .= "\"".$arrWORK[$list_data[$i]['work']]."\"\n";
+		$data .= $line;
+	}
+	
+	$header = "\"¸¢¸Â\",\"Ì¾Á°\",\"½êÂ°\",\"¥í¥°¥¤¥óID\",\"²ÔÆ¯¾õ¶·\"\n";
+	
+	return $header.$data;
+}
+?>
Index: /temp/trunk/html/admin/system/update.php
===================================================================
--- /temp/trunk/html/admin/system/update.php	(revision 1328)
+++ /temp/trunk/html/admin/system/update.php	(revision 1328)
@@ -0,0 +1,242 @@
+<?php
+require_once("../require.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'system/update.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';		
+		$this->tpl_subno = 'update';
+		$this->tpl_subtitle = '¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// ¥»¥Ã¥·¥ç¥ó¥¯¥é¥¹
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+switch($_POST['mode']) {
+// ¥¢¥Ã¥×¥Ç¡¼¥È¾ðÊó¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+case 'edit':
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	lfLoadUpdateList();
+	break;
+// ¥¤¥ó¥¹¥È¡¼¥ë
+case 'install':
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	lfLoadUpdateList();
+	// ¥â¥¸¥å¡¼¥ë·´¤Î¥¤¥ó¥¹¥È¡¼¥ë
+	lfInstallModule();
+	break;
+// ¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë
+case 'uninstall':
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	lfLoadUpdateList();
+	// ¥â¥¸¥å¡¼¥ë·´¤Î¥¤¥ó¥¹¥È¡¼¥ë	
+	lfUninstallModule();
+	break;
+default:
+	break;
+}
+
+$col = "module_id, module_name, now_version, latest_version, module_explain, create_date, release_date";
+$objQuery->setorder("module_id");
+$objPage->arrUpdate = $objQuery->select($col, "dtb_update");
+
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(MAIN_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+//-------------------------------------------------------------------------------------------------------
+// ¹¹¿·¥Õ¥¡¥¤¥ë¤Î¼èÆÀ
+function lfCopyUpdateFile($val) {
+	global $objPage;
+	
+	$src_path = sfRmDupSlash(UPDATE_HTTP . $val . ".txt");
+	$dst_path = sfRmDupSlash(ROOT_DIR . $val);
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	$src_fp = @fopen($src_path, "rb");
+	
+	if(!$src_fp) {
+		sfErrorHeader(">> " . $src_path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+		$flg_ok = false;
+	} else {
+		// ¥Õ¥¡¥¤¥ë¤ò¤¹¤Ù¤ÆÆÉ¤ß¹þ¤à
+		$contents = '';
+		while (!feof($src_fp)) {
+			$contents .= fread($src_fp, 1024);
+		}
+		fclose($src_fp);
+		
+		// ¥Ç¥£¥ì¥¯¥È¥êºîÀ®¤ò»î¤ß¤ë
+		lfMakeDirectory($dst_path);
+		// ¥Õ¥¡¥¤¥ë½ñ¹þ¤ß		
+		$dst_fp = @fopen($dst_path, "wb");
+		if(!$dst_fp) {
+			sfErrorHeader(">> " . $dst_path . "¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó¡£");
+			$flg_ok = false;
+		} else {
+			fwrite($dst_fp, $contents);
+			fclose($dst_fp);
+		}
+	}
+	
+	if($flg_ok) {
+		$objPage->update_mess.= ">> " . $dst_path . "¡§¥³¥Ô¡¼À®¸ù<br>";
+	} else {
+		$objPage->update_mess.= ">> " . $dst_path . "¡§¥³¥Ô¡¼¼ºÇÔ<br>";		
+	}
+	
+	return $flg_ok;
+}
+
+// ¤¹¤Ù¤Æ¤Î¥Ñ¥¹¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤¹¤ë
+function lfMakeDirectory($path) {
+	$pos = 0;
+	$cnt = 0;				// Ìµ¸Â¥ë¡¼¥×ÂÐºö
+	$len = strlen($path);	// Ìµ¸Â¥ë¡¼¥×ÂÐºö
+	
+	while($cnt <= $len) {
+		$pos = strpos($path, "/", $pos);
+		// ¤³¤³¤Ç¤ÎÈ½Äê¤Ï¡¢Åù¹æ3¤Ä¤ò»ÈÍÑ
+		if($pos === false) {
+			// ¥¹¥é¥Ã¥·¥å¤¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¤Ï¥ë¡¼¥×¤«¤éÈ´¤±¤ë
+			break;
+		}
+		$pos++; // Ê¸»úÈ¯¸«°ÌÃÖ¤ò°ìÊ¸»ú¿Ê¤á¤ë
+		$dir = substr($path, 0, $pos);
+		
+		// ¤¹¤Ç¤ËÂ¸ºß¤¹¤ë¤«¤É¤¦¤«Ä´¤Ù¤ë
+		if(!file_exists($dir)) {
+			mkdir($dir);
+		}
+		$cnt++; // Ìµ¸Â¥ë¡¼¥×ÂÐºö
+	}
+}
+
+// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+function lfLoadUpdateList() {
+	$objQuery = new SC_Query();
+	$path = UPDATE_HTTP . "update.txt";
+	$fp = @fopen($path, "rb");
+	
+	if(!$fp) {
+		sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+	} else {
+		while (!feof($fp)) {
+			$arrCSV = fgetcsv($fp, UPDATE_CSV_LINE_MAX);
+			// ¥«¥é¥à¿ô¤¬Àµ¾ï¤Ç¤¢¤Ã¤¿¾ì¹ç¤Î¤ß
+			if(count($arrCSV) == UPDATE_CSV_COL_MAX) {
+				// ¼èÆÀ¤·¤¿¥¢¥Ã¥×¥Ç¡¼¥È¾ðÊó¤òDB¤Ë½ñ¤­¹þ¤à
+				$sqlval['module_id'] = $arrCSV[0];
+				$sqlval['module_name'] = $arrCSV[1];
+				$sqlval['latest_version'] = $arrCSV[3];
+				$sqlval['module_explain'] = $arrCSV[4];
+				$sqlval['main_php'] = $arrCSV[5];
+				$sqlval['extern_php'] = $arrCSV[6];
+				$sqlval['sql'] = $arrCSV[7];
+				$sqlval['other_files'] = $arrCSV[8];
+				$sqlval['delete'] = $arrCSV[9];
+				$sqlval['update_date'] = "now()";
+				$sqlval['release_date'] = $arrCSV[12];
+				// ´ûÂ¸¥ì¥³¡¼¥É¤Î¥Á¥§¥Ã¥¯
+				$cnt = $objQuery->count("dtb_update", "module_id = ?", array($sqlval['module_id']));
+				if($cnt > 0) {
+					// ¤¹¤Ç¤Ë¼èÆÀ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¹¹¿·¤¹¤ë¡£	
+					$objQuery->update("dtb_update", $sqlval, "module_id = ?", array($sqlval['module_id']));
+				} else {
+					// ¿·µ¬¥ì¥³¡¼¥É¤ÎÄÉ²Ã
+					$objQuery->insert("dtb_update", $sqlval);
+				}
+			}
+		}
+		fclose($fp);
+	}
+}
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½èÍý
+function lfInstallModule() {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("module_id, extern_php, other_files, sql, latest_version", "dtb_update", "module_id = ?", array($_POST['module_id']));
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	if(count($arrRet) > 0) {
+		$arrFiles = array();
+		if($arrRet[0]['other_files'] != "") {
+			$arrFiles = split("\|", $arrRet[0]['other_files']);
+		}
+		$arrFiles[] = $arrRet[0]['extern_php'];
+		foreach($arrFiles as $val) {
+			// ¹¹¿·¥Õ¥¡¥¤¥ë¤Î¼èÆÀ
+			$ret=lfCopyUpdateFile($val);
+			if(!$ret) {
+				$flg_ok = false;
+			}
+		}
+	} else {
+		sfErrorHeader(">> ÂÐ¾Ý¤Îµ¡Ç½¤Ï¡¢ÇÛÉÛ¤ò½ªÎ»¤·¤Æ¤ª¤ê¤Þ¤¹¡£");
+		$flg_ok = false;
+	}
+	
+	// É¬Í×¤ÊSQLÊ¸¤Î¼Â¹Ô
+	if($arrRet[0]['sql'] != "") {
+		// SQLÊ¸¼Â¹Ô¡¢¥Ñ¥é¡¼¥á¡¼¥¿¤Ê¤·¡¢¥¨¥é¡¼Ìµ»ë
+		$objQuery->query($arrRet[0]['sql'],"",true);
+		$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤ò¹Ô¤¤¤Þ¤·¤¿¡£<br>";
+	}
+	
+	if($flg_ok) {
+		$sqlval['now_version'] = $arrRet[0]['latest_version'];
+		$sqlval['update_date'] = "now()";
+		$objQuery->update("dtb_update", $sqlval, "module_id = ?", array($arrRet[0]['module_id']));
+	}
+}
+
+// ¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë½èÍý
+function lfUninstallModule() {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("module_id, extern_php, other_files, sql, latest_version", "dtb_update", "module_id = ?", array($_POST['module_id']));
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	if(count($arrRet) > 0) {
+		$arrFiles = array();
+		if($arrRet[0]['other_files'] != "") {
+			$arrFiles = split("\|", $arrRet[0]['other_files']);
+		}
+		$arrFiles[] = $arrRet[0]['extern_php'];
+		foreach($arrFiles as $val) {
+			$path = ROOT_DIR . $val;
+			if(file_exists($path)) {
+				// ¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë
+				if(unlink($path)) {
+					$objPage->update_mess.= ">> " . $path . "¡§ºï½üÀ®¸ù<br>";
+				} else {
+					$objPage->update_mess.= ">> " . $path . "¡§ºï½ü¼ºÇÔ<br>";
+				}
+			}
+		}
+	} else {
+		sfErrorHeader(">> ÂÐ¾Ý¤Îµ¡Ç½¤Ï¡¢ÇÛÉÛ¤ò½ªÎ»¤·¤Æ¤ª¤ê¤Þ¤¹¡£");
+	}
+		
+	if($flg_ok) {
+		// ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òºï½ü¤¹¤ë¡£
+		$sqlval['now_version'] = "";
+		$sqlval['update_date'] = "now()";
+		$objQuery->update("dtb_update", $sqlval, "module_id = ?", array($arrRet[0]['module_id']));
+	}
+}
+
+
+?>
Index: /temp/trunk/html/admin/index.php
===================================================================
--- /temp/trunk/html/admin/index.php	(revision 1328)
+++ /temp/trunk/html/admin/index.php	(revision 1328)
@@ -0,0 +1,14 @@
+<?php
+require_once("./require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'login.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objView->assignobj($objPage);
+$objView->display(LOGIN_FRAME);
+?>
Index: /temp/trunk/html/admin/contents/index.php
===================================================================
--- /temp/trunk/html/admin/contents/index.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/index.php	(revision 1328)
@@ -0,0 +1,268 @@
+<?php
+
+require_once("../require.php");
+
+//---- Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹
+class LC_Page {
+	
+	var $arrSession;
+	var $tpl_mainpage;
+	var $sub_navipage;
+	var $regist_data;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDate;
+	var $selected_year;
+	var $selected_month;
+	var $selected_day;
+	var $list_data;
+	var $max_rank;
+	var $edit_mode;
+	var $news_title;
+	var $news_date_unix;
+	var $news_url;
+	var $link_method;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/index.tpl';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "index";
+		$this->tpl_mainno = 'contents';
+		$this->selected_year = date("Y");
+		$this->selected_month = date("n");
+		$this->selected_day = date("j");
+		$this->tpl_subtitle = '¿·Ãå¾ðÊó´ÉÍý';
+	}
+}
+
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DbConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date(ADMIN_NEWS_STARTYEAR);
+
+//----¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrYear = $objDate->getYear();
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+//----¡¡¿·µ¬ÅÐÏ¿/ÊÔ½¸ÅÐÏ¿
+if ( $_POST['mode'] == 'regist'){
+	$_POST = lfConvData($_POST);
+
+	if ($objPage->arrErr = lfErrorCheck()) {		// ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+		foreach($_POST as $key => $val) {
+			$objPage->$key = $val;
+		}
+		$objPage->selected_year = $_POST["year"];
+		$objPage->selected_month = $_POST["month"];
+		$objPage->selected_day = $_POST["day"];
+
+	} else {
+		
+		if (isset($_POST['link_method']) == ""){
+			$_POST['link_method'] = 1;
+		}
+		
+		$registDate = $_POST['year'] ."/". $_POST['month'] ."/". $_POST['day'];
+
+		//-- ÊÔ½¸ÅÐÏ¿
+		if (strlen($_POST["news_id"]) > 0 && is_numeric($_POST["news_id"])) {
+
+			lfNewsUpdate();
+
+		//--¡¡¿·µ¬ÅÐÏ¿
+		} else {
+			lfNewsInsert();
+		}
+
+		$objPage->tpl_onload = "window.alert('ÊÔ½¸¤¬´°Î»¤·¤Þ¤·¤¿');";
+	}
+}
+
+//----¡¡ÊÔ½¸¥Ç¡¼¥¿¼èÆÀ
+if ($_POST["mode"] == "search" && is_numeric($_POST["news_id"])) {
+	$sql = "SELECT *, EXTRACT(EPOCH FROM news_date) AS news_date_unix FROM dtb_news WHERE news_id = ? ";
+	$result = $conn->getAll($sql, array($_POST["news_id"]));
+	foreach($result[0] as $key => $val ){
+		$objPage->$key = $val;
+	}
+	$objPage->selected_year = date("Y", $result[0]["news_date_unix"]);		
+	$objPage->selected_month = date("m", $result[0]["news_date_unix"]);
+	$objPage->selected_day = date("d", $result[0]["news_date_unix"]);
+	$objPage->edit_mode = "on";
+}
+
+//----¡¡¥Ç¡¼¥¿ºï½ü
+if ( $_POST['mode'] == 'delete' && is_numeric($_POST["news_id"])) {
+
+	//-- ºï½ü¤¹¤ë¿·Ãå¾ðÊó°Ê¹ß¤Îrank¤ò1¤Ä·«¤ê¾å¤²¤Æ¤ª¤¯
+	$conn->query("BEGIN");
+	$sql = "UPDATE dtb_news SET rank = rank - 1, update_date = NOW() WHERE delete = 0 AND rank > ( SELECT rank FROM dtb_news WHERE delete = 0 AND news_id = ? )";
+	$conn->query( $sql, array( $_POST['news_id']  ) );
+
+	$sql = "UPDATE dtb_news SET rank = 0, delete = 1, update_date = NOW() WHERE news_id = ?";
+	$conn->query( $sql, array( $_POST['news_id'] ) );
+	$conn->query("COMMIT");
+
+	sfReload();				//¼«Ê¬¤Ë¥ê¥À¥¤¥ì¥¯¥È¡ÊºÆÆÉ¹þ¤Ë¤è¤ë¸íÆ°ºîËÉ»ß¡Ë
+}
+
+//----¡¡É½¼¨½ç°Ì°ÜÆ°
+
+if ( $_POST['mode'] == 'move' && is_numeric($_POST["news_id"]) ) {
+	if ($_POST["term"] == "up") {
+		sfRankUp("dtb_news", "news_id", $_POST["news_id"]);
+	} else if ($_POST["term"] == "down") {
+		sfRankDown("dtb_news", "news_id", $_POST["news_id"]);	
+	}
+	//sf_rebuildIndex($conn);
+	sfReload();
+}
+
+//----¡¡»ØÄêÉ½¼¨½ç°Ì°ÜÆ°
+if ($_POST['mode'] == 'moveRankSet') {
+	$key = "pos-".$_POST['news_id'];
+	$input_pos = mb_convert_kana($_POST[$key], "n");
+	if(sfIsInt($input_pos)) {
+		sfMoveRank("dtb_news", "news_id", $_POST['news_id'], $input_pos);
+		sfReload();
+	}
+}
+
+
+//---- Á´¥Ç¡¼¥¿¼èÆÀ
+$sql = "SELECT *, EXTRACT(EPOCH FROM news_date) as news_date_unix FROM dtb_news WHERE delete = '0' ORDER BY rank DESC";
+$objPage->list_data = $conn->getAll($sql);
+$objPage->line_max = count($objPage->list_data);
+$sql = "SELECT MAX(rank) FROM dtb_news WHERE delete = '0'";		// rank¤ÎºÇÂçÃÍ¤ò¼èÆÀ
+$objPage->max_rank = $conn->getOne($sql);
+
+$objPage->arrForm['news_select'] = 0;
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+//function --------------------------------------------------------------------------------------------- 
+
+//---- ÆþÎÏÊ¸»úÎó¤òÇÛÎó¤Ø
+function lfConvData( $data ){
+	
+	 // Ê¸»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë							
+	$arrFlag = array(
+					  "year" => "n"
+					 ,"month" => "n"
+					 ,"day" => "n"
+					 ,"url" => "a"
+					 ,"news_title" => "aKV"
+					 ,"link_method" => "n"
+					);
+		
+	if ( is_array($data) ){
+		foreach ($arrFlag as $key=>$line) {
+			$data[$key] = mb_convert_kana($data[$key], $line);
+		}
+	}
+
+	return $data;
+}
+
+//----¡¡»ØÄê½ç°Ì¤Ø°ÜÆ°
+function sf_setRankPosition($conn, $tableName, $keyIdColumn, $keyId, $position) {
+
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë
+	$conn->query("BEGIN");
+	$rank = $conn->getOne("SELECT rank FROM $tableName WHERE $keyIdColumn = ?", array($keyId));	
+
+	if( $position > $rank ) $term = "- 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤êÂç¤­¤¤¾ì¹ç
+	if( $position < $rank ) $term = "+ 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤ê¾®¤µ¤¤¾ì¹ç
+
+	//--¡¡»ØÄê¤·¤¿½ç°Ì¤Î¾¦ÉÊ¤«¤é°ÜÆ°¤µ¤»¤ë¾¦ÉÊ¤Þ¤Ç¤Îrank¤ò£±¤Ä¤º¤é¤¹
+	$sql = "UPDATE $tableName SET rank = rank $term, update_date = NOW() WHERE rank BETWEEN ? AND ? AND delete = 0";
+	if( $position > $rank ) $conn->query( $sql, array( $rank + 1, $position ) );
+	if( $position < $rank ) $conn->query( $sql, array( $position, $rank - 1 ) );
+
+	//-- »ØÄê¤·¤¿½ç°Ì¤Ørank¤ò½ñ¤­´¹¤¨¤ë¡£
+	$sql  = "UPDATE $tableName SET rank = ?, update_date = NOW() WHERE $keyIdColumn = ? AND delete = 0 ";
+	$conn->query( $sql, array( $position, $keyId ) );
+	$conn->query("COMMIT");
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯¡Ê½ç°Ì°ÜÆ°ÍÑ¡Ë
+function sf_errorCheckPosition($conn, $tableName, $position, $keyIdColumn, $keyId) {
+
+	$objErr = new SC_CheckError();
+	$objErr->doFunc( array("°ÜÆ°½ç°Ì", "moveposition", 4 ), array( "ZERO_CHECK", "NUM_CHECK", "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$rank = $conn->getOne("SELECT rank FROM $tableName WHERE $keyIdColumn = ?", array($keyId));
+	if ($rank == $position ) $objErr->arrErr["moveposition"] .= "¢¨ »ØÄê¤·¤¿°ÜÆ°½ç°Ì¤Ï¸½ºß¤Î½ç°Ì¤Ç¤¹¡£";
+	
+	// rank¤ÎºÇÂçÃÍ°Ê¾å¤ÎÆþÎÏ¤òµöÍÆ¤·¤Ê¤¤											 
+	if( ! $objErr->arrErr["position"] ) {								 
+		$sql = "SELECT MAX( rank ) FROM " .$tableName. " WHERE delete = 0";
+		$result = $conn->getOne($sql);
+		if( $position > $result ) $objErr->arrErr["moveposition"] .= "¢¨ ÆþÎÏ¤µ¤ì¤¿½ç°Ì¤Ï¡¢ÅÐÏ¿¿ô¤ÎºÇÂçÃÍ¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£";
+	}
+
+	return $objErr->arrErr;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck(){
+
+	$objErr = new SC_CheckError();
+
+	$objErr->doFunc(array("ÆüÉÕ(Ç¯)", "year"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("ÆüÉÕ(·î)", "month"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("ÆüÉÕ(Æü)", "day"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("ÆüÉÕ", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥¿¥¤¥È¥ë", 'news_title', MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ËÜÊ¸", 'url', URL_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ËÜÊ¸", 'news_comment', LTEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+//INSERTÊ¸
+function lfNewsInsert(){
+	global $conn;
+	global $registDate;
+	
+	if ($_POST["link_method"] == "") {
+		$_POST["link_method"] = 1;
+	}
+
+	$sql = "INSERT INTO dtb_news (news_date, news_title, creator_id, news_url, link_method, news_comment, rank)
+			VALUES ( ?,?,?,?,?,? , (SELECT MAX(rank) + 1 FROM dtb_news WHERE delete = '0'))";
+	$arrRegist = array($registDate, $_POST["news_title"], $_SESSION['member_id'],  $_POST["news_url"], $_POST["link_method"], $_POST["news_comment"]);
+
+	$conn->query($sql, $arrRegist);
+	
+	// ºÇ½é¤Î1·ïÌÜ¤ÎÅÐÏ¿¤Ïrank¤ËNULL¤¬Æþ¤ë¤Î¤ÇÂÐºö
+	$sql = "UPDATE dtb_news SET rank = 1 WHERE delete = 0 AND rank IS NULL";
+	$conn->query($sql);
+}
+
+//UPDATEÊ¸
+function lfNewsUpdate(){
+	global $conn;
+	global $registDate;
+	
+	if ($_POST["link_method"] == "") {
+		$_POST["link_method"] = 1;
+	}	
+
+	$sql = "UPDATE dtb_news SET news_date = ?, news_title = ?, creator_id = ?, update_date = NOW(),  news_url = ?, link_method = ?, news_comment = ? WHERE news_id = ?";
+	$arrRegist = array($registDate, $_POST['news_title'], $_SESSION['member_id'], $_POST['news_url'], $_POST["link_method"], $_POST['news_comment'], $_POST['news_id']);
+		
+	$conn->query($sql, $arrRegist);	
+}
+?>
Index: /temp/trunk/html/admin/contents/recommend.php
===================================================================
--- /temp/trunk/html/admin/contents/recommend.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/recommend.php	(revision 1328)
@@ -0,0 +1,135 @@
+<?
+
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/recomend.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "recommend";
+		$this->tpl_subtitle = '¥ª¥¹¥¹¥á´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+$arrRegistColumn = array(
+ 							 array(  "column" => "product_id", "convert" => "n" ),
+							 array(  "column" => "category_id", "convert" => "n" ),
+							 array(  "column" => "rank", "convert" => "n" ),
+							 array(  "column" => "title", "convert" => "aKV" ),
+							 array(  "column" => "comment", "convert" => "aKV" ),
+						);
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+//ºÇÂçÅÐÏ¿¿ô¤ÎÉ½¼¨
+$objPage->tpl_disp_max = RECOMMEND_NUM;
+
+// ÅÐÏ¿»þ
+if ( $_POST['mode'] == 'regist' ){
+		
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	$objPage->arrForm = $_POST;	
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr[$objPage->arrForm['rank']] = lfErrorCheck();
+	if ( ! $objPage->arrErr[$objPage->arrForm['rank']]) {
+		// ¸Å¤¤¤Î¤ò¾Ã¤¹
+		$sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
+		$conn->query($sql, array($objPage->arrForm['category_id'] ,$objPage->arrForm['rank']));
+	
+		// £Ä£ÂÅÐÏ¿
+		$objPage->arrForm['creator_id'] = $_SESSION['member_id'];
+		$objPage->arrForm['update_date'] = "NOW()";
+		$conn->autoExecute("dtb_best_products", $objPage->arrForm );		
+	}	
+
+} elseif ( $_POST['mode'] == 'delete' ){
+// ºï½ü»þ
+
+	$sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
+	$conn->query($sql, array($_POST['category_id'] ,$_POST['rank']));
+	
+}
+
+// ¥«¥Æ¥´¥êID¼èÆÀ Ìµ¤¤¤È¤­¤Ï¥È¥Ã¥×¥Ú¡¼¥¸
+if ( sfCheckNumLength($_POST['category_id']) ){
+	$objPage->category_id = $_POST['category_id'];
+} else {
+	$objPage->category_id = 0;
+}
+
+// ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë
+$sql = "SELECT B.name, B.main_list_image, A.* FROM dtb_best_products as A INNER JOIN dtb_products as B USING (product_id)
+		 WHERE A.category_id = ? AND A.delete = 0 ORDER BY rank";
+$arrItems = $conn->getAll($sql, array($objPage->category_id));
+foreach( $arrItems as $data ){
+	$objPage->arrItems[$data['rank']] = $data;
+}
+
+// ¾¦ÉÊÊÑ¹¹»þ¤Ï¡¢ÁªÂò¤µ¤ì¤¿¾¦ÉÊ¤Ë°ì»þÅª¤ËÃÖ¤­´¹¤¨¤ë
+if ( $_POST['mode'] == 'set_item'){
+	$sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND delete = 0";
+	$result = $conn->getAll($sql, array($_POST['product_id']));
+	if ( $result ){
+		$data = $result[0];
+		foreach( $data as $key=>$val){
+			$objPage->arrItems[$_POST['rank']][$key] = $val;
+		}
+		$objPage->arrItems[$_POST['rank']]['rank'] = $_POST['rank'];
+	}
+	$objPage->checkRank = $_POST['rank'];
+}
+
+//³Æ¥Ú¡¼¥¸¶¦ÄÌ
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+// ¥«¥Æ¥´¥ê¼èÆÀ
+$objPage->arrCatList = sfGetCategoryList("level = 1");
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	$new_array = array();
+	foreach ($arrConvList as $key => $val) {
+		$new_array[$key] = $array[$key];
+		if( strlen($val) > 0) {
+			$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
+		}
+	}
+	return $new_array;
+	
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	
+	$objErr->doFunc(array("¸«½Ð¤·¥³¥á¥ó¥È", "title", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥ª¥¹¥¹¥á¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/admin/contents/csv_sql.php
===================================================================
--- /temp/trunk/html/admin/contents/csv_sql.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/csv_sql.php	(revision 1328)
@@ -0,0 +1,406 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/csv_output.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/csv_sql.tpl';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = 'csv';
+		$this->tpl_subno_csv = 'csv_sql';
+		$this->tpl_mainno = "contents";
+		$this->tpl_subtitle = 'CSV½ÐÎÏÀßÄê';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+$objPage->arrSubnavi = $arrSubnavi;
+$objPage->arrSubnaviName = $arrSubnaviName;
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// SQL_ID¤Î¼èÆÀ
+if ($_POST['sql_id'] != "") {
+	$sql_id = $_POST['sql_id'];
+}elseif($_GET['sql_id'] != ""){
+	$sql_id = $_GET['sql_id'];
+}else{
+	$sql_id = "";
+}
+
+$mode = $_POST['mode'];
+
+switch($_POST['mode']) {
+	// ¥Ç¡¼¥¿¤ÎÅÐÏ¿
+	case "confirm":
+		//$code = mb_internal_encoding();
+		//sfprintr($code);
+
+		// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		$objPage->arrErr = lfCheckError($_POST);
+		
+		if (count($objPage->arrErr) <= 0){
+			// ¥Ç¡¼¥¿¤Î¹¹¿·
+			$sql_id = lfUpdData($sql_id, $_POST);
+			// ´°Î»¥á¥Ã¥»¡¼¥¸É½¼¨
+			$objPage->tpl_onload = "alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+		}
+		break;
+	
+	// ³ÎÇ§²èÌÌ
+	case "preview":
+		// SQLÊ¸É½¼¨
+		$sql = "SELECT \n" . $_POST['sql'];
+		$objPage->sql = $sql;
+		
+		// ¥¨¥é¡¼É½¼¨
+		$objErrMsg = lfCheckSQL($_POST);
+		if ($errMsg != "") {
+			$errMsg = $objErrMsg->message . "\n" . $objErrMsg->userinfo;
+		}
+		$objPage->sqlerr = $errMsg;
+
+		$objPage->objView = $objView;
+		
+		// ²èÌÌ¤ÎÉ½¼¨
+		$objView->assignobj($objPage);
+		$objView->display('contents/csv_sql_view.tpl');
+		exit;
+		break;
+
+	// ¿·µ¬ºîÀ®
+	case "new_page":
+		header("location: ./csv_sql.php");
+		break;
+		
+	// ¥Ç¡¼¥¿ºï½ü
+	case "delete":
+		lfDelData($sql_id);
+		header("location: ./csv_sql.php");
+		break;
+		
+	case "csv_output":
+		// CSV½ÐÎÏ¥Ç¡¼¥¿¼èÆÀ
+		$arrCsvData = lfGetSqlList(" WHERE sql_id = ?", array($_POST['csv_output_id']));
+		
+		$objQuery = new SC_Query();
+		$arrCsvOutputData = $objQuery->getall("SELECT " . $arrCsvData[0]['sql']);
+		
+		if (count($arrCsvOutputData) > 0) {
+			
+			$arrKey = array_keys(sfSwapArray($arrCsvOutputData));
+			foreach($arrKey as $data) {
+				if ($i != 0) $header .= ", ";
+				$header .= $data;
+				$i ++;
+			}
+			$header .= "\n";
+
+			$data = lfGetCSVData($arrCsvOutputData, $arrKey);
+			// CSV½ÐÎÏ
+			sfCSVDownload($header.$data);
+			exit;
+		break;
+		}else{
+			$objPage->tpl_onload = "alert('½ÐÎÏ¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó¡£');";
+			$sql_id = "";
+			$_POST="";
+		}
+		break;
+}
+
+// mode ¤¬ confirm °Ê³°¤Î¤È¤­¤Ï´°Î»¥á¥Ã¥»¡¼¥¸¤Ï½ÐÎÏ¤·¤Ê¤¤
+if ($mode != "confirm" and $mode != "csv_output") {
+	$objPage->tpl_onload = "";
+}
+
+// ÅÐÏ¿ºÑ¤ßSQL°ìÍ÷¼èÆÀ
+$arrSqlList = lfGetSqlList();
+
+// ÊÔ½¸ÍÑSQL¥Ç¡¼¥¿¤Î¼èÆÀ
+if ($sql_id != "") {
+	$arrSqlData = lfGetSqlList(" WHERE sql_id = ?", array($sql_id));
+}
+
+// ¥Æ¡¼¥Ö¥ë°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+$arrTableList = lfGetTableList();
+$arrTableList = sfSwapArray($arrTableList);
+
+// ¸½ºßÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Æ¡¼¥Ö¥ë¤ò¼èÆÀ¤¹¤ë
+if ($_POST['selectTable'] == ""){
+	$selectTable = $arrTableList['relname'][0];
+}else{
+	$selectTable = $_POST['selectTable'];
+}
+
+// ¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+$arrColList = lfGetColumnList($selectTable);
+$arrColList =  sfSwapArray($arrColList);
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ÐÎÏ¤¹¤ë¥Ç¡¼¥¿¤ò¥»¥Ã¥È
+$objPage->arrSqlList = $arrSqlList;																// SQL°ìÍ÷
+$objPage->arrTableList = sfarrCombine($arrTableList['relname'], $arrTableList['description']);	// ¥Æ¡¼¥Ö¥ë°ìÍ÷
+$objPage->arrColList = sfarrCombine($arrColList['attname'],$arrColList['description']);			// ¥«¥é¥à°ìÍ÷
+$objPage->selectTable = $selectTable;															// ÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Æ¡¼¥Ö¥ë
+$objPage->sql_id = $sql_id;																		// ÁªÂò¤µ¤ì¤Æ¤¤¤ëSQL
+
+// POST¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+if (count($_POST) > 0) {
+	$arrSqlData[0]['name'] = $_POST['name'];
+	$arrSqlData[0]['sql'] = $_POST['sql'];
+}
+$objPage->arrSqlData = $arrSqlData[0];															// ÁªÂò¤µ¤ì¤Æ¤¤¤ëSQL¥Ç¡¼¥¿
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetTableList
+ * ½èÍýÆâÍÆ	¡§¥Æ¡¼¥Ö¥ë°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetTableList(){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	
+	$sql = "";
+	$sql .= " SELECT";
+	$sql .= "     c.relname ,";
+	$sql .= "     c.relname || ':' ||obj_description(c.oid) as description";
+	$sql .= " FROM";
+	$sql .= "     pg_class c,";
+	$sql .= "     pg_user u";
+	$sql .= " WHERE";
+	$sql .= "     c.relowner = u.usesysid AND";
+	$sql .= "     relname IN (SELECT";
+	$sql .= "                     tablename";
+	$sql .= "                 FROM";
+	$sql .= "                     pg_tables";
+	$sql .= "                 WHERE";
+	$sql .= "                     tableowner=? ";
+	$sql .= "                 )";
+	$sql .= " ORDER BY c.relname ";
+	$arrRet = $objQuery->getAll($sql, array(DB_USER));
+	
+	return $arrRet;
+}
+
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetColunmList
+ * ½èÍýÆâÍÆ	¡§¥Æ¡¼¥Ö¥ë¤Î¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§$selectTable¡§¥Æ¡¼¥Ö¥ëÌ¾¾Î
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetColumnList($selectTable){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	
+	$sql = "";
+	$sql .= " SELECT";
+	$sql .= "     a.attname,";
+	$sql .= "     a.attnum as fldnum, ";
+	$sql .= "     (select case count(description) when 0 then a.attname else (select a.attname || ':' || description from pg_description where a.attrelid=objoid and a.attnum=objsubid ) end from pg_description where a.attrelid=objoid and a.attnum=objsubid ) as description ";
+	$sql .= " FROM";
+	$sql .= "     pg_class c,";
+	$sql .= "         pg_attribute a left join pg_description e on (a.attrelid=e.objoid and a.attnum=e.objsubid) ";
+	$sql .= " ";
+	$sql .= " WHERE";
+	$sql .= "     (c.relname=?) AND";
+	$sql .= "     (c.oid=a.attrelid) AND";
+	$sql .= "     a.attnum > 0";
+	$sql .= " ORDER BY";
+	$sql .= "     fldnum";
+	$sql .= " ";
+	$arrRet = $objQuery->getAll($sql, array($selectTable));	
+
+	return $arrRet;
+	
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetSqlList
+ * ½èÍýÆâÍÆ	¡§ÅÐÏ¿ºÑ¤ßSQL°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$where¡§Where¶ç
+ * °ú¿ô2	¡§$arrData¡§¹Ê¤ê¹þ¤ß¥Ç¡¼¥¿
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetSqlList($where = "" , $arrData = array()){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	
+	$sql = "";
+	$sql .= " SELECT";
+	$sql .= "     sql_id,";
+	$sql .= "     name,";
+	$sql .= "     sql,";
+	$sql .= "     update_date,";
+	$sql .= "     create_date";
+	$sql .= " FROM";
+	$sql .= "     dtb_csv_sql";
+	
+	// Where¶ç¤Î»ØÄê¤¬¤¢¤ì¤Ð·ë¹ç¤¹¤ë
+	if ($where != "") {
+		$sql .= " $where ";
+	}else{
+		$sql .= " ORDER BY sql_id ";
+	}
+	$sql .= " ";
+
+	// ¥Ç¡¼¥¿¤ò°ú¿ô¤ÇÅÏ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥»¥Ã¥È¤¹¤ë
+	if (count($arrData) > 0) {
+		$arrRet = $objQuery->getall($sql, $arrData);
+	}else{
+		$arrRet = $objQuery->getall($sql);
+	}
+
+	return $arrRet;
+	
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdCsvOutput
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§POST¥Ç¡¼¥¿
+ * ÌáÃÍ		¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfCheckError($data){
+	$objErr = new SC_CheckError();
+	$objErr->doFunc( array("Ì¾¾Î", "name"), array("EXIST_CHECK") );
+	$objErr->doFunc( array("SQLÊ¸", "sql"), array("EXIST_CHECK") );
+	
+	// SQL¤ÎÂÅÅöÀ­¥Á¥§¥Ã¥¯
+	if ($objErr->arrErr['sql'] == "") {
+		$objsqlErr = lfCheckSQL($data);
+		if ($objsqlErr != "") {
+			$objErr->arrErr["sql"] = "SQLÊ¸¤¬ÉÔÀµ¤Ç¤¹¡£SQLÊ¸¤ò¸«Ä¾¤·¤Æ¤¯¤À¤µ¤¤";
+		}
+	}
+	
+	return $objErr->arrErr;
+
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfCheckSQL
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¤µ¤ì¤¿SQLÊ¸¤¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§POST¥Ç¡¼¥¿
+ * ÌáÃÍ		¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfCheckSQL($data){
+	$err = "";
+	$objDbConn = new SC_DbConn();
+	$sql = "SELECT " . $data['sql'] . " ";
+	$ret = $objDbConn->conn->query($sql);
+	if ($objDbConn->conn->isError($ret)){
+		$err = $ret;
+	}
+
+	return $err;
+}
+
+function lfprintr($data){
+	print_r($data);
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdData
+ * ½èÍýÆâÍÆ	¡§DB¤Ë¥Ç¡¼¥¿¤òÊÝÂ¸¤¹¤ë
+ * °ú¿ô1	¡§$sql_id¥¥¥¹¹¿·¤¹¤ë¥Ç¡¼¥¿¤ÎSQL_ID
+ * °ú¿ô2	¡§$arrData¥¥¥¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§$sql_id:SQL_ID¤òÊÖ¤¹
+ **************************************************************************************************************/
+function lfUpdData($sql_id = "", $arrData = array()){
+	$objQuery = new SC_Query();		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ(¹¹¿·È½Äê)
+	$arrVal = array();				// ¥Ç¡¼¥¿¹¹¿·
+
+	// sql_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤ÏUPDATE
+	if ($sql_id != "") {
+		// Â¸ºß¥Á¥§¥Ã¥¯
+		$arrSqlData = lfGetSqlList(" WHERE sql_id = ?", array($sql_id));
+		if (count($arrSqlData) > 0) {
+			// ¥Ç¡¼¥¿¹¹¿·
+			$sql = "UPDATE dtb_csv_sql SET name = ?, sql = ?, update_date = now() WHERE sql_id = ? ";
+			$arrVal= array($arrData['name'], $arrData['sql'], $sql_id);
+		}else{
+			// ¥Ç¡¼¥¿¤Î¿·µ¬ºîÀ®
+			$sql_id = "";
+			$sql = "INSERT INTO dtb_csv_sql (name, sql) values (?, ?) ";
+			$arrVal= array($arrData['name'], $arrData['sql']);
+			
+		}
+	}else{
+		// ¥Ç¡¼¥¿¤Î¿·µ¬ºîÀ®
+		$sql = "INSERT INTO dtb_csv_sql (name, sql) values (?, ?) ";
+		$arrVal= array($arrData['name'], $arrData['sql']);
+	}
+	// SQL¼Â¹Ô	
+	$arrRet = $objQuery->query($sql,$arrVal);
+	
+	// ¿·µ¬ºîÀ®»þ¤Ï$sql_id¤ò¼èÆÀ
+	if ($sql_id == "") {
+		$arrNewData = lfGetSqlList(" ORDER BY create_date DESC");
+		$sql_id = $arrNewData[0]['sql_id'];
+	}
+	
+	return $sql_id;
+}
+
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfDelData
+ * ½èÍýÆâÍÆ	¡§¥Ç¡¼¥¿¤òºï½ü¤¹¤ë
+ * °ú¿ô1	¡§$sql_id¥¥¥ºï½ü¤¹¤ë¥Ç¡¼¥¿¤ÎSQL_ID
+ * Ìá¤êÃÍ	¡§¼Â¹Ô·ë²Ì¡¡TRUE¡§À®¸ù FALSE¡§¼ºÇÔ
+ **************************************************************************************************************/
+function lfDelData($sql_id = ""){
+	$objQuery = new SC_Query();		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$Ret = false;					// ¼Â¹Ô·ë²Ì
+
+	// sql_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¼Â¹Ô
+	if ($sql_id != "") {
+		// ¥Ç¡¼¥¿¤Îºï½ü
+		$sql = "DELETE FROM dtb_csv_sql WHERE sql_id = ? ";
+		// SQL¼Â¹Ô	
+		$ret = $objQuery->query($sql,array($sql_id));
+	}else{
+		$ret = false;
+	}
+
+	// ·ë²Ì¤òÊÖ¤¹
+	return $ret;
+}
+
+
+//---- CSV½ÐÎÏÍÑ¥Ç¡¼¥¿¼èÆÀ
+function lfGetCSVData( $array, $arrayIndex){	
+	for ($i=0; $i<count($array); $i++){
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	
+	return $return;
+}
+
Index: /temp/trunk/html/admin/contents/csv.php
===================================================================
--- /temp/trunk/html/admin/contents/csv.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/csv.php	(revision 1328)
@@ -0,0 +1,123 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/csv_output.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/csv.tpl';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = 'csv';
+		$this->tpl_subno_csv = $this->arrSubnavi[1];
+		$this->tpl_mainno = "contents";
+		$this->tpl_subtitle = 'CSV½ÐÎÏÀßÄê';
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+$objPage->arrSubnavi = $arrSubnavi;
+$objPage->arrSubnaviName = $arrSubnaviName;
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$arrOutput = array();
+$arrChoice = array();
+
+$get_tpl_subno_csv = $_GET['tpl_subno_csv'];
+// GET¤ÇÃÍ¤¬Á÷¤é¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¤½¤ÎÃÍ¤ò¸µ¤Ë²èÌÌÉ½¼¨¤òÀÚ¤êÂØ¤¨¤ë
+if ($get_tpl_subno_csv != ""){
+	// Á÷¤é¤ì¤Æ¤­¤¿ÃÍ¤¬ÇÛÎó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐTOP¤òÉ½¼¨
+	if (in_array($get_tpl_subno_csv,$objPage->arrSubnavi)){
+		$subno_csv = $get_tpl_subno_csv;
+	}else{
+		$subno_csv = $objPage->arrSubnavi[1];
+	}
+} else {
+	// GET¤ÇÃÍ¤¬¤Ê¤±¤ì¤ÐPOST¤ÎÃÍ¤ò»ÈÍÑ¤¹¤ë
+	if ($_POST['tpl_subno_csv'] != ""){
+		$subno_csv = $_POST['tpl_subno_csv'];
+	}else{
+		$subno_csv = $objPage->arrSubnavi[1];
+	}
+}
+
+// subno¤ÎÈÖ¹æ¤ò¼èÆÀ
+$subno_id = array_keys($objPage->arrSubnavi,$subno_csv);
+$subno_id = $subno_id[0];
+// ¥Ç¡¼¥¿¤ÎÅÐÏ¿
+if ($_POST["mode"] == "confirm") {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError($_POST['output_list']);
+	
+	if (count($objPage->arrErr) <= 0){
+		// ¥Ç¡¼¥¿¤Î¹¹¿·
+		lfUpdCsvOutput($subno_id, $_POST['output_list']);
+		
+		// ²èÌÌ¤Î¥ê¥í¡¼¥É
+		sfReload("tpl_subno_csv=$subno_csv");
+	}
+}
+
+// ½ÐÎÏ¹àÌÜ¤Î¼èÆÀ
+$arrOutput = sfSwapArray(sfgetCsvOutput($subno_csv, "WHERE csv_id = ? AND status = 1", array($subno_id)));
+$arrOutput = sfarrCombine($arrOutput['col'], $arrOutput['disp_name']);
+
+// Èó½ÐÎÏ¹àÌÜ¤Î¼èÆÀ
+$arrChoice = sfSwapArray(sfgetCsvOutput($subno_csv, "WHERE csv_id = ? AND status = 2", array($subno_id)));
+$arrChoice = sfarrCombine($arrChoice['col'], $arrChoice['disp_name']);
+
+$objPage->arrOutput=$arrOutput;
+$objPage->arrChoice=$arrChoice;
+
+
+$objPage->SubnaviName = $objPage->arrSubnaviName[$subno_id];
+$objPage->tpl_subno_csv = $subno_csv;
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdCsvOutput
+ * ½èÍýÆâÍÆ	¡§CSV½ÐÎÏ¹àÌÜ¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfUpdCsvOutput($csv_id, $arrData = array()){
+	$objQuery = new SC_Query();
+
+	// ¤Ò¤È¤Þ¤º¡¢Á´Éô»ÈÍÑ¤·¤Ê¤¤¤Ç¹¹¿·¤¹¤ë
+	$upd_sql = "UPDATE dtb_csv SET status = 2, rank = NULl WHERE csv_id = ?";
+	$objQuery->query($upd_sql, array($csv_id));
+
+	// »ÈÍÑ¤¹¤ë¤â¤Î¤À¤±¡¢ºÆ¹¹¿·¤¹¤ë¡£
+	if (is_array($arrData)) {
+		foreach($arrData as $key => $val){
+			$upd_sql = "UPDATE dtb_csv SET status = 1, rank = ? WHERE csv_id = ? AND col = ? ";
+			$objQuery->query($upd_sql, array($key+1, $csv_id,$val));
+		}
+	}
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdCsvOutput
+ * ½èÍýÆâÍÆ	¡§CSV½ÐÎÏ¹àÌÜ¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * ÌáÃÍ		¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfCheckError($data){
+	$objErr = new SC_CheckError();
+	$objErr->doFunc( array("½ÐÎÏ¹àÌÜ", "output_list"), array("EXIST_CHECK") );
+	
+	return $objErr->arrErr;
+
+}
+
Index: /temp/trunk/html/admin/contents/recommend_search.php
===================================================================
--- /temp/trunk/html/admin/contents/recommend_search.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/recommend_search.php	(revision 1328)
@@ -0,0 +1,147 @@
+<?php
+
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/recomend_search.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = '';
+		$this->tpl_subno = "";
+		$this->tpl_subtitle = '¥ª¥¹¥¹¥á´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+if ($_POST['mode'] == "search") {
+	
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	
+	
+	$where = "delete = 0";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	foreach ($objPage->arrForm as $key => $val) {
+		if($val == "") {
+			continue;
+		}
+		
+		switch ($key) {
+			case 'search_name':
+				
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+				$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
+				$tmp_where = "";
+				foreach ($arrRet as $val) {
+					if($tmp_where == "") {
+						$tmp_where.= " AND ( category_id = ?";
+					} else {
+						$tmp_where.= " OR category_id = ?";
+					}
+					$arrval[] = $val;
+				}
+				$where.= $tmp_where . " )";
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$where .= " OR product_code ILIKE ?";
+				$arrval[] = "%$val%";
+				$arrval[] = "%$val%";
+				break;
+			default:
+				break;
+		}
+	}
+	
+	$order = "update_date DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+		
+}
+
+// ¥«¥Æ¥´¥ê¼èÆÀ
+$objPage->arrCatList = sfGetCategoryList();
+
+
+
+
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+
+
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+
+?>
Index: /temp/trunk/html/admin/contents/inquiry.php
===================================================================
--- /temp/trunk/html/admin/contents/inquiry.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/inquiry.php	(revision 1328)
@@ -0,0 +1,261 @@
+<?php
+
+require_once("../require.php");
+
+require_once("../order/index_csv.php");
+
+$arrCVSCOL = array( 
+		
+				);
+						
+$arrCVSTITLE = array(
+				'²óÅúID',
+				'¼ÁÌäID',
+				'²óÅúÆü»þ',
+				'²óÅúÌ¾',
+				'¸ÜµÒÌ¾1',
+				'¸ÜµÒÌ¾2',
+				'¸ÜµÒÌ¾¥«¥Ê1',
+				'¸ÜµÒÌ¾¥«¥Ê2',
+				'Í¹ÊØÈÖ¹æ1',
+				'Í¹ÊØÈÖ¹æ2',
+				'ÅÔÆ»ÉÜ¸©',
+				'½»½ê1',
+				'½»½ê2',
+				'ÅÅÏÃÈÖ¹æ1',
+				'ÅÅÏÃÈÖ¹æ2',
+				'ÅÅÏÃÈÖ¹æ3',
+				'¥á¡¼¥ë¥¢¥É¥ì¥¹',
+				'²óÅú1',
+				'²óÅú2',
+				'²óÅú3',
+				'²óÅú4',
+				'²óÅú5',
+				'²óÅú6'				
+			);
+
+
+
+
+
+class LC_Page {
+	var $cnt_question;
+
+	var $ERROR;
+	var $ERROR_COLOR;
+	var $MESSAGE;
+	
+	var $QUESTION_ID;
+	
+	var $arrActive;
+	var $arrQuestion;
+	var $arrSession;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/inquiry.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "inquiry";
+		$this->tpl_subtitle = '¥¢¥ó¥±¡¼¥È´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+$arrActive = array( "0"=>"²ÔÆ¯", "1"=>"Èó²ÔÆ¯" );
+$arrQuestion = array( "0"=>"»ÈÍÑ¤·¤Ê¤¤", "1"=>"¥Æ¥­¥¹¥È¥¨¥ê¥¢", "2"=>"¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹"
+					, "3"=>"¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹", "4"=>"¥é¥¸¥ª¥Ü¥¿¥ó" 
+				);
+
+
+$sql = "SELECT *, to_char( create_date, 'YYYY/MM/DD' ) as disp_date FROM dtb_question WHERE delete = 0 ORDER BY question_id";
+$result = $conn->getAll($sql);
+$objPage->list_data = $result;
+						
+if ( $_GET['mode'] == 'regist' ){
+
+	for ( $i=0; $i<count($_POST["question"]); $i++ ) {
+		$_POST['question'][$i]['name'] = mb_convert_kana( trim ( $_POST['question'][$i]['name'] ), "K" );
+		for ( $j=0; $j<count( $_POST['question'][$i]['option'] ); $j++ ){
+			$_POST['question'][$i]['option'][$j] = mb_convert_kana( trim ( $_POST['question'][$i]['option'][$j] ) );
+		}
+	}
+	
+	$error = lfErrCheck();
+		
+	if ( ! $error  ){
+		
+		if ( ! is_numeric($_POST['question_id']) ){
+			//ÅÐÏ¿
+			$sql = "select nextval('dtb_question_question_id_seq');";
+			$question_id = $conn->getOne($sql);
+			
+			$value = serialize($_POST);
+			$sql_val = array( $value, $_POST['title'] ,$question_id );
+			$conn->query("INSERT INTO dtb_question ( question, question_name, question_id ) VALUES (?, ?, ?)", $sql_val );
+			$objPage->MESSAGE = "ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿";
+			$objPage->QUESTION_ID = $question_id;
+			sfReload();
+		} else {
+			//ÊÔ½¸
+			$value = serialize($_POST);
+			$sql_val = array( $value, $_POST['title'] ,$_POST['question_id'] );
+			$conn->query("UPDATE dtb_question SET question = ?, question_name = ? WHERE question_id = ?", $sql_val );
+			$objPage->MESSAGE = "ÊÔ½¸¤¬´°Î»¤·¤Þ¤·¤¿";
+			$objPage->QUESTION_ID = $_POST['question_id'];
+			sfReload();
+		}
+	} else {
+		//¥¨¥é¡¼É½¼¨
+		$objPage->ERROR = $error;
+		$objPage->QUESTION_ID = $_REQUEST['question_id'];
+		$objPage->ERROR_COLOR = lfGetErrColor($error, ERR_COLOR);
+
+	}
+} elseif ( ( $_GET['mode'] == 'delete' ) && ( sfCheckNumLength($_GET['question_id']) )  ){
+
+	$sql = "UPDATE dtb_question SET delete = 1 WHERE question_id = ?";
+	$conn->query( $sql, array( $_GET['question_id'] ) );
+	sfReload();
+	
+} elseif ( ( $_GET['mode'] == 'csv' ) && ( sfCheckNumLength($_GET['question_id']) ) ){ 
+
+			$head = sfGetCSVList($arrCVSTITLE);
+			$list_data = $conn->getAll("SELECT result_id,question_id,question_date,question_name,name01,name02,kana01,kana02,zip01,zip02,pref,addr01,addr02,tel01,tel02,tel03,mail01,question01,question02,question03,question04,question05,question06 FROM dtb_question_result WHERE delete = 0 ORDER BY result_id ASC");
+			$data = "";
+			for($i = 0; $i < count($list_data); $i++) {
+				// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+				$data .= lfMakeCSV($list_data[$i]);
+			}
+			// CSV¤òÁ÷¿®¤¹¤ë
+			sfCSVDownload($head.$data);
+			exit;
+
+} else {
+	
+	if ( is_numeric($_GET['question_id']) ){
+	
+		$sql = "SELECT question FROM dtb_question WHERE question_id = ?";
+		$result = $conn->getOne($sql, array($_GET['question_id']));
+		
+		if ( $result ){
+			$_POST = unserialize( $result );
+			$objPage->QUESTION_ID = $_GET['question_id'];
+		}
+	}
+} 
+
+
+
+
+//³Æ¥Ú¡¼¥¸¶¦ÄÌ
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+
+function lfGetErrColor( $arr, $err_color ){
+	
+	foreach ( $arr as $key=>$val ) {
+		if ( is_string($val) && strlen($val) > 0 ){
+			$return[$key] = $err_color;
+		} elseif ( is_array( $val ) ) {
+			$return[$key] = lfGetErrColor ( $val, $err_color);
+		}
+	}
+	return $return;
+}
+
+
+
+
+
+
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+
+function lfErrCheck (){
+
+	$objErr = new SC_CheckError();
+	$errMsg = "";
+
+	$objErr->doFunc( array( "²ÔÆ¯¡¦Èó²ÔÆ¯", "active" ), array( "SELECT_CHECK" ) );
+	
+	$_POST["title"] = mb_convert_kana( trim (  $_POST["title"] ), "K" );
+	$objErr->doFunc( array( "¥¢¥ó¥±¡¼¥ÈÌ¾", "title" ), array( "EXIST_CHECK" ) );
+
+	$_POST["contents"] = mb_convert_kana( trim (  $_POST["contents"] ), "K" );
+	$objErr->doFunc( array( "¥¢¥ó¥±¡¼¥ÈÆâÍÆ" ,"contents" ), array( "EXIST_CHECK" ) );
+
+	
+	if ( ! $_POST['question'][0]["name"] ){
+		$objErr->arrErr['question'][0]["name"] = "£±¤Ä¤á¤Î¼ÁÌäÌ¾¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó";
+	}
+	
+	//¡¡¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¡¢¥é¥¸¥ª¥Ü¥¿¥ó¤òÁªÂò¤·¤¿¾ì¹ç¤ÏºÇÄã1¤Ä°Ê¾å¹àÌÜ¤òµ­Æþ¤µ¤»¤ë¡£
+	for( $i = 0; $i < count( $_POST["question"] ); $i++ ) {
+		
+		if ( $_POST["question"][$i]["kind"] ) {
+			if (strlen($_POST["question"][$i]["name"]) == 0) {
+				$objErr->arrErr["question"][$i]["name"] = "¥¿¥¤¥È¥ë¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£";
+			} else if ( strlen($_POST["question"][$i]["name"]) > STEXT_LEN ) {
+				$objErr->arrErr["question"][$i]["name"] = "¥¿¥¤¥È¥ë¤Ï". STEXT_LEN  ."»ú°ÊÆâ¤ÇÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£";
+			}
+		}
+		
+		if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) {
+
+			$temp_data = array();
+			for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) {	
+
+				// ¹àÌÜ´Ö¡Ê¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¡Ë¤¬¤¢¤¤¤Æ¤¤¤¿¤éµÍ¤á¤Æ¤¤¤¯
+				if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" );
+
+			}
+
+			 $_POST["question"][$i]["option"] = $temp_data;
+
+			if( ( strlen( $_POST["question"][$i] ["option"][0] ) == 0 ) || ( strlen( $_POST["question"][$i] ["option"][0] ) > 0
+			 && strlen( $_POST["question"][$i] ["option"][1] ) == 0 ) ) $objErr->arrErr["question"][$i]['kind'] = "²¼µ­¤Î2¤Ä°Ê¾å¤Î¹àÌÜ¤Ëµ­Æþ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+		}
+	}
+
+	return lfGetArrInput( $objErr->arrErr );
+
+}
+
+
+function lfGetArrInput( $arr ){
+	// ÃÍ¤¬ÆþÎÏ¤µ¤ì¤¿ÇÛÎó¤Î¤ß¤òÊÖ¤¹
+	
+	if ( is_array($arr)	){
+		foreach ( $arr as $key=>$val ) {
+			if ( is_string($val) && strlen($val) > 0 ){
+				$return[$key] = $val;
+			} elseif ( is_array( $val ) ) {
+				$data = lfGetArrInput ( $val );
+				if ( $data ){
+					$return[$key] = $data;
+				}
+			}
+		}
+	}
+	return $return;
+}
+?>
Index: /temp/trunk/html/admin/contents/inquiry_customer.php
===================================================================
--- /temp/trunk/html/admin/contents/inquiry_customer.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/inquiry_customer.php	(revision 1328)
@@ -0,0 +1,268 @@
+<?
+require_once("../require.php");
+
+class LC_Page {
+	var $errmsg;
+	var $arrPref;
+	
+	var $QUESTION;
+	var $question_id;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/inquiry_customer.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/sub_navi.tpl';
+		$this->tpl_subno = "inquiry";
+		$this->tpl_subtitle = '¥¢¥ó¥±¡¼¥È´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+
+// ÅÔÆ»ÉÜ¸©¥×¥ë¥À¥¦¥óÍÑÇÛÎó
+$objPage->arrPref = $arrPref;	
+
+
+// CSVÊÝÂ¸¹àÌÜ
+$ITEM = array(   "name"
+				,"name_kana"
+				,"zip"
+				,"state"
+				,"address01"
+				,"address02"
+				,"tel"
+				,"mail01"
+		);
+
+		
+		
+if ( ( ! $_POST['mode'] == 'confirm' ) && ( ! is_numeric($_REQUEST['question_id']) ) ){
+	echo "ÉÔÀµ¥¢¥¯¥»¥¹";
+	exit;
+}
+		
+		
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÅÐÏ¿¹àÌÜ¼èÆÀ
+$sql = "SELECT question_id, question FROM dtb_question WHERE question_id = ?";
+$result = $conn->getAll( $sql, array($_REQUEST['question_id']) );
+$objPage->QUESTION = lfGetArrInput( unserialize( $result[0]['question'] ) );
+$objPage->question_id = $result[0]['question_id'];
+
+
+if ( (int)$objPage->QUESTION["delete"] !== 0 ){
+
+	$objPage->tpl_mainpage = "question/closed.tpl";
+	
+} elseif( $_POST['mode'] == "confirm" ) {
+
+	$errmsg  = errCheck();
+
+	if( $errmsg ) {
+
+		$objPage->errmsg = $errmsg;
+
+	} else {
+		$page_title = "¥Õ¥¡¥¤¥Æ¥ó¤é¤¯¤é¤¯¥·¥ç¥Ã¥Ô¥ó¥° - ¥¢¥ó¥±¡¼¥È ÆâÍÆ³ÎÇ§-";
+		$page_file_name = "question/confirm.tpl";
+	}
+	
+
+} elseif( $_POST['mode'] == "complete" )  {
+
+	//´°Î»²èÌÌ
+	$page_file_name = "question/complete.tpl";
+	
+	// ¼õÉÕÆüÉÕ¡¢ÍËÆü¡¢»þ´Ö¤ò¼èÆÀ¤¹¤ë
+	$date = getDateLocal();
+	
+	
+	//¥Ç¡¼¥¿ºîÀ®
+	$SQLDATA = $_POST;
+	$SQLDATA['zip'] = $SQLDATA['zip01'] ."-". $SQLDATA['zip02'];
+	$SQLDATA['tel'] = $SQLDATA['tel01'] ."-". $SQLDATA['tel02'] ."-". $SQLDATA['tel03'];
+	
+	//--------- ¢§ SQL ---------//
+		$sql = "INSERT INTO dtb_question_result ( question_name, question_id";
+		$sql_val = " ?, ? ";
+		$value[] = $objPage->QUESTION[title];
+		$value[] = $objPage->QUESTION[question_id];
+		
+		foreach ($ITEM as $val) {
+			if ( strlen( $SQLDATA[$val] ) > 0  ){
+				$sql .= "," .$val;
+				$sql_val .= ",? ";
+				$value[] = $SQLDATA[$val];
+			}
+		}
+		
+		for ( $i=0; $i<(count($objPage->QUESTION)+1); $i++ ){
+			
+			$tmpVal = "";
+			
+			if ( $objPage->QUESTION[question][$i][kind] == 1 or $objPage->QUESTION[question][$i][kind] == 2 ) {
+				
+				//¥Æ¥­¥¹¥È¥¨¥ê¥¢¡¦¥Ü¥Ã¥¯¥¹
+				$tmpVal = $SQLDATA['option'][$i];
+			
+			} elseif ( $objPage->QUESTION[question][$i][kind] == 4 ){
+				
+				//¥é¥Â¥ª¥Ü¥¿¥ó
+				$tmpVal = Array_Search_key ( $SQLDATA['option'][$i] , $objPage->QUESTION[question][$i][option] );
+			
+			} elseif ( $objPage->QUESTION[question][$i][kind] == 3 )  {
+				
+				//¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹
+				if ( is_array( $SQLDATA['option'][$i] ) ) {
+					foreach ($SQLDATA['option'][$i] as $data) {
+						if ( strlen($data) ) {
+							if ( $tmpVal ) $tmpVal .= "\n";
+							$tmpVal .= Array_Search_key ( $data , $objPage->QUESTION[question][$i][option] );
+						}
+					}
+				}
+			}
+
+
+			if ( strlen($tmpVal) > 0 ) {
+				$value[] = $tmpVal;
+				$sql .= "," ."question".($i+1);
+				$sql_val .= ",? ";
+			}
+		}
+	
+		
+		$sql = $sql .") VALUES ( ".$sql_val.")";
+		$conn->query( $sql, $value );
+		
+	//--------- ¢¥ SQL ---------//
+
+}
+
+
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+
+
+
+
+
+
+
+
+
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+function errCheck() {
+
+	$objErr = new ERROR_CHECK();
+	$errmsg = array();
+
+
+	//¡¡¤ªÌ¾Á°
+	$_POST["name"] = mb_convert_kana( trim( $_POST["name"] ) ,"asKVn" );	
+	$errmsg["name"] = $objErr->doFunc( array( $_POST["name"] , "¤ªÌ¾Á°", NAME_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+
+	//¡¡¥Õ¥ê¥¬¥Ê
+	$_POST["name_kana"] = mb_convert_kana( trim( $_POST["name_kana"]) , "sCKV" ); 
+	$errmsg["name_kana"] = $objErr->doFunc( array( $_POST["name_kana"] , "¥Õ¥ê¥¬¥Ê", NAME_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" , "KANA_CHECK") );
+
+	//¡¡Í¹ÊØÈÖ¹æ
+	if( strlen( $_POST["zip01"] ) > 0 && strlen( $_POST["zip02"] ) > 0 ) {
+		
+		$_POST["zip01"] = mb_convert_kana( trim( $_POST["zip01"] ) , "n");
+		$_POST["zip02"] = mb_convert_kana( trim( $_POST["zip02"] ) , "n");
+		$zip = $_POST["zip01"] . $_POST["zip02"];
+		$errmsg["zip"] = $objErr->doFunc( array( $zip , "Í¹ÊØÈÖ¹æ", ZIP_NO ), array( "NUM_CHECK", "NUM_COUNT_CHECK2" ) );
+
+		//Æ±¤¸Ê¸»ú¤Ð¤«¤ê¤ÎÍ¹ÊØÈÖ¹æ¤Ïµö²Ä¤·¤Ê¤¤
+		if ( ereg('^(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)$', $zip ) ) $errmsg['zip'] .= "¢¨ Í¹ÊØÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+	}
+
+	//¡¡¤´½»½ê
+	if( strlen( $_POST["address01"] ) > 0 || strlen( $_POST["address02"] ) > 0 ) {
+
+		$_POST["address01"] = mb_convert_kana( trim($_POST["address01"] ), "asKVn" );
+		$_POST["address02"] = mb_convert_kana( trim($_POST["address02"] ), "asKVn" );
+
+		if( $_POST["state"] == "" ) $errmsg["address"] = "¢¨ ÅÔÆ»ÉÜ¸©¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+		$errmsg["address"] .= $objErr->doFunc( array( $_POST["address01"], "¤´½»½ê¡Ê»Ô¶èÄ®Â¼¡Ë", ADDRESS_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+		$errmsg["address"] .= $objErr->doFunc( array( $_POST["address02"], "¤´½»½ê¡ÊÈÖÃÏ¤Ê¤É¡Ë", ADDRESS_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+	}
+
+	//¡¡¤ªÅÅÏÃÈÖ¹æ
+	if( strlen( $_POST["tel01"] ) > 0 ||  strlen( $_POST["tel03"] ) > 0 ||  strlen( $_POST["tel03"] ) > 0 ) {
+
+		$_POST["tel01"] = mb_convert_kana( trim($_POST["tel01"] ), "n" );
+		$_POST["tel02"] = mb_convert_kana( trim($_POST["tel02"] ), "n" );
+		$_POST["tel03"] = mb_convert_kana( trim($_POST["tel03"] ), "n" );
+		$tel = $_POST["tel01"] . $_POST["tel02"] . $_POST["tel03"];
+		$errmsg["tel"] = $objErr->doFunc( array( $tel, "ÅÅÏÃÈÖ¹æ", TEL_MIN_NO, TEL_MAX_NO ), array( "NUM_CHECK", "NUM_COUNT_CHECK" ) );
+	
+		//Æ±¤¸Ê¸»ú¤Ð¤«¤ê¤ÎÅÅÏÃÈÖ¹æ¤Ïµö²Ä¤·¤Ê¤¤
+		if ( ereg('^(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)$',$_POST['tel01'].$_POST['tel02'].$_POST['tel03']) ) $errmsg['tel'] .= "¢¨ ÅÅÏÃÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+
+	}
+
+	//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹
+	$_POST["mail01"] = mb_convert_kana( trim( $_POST["mail01"] ), "a" );
+	$_POST["mail02"] = mb_convert_kana( trim( $_POST["mail02"] ), "a" );
+	$errmsg_mail =  $objErr->doFunc( array( $_POST["mail01"] , "¥á¡¼¥ë¥¢¥É¥ì¥¹", EMAIL_VOL, "small" )
+									,array( "EXIST_CHECK", "EMAIL_CHECK", "MAX_LENGTH_CHECK"  ) );
+
+	$errmsg_mail .= $objErr->doFunc( array( $_POST["mail02"] , "³ÎÇ§ÍÑ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹", EMAIL_VOL, "small" )
+									,array( "EXIST_CHECK", "EMAIL_CHECK", "MAX_LENGTH_CHECK"   ) );
+	if( ! $errmsg_mail ) {
+
+		$errmsg["mail"] = $objErr->doFunc( array( $_POST["mail01"] , "¥á¡¼¥ë¥¢¥É¥ì¥¹", $_POST["mail02"] , "³ÎÇ§ÍÑ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹" ), array( "EQUAL_CHECK" ) );
+
+	} else {
+
+		$errmsg["mail"] = $errmsg_mail;
+	}
+
+	$errmsg['option'] =  array_map( "checkNull", $_POST['option'] );
+	for( $i = 0; $i < count( $_POST["option"] ) ; $i ++ ) {
+
+		$_POST["option"][$i] = mb_convert_kana( trim( $_POST["option"][$i] ), "asKVn" );
+
+	}
+	
+	return $returnMsg = lfGetArrInput($errmsg);
+
+}
+
+
+
+function lfGetArrInput( $arr ){
+	// ÃÍ¤¬ÆþÎÏ¤µ¤ì¤¿ÇÛÎó¤Î¤ß¤òÊÖ¤¹
+	
+	if ( is_array($arr)	){
+		foreach ( $arr as $key=>$val ) {
+			if ( is_string($val) && strlen($val) > 0 ){
+				$return[$key] = $val;
+			} elseif ( is_array( $val ) ) {
+				$data = lfGetArrInput ( $val );
+				if ( $data ){
+					$return[$key] = $data;
+				}
+			}
+		}
+	}
+	return $return;
+}
+
+
+?>
Index: /temp/trunk/html/admin/contents/page_edit.php
===================================================================
--- /temp/trunk/html/admin/contents/page_edit.php	(revision 1328)
+++ /temp/trunk/html/admin/contents/page_edit.php	(revision 1328)
@@ -0,0 +1,114 @@
+<?php
+
+require_once("../require.php");
+require_once("./page_edit.inc");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/page_edit.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "page_edit";
+		global $arrPageList;
+		$this->arrPageList = $arrPageList;
+		$this->tpl_subtitle = '¥Ú¡¼¥¸ÊÔ½¸';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+$objFormParam = new SC_FormParam();			// ¥Õ¥©¡¼¥àÍÑ
+lfInitParam();								// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+$objFormParam->setParam($_POST);			// POSTÃÍ¤Î¼èÆÀ
+
+switch($_POST['mode']) {
+case 'edit':
+	$objPage->arrErr = $objFormParam->checkError();
+	if(count($objPage->arrErr) == 0) {
+		$page = $_POST['page'];
+		if($arrPageTpl[$page] != "") {
+			// °ì»þ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤à
+			$path = TEMPLATE_FTP_DIR . $arrPageTpl[$page] . ".tmp";
+			$ret = lfWriteFile($path, $objFormParam->getValue('template'));
+			// ËÜÈÖ¥Õ¥¡¥¤¥ë¤ËÈ¿±Ç
+			if($ret > 0) {
+				$dst_path = TEMPLATE_FTP_DIR . $arrPageTpl[$page];
+				if(!copy($path, $dst_path)) {
+					print("¥Õ¥¡¥¤¥ë¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+				}
+			}
+		}
+	}	
+	break;
+case 'preview':
+	$objPage->arrErr = $objFormParam->checkError();
+	if(count($objPage->arrErr) == 0) {
+		$page = $_POST['page'];
+		if($arrPageTpl[$page] != "") {
+			// °ì»þ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤à
+			$path = TEMPLATE_FTP_DIR . $arrPageTpl[$page] . ".tmp";
+			$ret = lfWriteFile($path, $objFormParam->getValue('template'));
+			// ¥×¥ì¥Ó¥å¡¼É½¼¨
+			$url = $arrPageURL[$page] . "tpl=" . $arrPageTpl[$page] . ".tmp";
+			$objPage->tpl_onload ="window.open('$url', 'preview');";
+		}
+	}	
+	break;
+case 'select':
+	$page = $_POST['page'];
+	if($arrPageTpl[$page] != "") {
+		// ¥Õ¥¡¥¤¥ë¤ÎÃæ¿È¤òÆÉ¤ó¤ÇÊ¸»úÎó¤Ë³ÊÇ¼¤¹¤ë
+		$path = TEMPLATE_FTP_DIR . $arrPageTpl[$page];
+		if(file_exists($path)) {
+	 		$fp = fopen($path, "r");
+			$contents = fread($fp, filesize($path));
+			$objFormParam->setValue('template', $contents);
+			fclose($fp);
+		}
+	} else {
+		$objFormParam->setValue('template', "");
+	}
+	break;
+default:
+	
+	break;
+}
+
+/*
+
+// ¥Õ¥¡¥¤¥ë¤ÎÃæ¿È¤òÆÉ¤ó¤ÇÊ¸»úÎó¤Ë³ÊÇ¼¤¹¤ë
+$path = TEMPLATE_FTP_DIR . "index.tpl";
+$fp = fopen($path, "r");
+$contents = fread($fp, filesize($path));
+
+$objFormParam->setValue('template', $contents);
+
+fclose($fp);
+
+*/
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//---------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥Ú¡¼¥¸ÁªÂò", "page", INT_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template", LLTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+function lfWriteFile($path, $string) {
+	$fp = fopen($path,"w+");
+	flock($fp, LOCK_EX);
+	$ret = fwrite($fp, $string);
+	fclose($fp);
+	return $ret;
+}
+
+?>
Index: /temp/trunk/html/admin/login.php
===================================================================
--- /temp/trunk/html/admin/login.php	(revision 1328)
+++ /temp/trunk/html/admin/login.php	(revision 1328)
@@ -0,0 +1,78 @@
+<?php
+require_once("./require.php");
+
+$conn = new SC_DBConn();
+
+$osess = new SC_Session();
+$ret = false;
+
+// ÆþÎÏÈ½Äê
+if(strlen($_POST{'login_id'}) > 0 && strlen($_POST{'password'}) > 0) {
+	// Ç§¾Ú¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê
+	$ret = fnCheckPassword($conn);
+}
+
+if($ret){
+	// À®¸ù
+	header("Location: ".URL_HOME);
+	exit;
+} else {
+	// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+	sfDispError(LOGIN_ERROR);
+	exit;
+}
+
+/* Ç§¾Ú¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê */
+function fnCheckPassword($conn) {
+	$sql = "SELECT member_id, password, authority, login_date, name FROM dtb_member WHERE login_id = ? AND delete <> 1 AND work = 1";
+	$arrcol = array ($_POST['login_id']);
+	// DB¤«¤é°Å¹æ²½¥Ñ¥¹¥ï¡¼¥É¤ò¼èÆÀ¤¹¤ë¡£
+	$data_list = $conn->getAll($sql ,$arrcol); 
+	// ¥Ñ¥¹¥ï¡¼¥É¤Î¼èÆÀ
+	$password = $data_list[0]['password'];
+	// ¥æ¡¼¥¶ÆþÎÏ¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê
+	$ret = crypt($_POST['password'], $password);
+	
+	if ($ret == $password) {
+   		// ¥»¥Ã¥·¥ç¥óÅÐÏ¿
+		fnSetLoginSession($data_list[0]['member_id'], $data_list[0]['authority'], $data_list[0]['login_date'], $data_list[0]['name']);
+		// ¥í¥°¥¤¥óÆü»þ¤ÎÅÐÏ¿
+		fnSetLoginDate();
+		return true;
+	} 
+	
+	// ¥Ñ¥¹¥ï¡¼¥É
+	gfPrintLog($_POST['login_id'] . " password incorrect.");
+	return false;
+}
+
+/* Ç§¾Ú¥»¥Ã¥·¥ç¥ó¤ÎÅÐÏ¿ */
+function fnSetLoginSession($member_id,$authority,$login_date, $login_name = '') {
+	global $osess;
+	// Ç§¾ÚºÑ¤ß¤ÎÀßÄê
+	$osess->SetSession('cert', CERT_STRING);
+	$osess->SetSession('login_id', $_POST{'login_id'});
+	$osess->SetSession('authority', $authority);
+	$osess->SetSession('member_id', $member_id);
+	$osess->SetSession('login_name', $login_name);
+	
+	if(strlen($login_date) > 0) {
+		$osess->SetSession('last_login', $login_date);
+	} else {
+		$osess->SetSession('last_login', date("Y-m-d H:i:s"));
+	}
+	$sid = $osess->GetSID();
+	// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+	gfPrintLog("login : user=".$_SESSION{'login_id'}." auth=".$_SESSION{'authority'}." lastlogin=". $_SESSION{'last_login'} ." sid=".$sid);
+}
+
+/* ¥í¥°¥¤¥óÆü»þ¤Î¹¹¿· */
+function fnSetLoginDate() {
+	global $osess;
+	$oquery = new SC_Query();
+	$sqlval['login_date'] = date("Y-m-d H:i:s");
+	$member_id = $osess->GetSession('member_id');
+	$where = "member_id = " . $member_id;
+	$ret = $oquery->update("dtb_member", $sqlval, $where);
+}
+?>
Index: /temp/trunk/html/admin/develop/upload_csv.php
===================================================================
--- /temp/trunk/html/admin/develop/upload_csv.php	(revision 1328)
+++ /temp/trunk/html/admin/develop/upload_csv.php	(revision 1328)
@@ -0,0 +1,248 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'develop/upload_csv.tpl';
+		$this->tpl_subnavi = '';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_csv';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if(ADMIN_MODE != 1) {
+	print("¤³¤Î¥Ú¡¼¥¸¤Ë¤Ï¡¢¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤»¤ó¡£");
+	exit;
+}
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objPage->arrTitle = $objFormParam->getTitleArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, 10000);
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+	
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				
+				ob_start();
+				print_r($arrCSV);
+				$objPage->tpl_debug = ob_get_contents();
+				ob_end_clean();	
+				
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				// ÃÍ¤ò¥Õ¥©¡¼¥Þ¥Ã¥ÈÊÑ´¹¤·¤Æ³ÊÇ¼¤¹¤ë¡£
+				$arrRet = lfConvFormat($arrRet);
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				gfPrintLog("write $line");
+				lfInsertProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			
+			gfPrintLog("commit csv:$regist");
+						
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", MTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥Æ¥´¥êID", "category_id", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÆÃÊÌ²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥«¡¼URL", "comment1", LTEXT_LEN, "KVa", array("URL_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	for($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë($i)", "sub_title$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È($i)", "sub_comment$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü($i)", "sub_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü³ÈÂç($i)", "sub_large_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	}
+		
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷²èÁü", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ²èÁü", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ³ÈÂç²èÁü", "main_large_image", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("Èæ³Ó²èÁü", "file1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", "file2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸ËÌµÀ©¸Â", "stock_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ÈÎÇäÌµÀ©¸Â", "sale_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+}
+
+/* ÆÃ¼ì¹àÌÜ¤ÎÊÑ´¹ */
+function lfConvFormat($array) {
+	global $arrDISP;
+	foreach($array as $key => $val) {
+		switch($key) {
+		case 'status':
+			$arrRet[$key] = sfSearchKey($arrDISP, $val, 1);
+			break;
+		default:
+			$arrRet[$key] = $val;
+			break;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¾¦ÉÊ¤Î¿·µ¬ÄÉ²Ã */
+function lfInsertProduct($objQuery) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	
+	// µ¬³Ê¤ËÅÐÏ¿¤µ¤ì¤ëÃÍ¤ò½ü³°¤¹¤ë¡£
+	foreach($arrRet as $key => $val) {
+		switch($key) {
+		case 'product_code':
+		case 'price01':
+		case 'price02':
+		case 'stock':
+		case 'stock_unlimited':
+			break;
+		default:
+			$sqlval[$key] = $val;
+			break;
+		}
+	}
+			
+	$product_id = $objQuery->nextval("dtb_products", "product_id");
+	$sqlval['product_id'] = $product_id;
+	$sqlval['status'] = 1;	// É½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "delete = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	
+	gfPrintLog("insert productclass end");
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_products", $sqlval);
+	
+	gfPrintLog("insert product end");
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError(false);
+	
+	if(!isset($objErr->arrErr['category_id'])) {
+		$objQuery = new SC_Query();
+		$col = "level";
+		$table = "dtb_category";
+		$where = "category_id = ?";
+		$level = $objQuery->get($table, $col, $where, array($arrRet['category_id']));
+		if($level != LEVEL_MAX) {
+			$objErr->arrErr['category_id'] = "¢¨ ¤³¤Î¥«¥Æ¥´¥êID¤Ë¤Ï¾¦ÉÊ¤òÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/admin/develop/csv.php
===================================================================
--- /temp/trunk/html/admin/develop/csv.php	(revision 1328)
+++ /temp/trunk/html/admin/develop/csv.php	(revision 1328)
@@ -0,0 +1,219 @@
+<?php
+
+require_once("../require.php");
+
+$conn = new SC_DBConn();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+
+// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+$filepath = $argv[1]; 
+
+if(!file_exists($filepath)) {
+	fwrite(STDOUT, "no file exists.\n");
+	exit;
+}
+
+// ¥¨¥ó¥³¡¼¥É
+$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+
+$total = 0;
+
+for($i = 0; $i < 1500; $i++) {
+	$ret = lfRegistCSV($enc_filepath, $colmax, $total);
+	$total+= $ret;
+}
+
+fwrite(STDOUT, "¢£" . $total . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£\n");
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", MTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥Æ¥´¥êID", "category_id", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÆÃÊÌ²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥«¡¼URL", "comment1", LTEXT_LEN, "KVa", array("URL_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	for($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë($i)", "sub_title$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È($i)", "sub_comment$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü($i)", "sub_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü³ÈÂç($i)", "sub_large_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	}
+		
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷²èÁü", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ²èÁü", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ³ÈÂç²èÁü", "main_large_image", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("Èæ³Ó²èÁü", "file1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", "file2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸ËÌµÀ©¸Â", "stock_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ÈÎÇäÌµÀ©¸Â", "sale_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+}
+
+/* ÆÃ¼ì¹àÌÜ¤ÎÊÑ´¹ */
+function lfConvFormat($array) {
+	global $arrDISP;
+	foreach($array as $key => $val) {
+		switch($key) {
+		case 'status':
+			$arrRet[$key] = sfSearchKey($arrDISP, $val, 1);
+			break;
+		default:
+			$arrRet[$key] = $val;
+			break;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¾¦ÉÊ¤Î¿·µ¬ÄÉ²Ã */
+function lfInsertProduct($objQuery) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	
+	// µ¬³Ê¤ËÅÐÏ¿¤µ¤ì¤ëÃÍ¤ò½ü³°¤¹¤ë¡£
+	foreach($arrRet as $key => $val) {
+		switch($key) {
+		case 'product_code':
+		case 'price01':
+		case 'price02':
+		case 'stock':
+		case 'stock_unlimited':
+			break;
+		default:
+			$sqlval[$key] = $val;
+			break;
+		}
+	}
+				
+	$product_id = $objQuery->nextval("dtb_products", "product_id");
+	$sqlval['product_id'] = $product_id;
+	$sqlval['status'] = 1;	// É½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	
+	if($_SESSION['member_id'] == "") {
+		$sqlval['creator_id'] = '0';
+	}
+		
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "delete = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->fast_insert("dtb_products", $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError(false);
+	
+	if(!isset($objErr->arrErr['category_id'])) {
+		$objQuery = new SC_Query();
+		$col = "level";
+		$table = "dtb_category";
+		$where = "category_id = ?";
+		$level = $objQuery->get($table, $col, $where, array($arrRet['category_id']));
+		if($level != LEVEL_MAX) {
+			$objErr->arrErr['category_id'] = "¢¨ ¤³¤Î¥«¥Æ¥´¥êID¤Ë¤Ï¾¦ÉÊ¤òÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+		}
+	}
+	return $objErr->arrErr;
+}
+
+function lfRegistCSV($filepath, $colmax, $total) {
+	global $objFormParam;
+			
+	$fp = fopen($filepath, "r");
+	$line = 0;		// ¹Ô¿ô
+	$regist = 0;	// ÅÐÏ¿¿ô
+	
+	$objQuery = new SC_Query();
+	
+	$err = false;
+	
+	while(!feof($fp)) {
+		$arrCSV = fgetcsv($fp, 10000);
+		// ¹Ô¥«¥¦¥ó¥È
+		$line++;
+						
+		// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+		$max = count($arrCSV);
+		
+		// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+		if($max <= 1) {
+			continue;			
+		}
+			
+		// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+		if($max != $colmax) {
+			fwrite(STDOUT, "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£\n");
+			
+			ob_start();
+			print_r($arrCSV);
+			$objPage->tpl_debug = ob_get_contents();
+			ob_end_clean();	
+			
+			$err = true;
+		} else {
+			// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+			$objFormParam->setParam($arrCSV, true);
+			$arrRet = $objFormParam->getHashArray();
+			// ÃÍ¤ò¥Õ¥©¡¼¥Þ¥Ã¥ÈÊÑ´¹¤·¤Æ³ÊÇ¼¤¹¤ë¡£
+			$arrRet = lfConvFormat($arrRet);
+			$objFormParam->setParam($arrRet);
+			// ÆþÎÏÃÍ¤ÎÊÑ´¹
+			$objFormParam->convParam();
+			// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+			$objPage->arrCSVErr = lfCheckError();
+		}
+			
+		// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		if(count($objPage->arrCSVErr) > 0) {
+			fwrite(STDOUT, "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£\n");
+			$objPage->arrParam = $objFormParam->getHashArray();
+			$err = true;
+		}
+			
+		if(!$err) {
+			$all = $total + $line;
+			fwrite(STDOUT, "writing $all\n");
+			$objQuery->begin();
+			lfInsertProduct($objQuery);
+			$objQuery->commit();
+			$regist++;
+		}
+	}
+	fclose($fp);
+	
+	return $regist;
+}
+?>
Index: /temp/trunk/html/admin/logout.php
===================================================================
--- /temp/trunk/html/admin/logout.php	(revision 1328)
+++ /temp/trunk/html/admin/logout.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once("./require.php");
+
+$objSess = new SC_Session();
+$objSess->logout();
+
+header("Location: /admin/index.php");
+
+?>
Index: /temp/trunk/html/admin/basis/payment_input.php
===================================================================
--- /temp/trunk/html/admin/basis/payment_input.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/payment_input.php	(revision 1328)
@@ -0,0 +1,167 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/payment_input.tpl';
+		$this->tpl_subtitle = '»ÙÊ§ÊýË¡ÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+$objUpFile = lfInitFile($objUpFile);
+// Hidden¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setHiddenFileList($_POST);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+	if(count($objPage->arrErr) == 0) {
+		lfRegistData($_POST['payment_id']);
+		// °ì»þ¥Õ¥¡¥¤¥ë¤òËÜÈÖ¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤¹¤ë
+		$objUpFile->moveTempFile();
+		// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¹¹¿·¤¹¤ë¤è¤¦¤Ë¥»¥Ã¥È¤¹¤ë¡£
+		$objPage->tpl_onload="fnUpdateParent('".URL_PAYMENT_TOP."'); window.close();";
+	}
+	break;
+// ²èÁü¤Î¥¢¥Ã¥×¥í¡¼¥É
+case 'upload_image':
+	// ¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge($objPage->arrErr, $objUpFile->checkEXISTS($_POST['image_key']));
+	// ²èÁüÊÝÂ¸½èÍý
+	$objPage->arrErr[$_POST['image_key']] = $objUpFile->makeTempFile($_POST['image_key']);
+	break;
+// ²èÁü¤Îºï½ü
+case 'delete_image':
+	$objUpFile->deleteFile($_POST['image_key']);
+	break;
+default:
+	break;
+}
+
+if($_POST['mode'] == "") {
+	switch($_GET['mode']) {
+	case 'pre_edit':
+		if(sfIsInt($_GET['payment_id'])) {
+			$arrRet = lfGetData($_GET['payment_id']);
+			$objFormParam->setParam($arrRet);
+			// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+			$objUpFile->setDBFileList($arrRet);
+			$objPage->tpl_payment_id = $_GET['payment_id'];
+		}
+		break;
+	default:
+		break;
+	}
+} else {
+	$objPage->tpl_payment_id = $_POST['payment_id'];
+}
+
+$objPage->arrDelivList = sfGetIDValueList("dtb_deliv", "deliv_id", "service_name");
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+// FORMÉ½¼¨ÍÑÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+// HIDDENÍÑ¤ËÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrHidden = array_merge((array)$objPage->arrHidden, (array)$objUpFile->getHiddenFileList());
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile($objUpFile) {
+	$objUpFile->addFile("¥í¥´²èÁü", 'payment_image', array('gif'), IMAGE_SIZE, false, CLASS_IMAGE_WIDTH, CLASS_IMAGE_HEIGHT);
+	return $objUpFile;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("»ÙÊ§ÊýË¡", "payment_method", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¼ê¿ôÎÁ", "charge", PRICE_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¾ò·ï(¡Á±ß°Ê¾å)", "rule", PRICE_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¾ò·ï(¡Á±ß°Ê²¼)", "upper_rule", PRICE_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÇÛÁ÷¥µ¡¼¥Ó¥¹", "deliv_id", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸ÇÄê", "fix");
+}
+
+/* DB¤«¤é¥Ç¡¼¥¿¤òÆÉ¤ß¹þ¤à */
+function lfGetData($payment_id) {
+	$objQuery = new SC_Query();
+	$where = "payment_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_payment", $where, array($payment_id));
+	return $arrRet[0];
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤òÅÐÏ¿¤¹¤ë */
+function lfRegistData($payment_id = "") {
+	global $objFormParam;
+	global $objUpFile;
+	
+	$objQuery = new SC_Query();
+	$sqlval = $objFormParam->getHashArray();
+	$arrRet = $objUpFile->getDBFileList();	// ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+	$sqlval = array_merge($sqlval, $arrRet);	
+	$sqlval['update_date'] = 'Now()';
+	
+	if($sqlval['fix'] != '1') {
+		$sqlval['fix'] = 2;	// ¼«Í³ÀßÄê
+	}
+	
+	// ¿·µ¬ÅÐÏ¿
+	if($payment_id == "") {
+		// INSERT¤Î¼Â¹Ô
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		$sqlval['rank'] = $objQuery->max("dtb_payment", "rank") + 1;
+		$objQuery->insert("dtb_payment", $sqlval);
+	// ´ûÂ¸ÊÔ½¸
+	} else {
+		$where = "payment_id = ?";
+		$objQuery->update("dtb_payment", $sqlval, $where, array($payment_id));
+	}
+	
+	$objQuery->getLastQuery(true);
+}
+
+
+/*¡¡ÍøÍÑ¾ò·ï¤Î¿ôÃÍ¥Á¥§¥Ã¥¯ */
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÍøÍÑ¾ò·ï¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("ÍøÍÑ¾ò·ï(¡Á±ß°Ê¾å)", "ÍøÍÑ¾ò·ï(¡Á±ß°Ê²¼)", "rule", "upper_rule"), array("GREATER_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+
+?>
Index: /temp/trunk/html/admin/basis/kiyaku.php
===================================================================
--- /temp/trunk/html/admin/basis/kiyaku.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/kiyaku.php	(revision 1328)
@@ -0,0 +1,145 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/kiyaku.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'kiyaku';
+		$this->tpl_subtitle = '²ñ°÷µ¬ÌóÅÐÏ¿';
+		$this->tpl_mainno = 'basis';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// Í×µáÈ½Äê
+switch($_POST['mode']) {
+// ÊÔ½¸½èÍý
+case 'edit':
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck();
+	if(count($objPage->arrErr) <= 0) {
+		if($_POST['kiyaku_id'] == "") {
+			lfInsertClass();	// ¿·µ¬ºîÀ®
+		} else {
+			lfUpdateClass();	// ´ûÂ¸ÊÔ½¸
+		}
+		// ºÆÉ½¼¨
+		sfReload();
+	} else {
+		// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+		$objPage->tpl_kiyaku_id = $_POST['kiyaku_id'];
+	}
+	break;
+// ºï½ü
+case 'delete':
+	sfDeleteRankRecord("dtb_kiyaku", "kiyaku_id", $_POST['kiyaku_id'], "", true);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+// ÊÔ½¸Á°½èÍý
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$where = "kiyaku_id = ?";
+	$arrRet = $objQuery->select("kiyaku_text, kiyaku_title", "dtb_kiyaku", $where, array($_POST['kiyaku_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['kiyaku_title'] = $arrRet[0]['kiyaku_title'];
+	$objPage->arrForm['kiyaku_text'] = $arrRet[0]['kiyaku_text'];
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->tpl_kiyaku_id = $_POST['kiyaku_id'];
+break;
+case 'down':
+	sfRankDown("dtb_kiyaku", "kiyaku_id", $_POST['kiyaku_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_kiyaku", "kiyaku_id", $_POST['kiyaku_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+default:
+	break;
+}
+
+// µ¬³Ê¤ÎÆÉ¹þ
+$where = "delete <> 1";
+$objQuery->setorder("rank DESC");
+$objPage->arrKiyaku = $objQuery->select("kiyaku_title, kiyaku_text, kiyaku_id", "dtb_kiyaku", $where);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------------
+
+/* DB¤Ø¤ÎÁÞÆþ */
+function lfInsertClass() {
+	$objQuery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['kiyaku_title'] = $_POST['kiyaku_title'];
+	$sqlval['kiyaku_text'] = $_POST['kiyaku_text'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_kiyaku", "rank") + 1;
+	$sqlval['update_date'] = "Now()";
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_kiyaku", $sqlval);
+	return $ret;
+}
+
+/* DB¤Ø¤Î¹¹¿· */
+function lfUpdateClass() {
+	$objQuery = new SC_Query();
+	// UPDATE¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['kiyaku_title'] = $_POST['kiyaku_title'];
+	$sqlval['kiyaku_text'] = $_POST['kiyaku_text'];
+	$sqlval['update_date'] = "Now()";
+	$where = "kiyaku_id = ?";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_kiyaku", $sqlval, $where, array($_POST['kiyaku_id']));
+	return $ret;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	// Ê¸»úÊÑ´¹
+	$arrConvList['kiyaku_title'] = "KVa";
+
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("µ¬Ìó¥¿¥¤¥È¥ë", "kiyaku_title", SMTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("µ¬ÌóÆâÍÆ", "kiyaku_title", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	if(!isset($objErr->arrErr['name'])) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("kiyaku_id, kiyaku_title", "dtb_kiyaku", "delete = 0 AND kiyaku_title = ?", array($_POST['kiyaku_title']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç		
+		if ($arrRet[0]['kiyaku_id'] != $_POST['kiyaku_id'] && $arrRet[0]['kiyaku_title'] == $_POST['kiyaku_title']) {
+			$objErr->arrErr['name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/admin/basis/payment.php
===================================================================
--- /temp/trunk/html/admin/basis/payment.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/payment.php	(revision 1328)
@@ -0,0 +1,64 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/payment.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subno = 'payment';
+		$this->tpl_subtitle = '»ÙÊ§ÊýË¡ÀßÄê';
+	}
+}
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+switch($_POST['mode']) {
+	case 'delete':
+	// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+	sfDeleteRankRecord("dtb_payment", "payment_id", $_POST['payment_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_payment", "payment_id", $_POST['payment_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'down':
+	sfRankDown("dtb_payment", "payment_id", $_POST['payment_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+}
+
+$objPage->arrDelivList = sfGetIDValueList("dtb_deliv", "deliv_id", "service_name");
+$objPage->arrPaymentListFix = lfGetPaymentList(1);
+$objPage->arrPaymentListFree = lfGetPaymentList(2);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+function lfGetPaymentList($fix = 1) {
+	$objQuery = new SC_Query();
+	// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+	$col = "payment_id, payment_method, charge, rule, upper_rule, note, deliv_id";
+	$where = "delete = 0 AND fix = ?";
+	$table = "dtb_payment";
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select($col, $table, $where, array($fix));
+	return $arrRet;
+}
+
+
+
+?>
Index: /temp/trunk/html/admin/basis/delivery_input.php
===================================================================
--- /temp/trunk/html/admin/basis/delivery_input.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/delivery_input.php	(revision 1328)
@@ -0,0 +1,177 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/delivery_input.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'delivery';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		$this->tpl_subtitle = 'ÇÛÁ÷¶È¼ÔÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError();
+	if(count($objPage->arrErr) == 0) {
+		$objPage->tpl_deliv_id = lfRegistData();
+		$objPage->tpl_onload = "window.alert('ÇÛÁ÷¶È¼ÔÀßÄê¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+	break;
+case 'pre_edit':
+	if($_POST['deliv_id'] != "") {
+		lfGetDelivData($_POST['deliv_id']);
+		$objPage->tpl_deliv_id = $_POST['deliv_id'];
+	}
+	break;
+default:
+	break;
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("ÇÛÁ÷¶È¼ÔÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Ì¾¾Î", "service_name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÁÉ¼No.³ÎÇ§URL", "confirm_url", STEXT_LEN, "n", array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
+	
+	for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+		$objFormParam->addParam("ÇÛÁ÷»þ´Ö$cnt", "time$cnt", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	}
+	
+	if(INPUT_DELIV_FEE) {
+		for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+			$objFormParam->addParam("ÇÛÁ÷ÎÁ¶â$cnt", "fee$cnt", PRICE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+		}
+	}
+}
+
+/* DB¤ËÅÐÏ¿¤¹¤ë */
+function lfRegistData() {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval['name'] = $arrRet['name'];
+	$sqlval['service_name'] = $arrRet['service_name'];
+	$sqlval['confirm_url'] = $arrRet['confirm_url'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['update_date'] = 'Now()';
+	
+	if($_POST['deliv_id'] != "") {
+		$deliv_id = $_POST['deliv_id'];
+		$where = "deliv_id = ?";
+		$objQuery->update("dtb_deliv", $sqlval, $where, array($deliv_id));
+		$objQuery->delete("dtb_delivfee", $where, array($deliv_id));
+		$objQuery->delete("dtb_delivtime", $where, array($deliv_id));
+	} else {
+		// ÅÐÏ¿¤¹¤ëÇÛÁ÷¶È¼ÔID¤Î¼èÆÀ
+		$deliv_id = $objQuery->nextval('dtb_deliv', 'deliv_id');
+		$sqlval['deliv_id'] = $deliv_id;
+		$sqlval['rank'] = $objQuery->max("dtb_deliv", "rank") + 1;
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_deliv", $sqlval);
+	}
+	
+	$sqlval = array();
+	// ÇÛÁ÷»þ´Ö¤ÎÀßÄê
+	for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+		$keyname = "time$cnt";
+		if($arrRet[$keyname] != "") {
+			$sqlval['deliv_id'] = $deliv_id;
+			$sqlval['time'] = $arrRet[$keyname];
+			// INSERT¤Î¼Â¹Ô
+			$objQuery->insert("dtb_delivtime", $sqlval);
+		}
+	}
+	
+	if(INPUT_DELIV_FEE) {
+		$sqlval = array();
+		// ÇÛÁ÷ÎÁ¶â¤ÎÀßÄê
+		for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+			$keyname = "fee$cnt";
+			if($arrRet[$keyname] != "") {
+				$sqlval['deliv_id'] = $deliv_id;
+				$sqlval['fee'] = $arrRet[$keyname];
+				$sqlval['pref'] = $cnt;
+				// INSERT¤Î¼Â¹Ô
+				$objQuery->insert("dtb_delivfee", $sqlval);
+			}
+		}
+	}
+	$objQuery->commit();
+	return $deliv_id;
+}
+
+/* ÇÛÁ÷¶È¼Ô¾ðÊó¤Î¼èÆÀ */
+function lfGetDelivData($deliv_id) {
+	global $objFormParam;
+	$objQuery = new SC_Query();
+	// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+	$col = "deliv_id, name, service_name, confirm_url";
+	$where = "deliv_id = ?";
+	$table = "dtb_deliv";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParam($arrRet[0]);
+	// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+	$col = "time";
+	$where = "deliv_id = ?";
+	$table = "dtb_delivtime";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParamList($arrRet, 'time');
+	// ÇÛÁ÷ÎÁ¶â¤Î¼èÆÀ
+	$col = "fee";
+	$where = "deliv_id = ?";
+	$table = "dtb_delivfee";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParamList($arrRet, 'fee');
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if(!isset($objErr->arrErr['name']) && $_POST['deliv_id'] == "") {
+		// ´ûÂ¸¥Á¥§¥Ã¥¯
+		$ret = sfIsRecord("dtb_deliv", "service_name", array($arrRet['service_name']));
+		if ($ret) {
+			$objErr->arrErr['name'] = "¢¨ Æ±¤¸Ì¾¾Î¤ÎÁÈ¤ß¹ç¤ï¤»¤ÏÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+	
+	return $objErr->arrErr;
+}
Index: /temp/trunk/html/admin/basis/mail.php
===================================================================
--- /temp/trunk/html/admin/basis/mail.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/mail.php	(revision 1328)
@@ -0,0 +1,104 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/mail.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subno = 'mail';
+		$this->tpl_subtitle = '¥á¡¼¥ëÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objPage->arrMailTEMPLATE = $arrMAILTEMPLATE;
+
+
+if ( $_POST['mode'] == 'id_set'){
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥×¥ë¥À¥¦¥óÊÑ¹¹»þ
+	
+	if ( sfCheckNumLength( $_POST['template_id']) ){
+		$sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
+		$result = $conn->getAll($sql, array($_POST['template_id']) );
+		if ( $result ){
+			$objPage->arrForm = $result[0];
+		} else {
+			$objPage->arrForm['template_id'] = $_POST['template_id'];
+		}
+	}
+	
+} elseif ( $_POST['mode'] == 'regist' && sfCheckNumLength( $_POST['template_id']) ){
+
+	// POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = lfConvertParam($_POST);
+	$objPage->arrErr = fnErrorCheck($objPage->arrForm);
+	
+	if ( $objPage->arrErr ){
+		// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
+		$objPage->tpl_msg = "¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿";
+		
+	} else {
+		// Àµ¾ï
+		lfRegist($conn, $objPage->arrForm);
+		
+		// ´°Î»¥á¥Ã¥»¡¼¥¸
+		$objPage->tpl_onload = "window.alert('¥á¡¼¥ëÀßÄê¤¬´°Î»¤·¤Þ¤·¤¿¡£¥Æ¥ó¥×¥ì¡¼¥È¤òÁªÂò¤·¤ÆÆâÍÆ¤ò¤´³ÎÇ§¤¯¤À¤µ¤¤¡£');";
+		unset($objPage->arrForm);
+	}
+
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+function lfRegist( $conn, $data ){
+	
+	$data['creator_id'] = $_SESSION['member_id'];
+	$data["update_date"] = "now()";
+	
+	$sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
+	$result = $conn->getAll($sql, array($_POST['template_id']) );
+	if ( $result ){
+		$sql_where = "template_id = ". addslashes($_POST['template_id']);
+	}
+	$conn->autoExecute("dtb_mailtemplate", $data, $sql_where);	
+}
+
+
+function lfConvertParam($array) {
+	
+	$new_array["template_id"] = $array["template_id"];
+	$new_array["subject"] = mb_convert_kana($array["subject"] ,"KV");
+	$new_array["header"] = mb_convert_kana($array["header"] ,"KV");
+	$new_array["footer"] = mb_convert_kana($array["footer"] ,"KV");
+	
+	return $new_array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
+function fnErrorCheck($array) {
+	
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_id'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥¿¥¤¥È¥ë",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Ø¥Ã¥À¡¼",'header',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥Ã¥¿¡¼",'footer',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/admin/basis/delivery.php
===================================================================
--- /temp/trunk/html/admin/basis/delivery.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/delivery.php	(revision 1328)
@@ -0,0 +1,61 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/delivery.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'delivery';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		$this->tpl_subtitle = 'ÇÛÁ÷¶È¼ÔÀßÄê';
+
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+switch($_POST['mode']) {
+case 'delete':
+	// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+	sfDeleteRankRecord("dtb_deliv", "deliv_id", $_POST['deliv_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_deliv", "deliv_id", $_POST['deliv_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'down':
+	sfRankDown("dtb_deliv", "deliv_id", $_POST['deliv_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+default:
+	break;
+}
+
+// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+$col = "deliv_id, name, service_name";
+$where = "delete = 0";
+$table = "dtb_deliv";
+$objQuery->setorder("rank DESC");
+$objPage->arrDelivList = $objQuery->select($col, $table, $where);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
Index: /temp/trunk/html/admin/basis/tradelaw.php
===================================================================
--- /temp/trunk/html/admin/basis/tradelaw.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/tradelaw.php	(revision 1328)
@@ -0,0 +1,139 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/tradelaw.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'tradelaw';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		$this->tpl_subtitle = 'ÆÃÄê¾¦¼è°úË¡';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+$cnt = $objQuery->count("dtb_baseinfo");
+
+if ($cnt > 0) {
+	$objPage->tpl_mode = "update";
+} else {
+	$objPage->tpl_mode = "insert";
+}
+
+if($_POST['mode'] != "") {
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	
+	if(count($objPage->arrErr) == 0) {
+		switch($_POST['mode']) {
+		case 'update':
+			lfUpdateData(); // ´ûÂ¸ÊÔ½¸
+			break;
+		case 'insert':
+			lfInsertData(); // ¿·µ¬ºîÀ®
+			break;
+		default:
+			break;
+		}
+		// ºÆÉ½¼¨
+		//sfReload();
+		$objPage->tpl_onload = "window.alert('ÆÃÄê¾¦¼è°úË¡¤ÎÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+} else {
+	$arrCol = $objFormParam->getKeyList(); // ¥­¡¼Ì¾°ìÍ÷¤ò¼èÆÀ
+	$col	= sfGetCommaList($arrCol);
+	$arrRet = $objQuery->select($col, "dtb_baseinfo");
+	// DBÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("ÈÎÇä¶È¼Ô", "law_company", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("±¿±ÄÀÕÇ¤¼Ô", "law_manager", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "law_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "law_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "law_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "law_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "law_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "law_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "law_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "law_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ1", "law_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ2", "law_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ3", "law_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "law_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
+	$objFormParam->addParam("URL", "law_url", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK"));
+	$objFormParam->addParam("É¬Í×ÎÁ¶â", "law_term01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÃíÊ¸ÊýË¡", "law_term02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»ÙÊ§ÊýË¡", "law_term03", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»ÙÊ§´ü¸Â", "law_term04", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("°ú¤­ÅÏ¤·»þ´ü", "law_term05", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÊÖÉÊ¡¦¸ò´¹¤Ë¤Ä¤¤¤Æ", "law_term06", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+function lfUpdateData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_baseinfo", $sqlval);
+}
+
+function lfInsertData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_baseinfo", $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÅÅÏÃÈÖ¹æ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("TEL", "law_tel01", "law_tel02", "law_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "law_fax01", "law_fax02", "law_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "law_zip01", "law_zip02"), array("ALL_EXIST_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/admin/basis/seo.php
===================================================================
--- /temp/trunk/html/admin/basis/seo.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/seo.php	(revision 1328)
@@ -0,0 +1,137 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/seo.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'seo';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subtitle = 'SEO´ÉÍý';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		
+	}
+}
+
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ç¡¼¥¿¤Î¼èÆÀ
+$arrPageData = lfgetPageData(" edit_flg = 2 ");
+$objPage->arrPageData = $arrPageData;
+
+$page_id = $_POST['page_id'];
+
+if($_POST['mode'] == "confirm") {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr[$page_id] = lfErrorCheck($_POST['meta'][$page_id]);
+	
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¥Ç¡¼¥¿¤ò¹¹¿·
+	if(count($objPage->arrErr[$page_id]) == 0) {
+		// ¹¹¿·¥Ç¡¼¥¿ÇÛÎóÀ¸À®
+		$arrUpdData = array($_POST['meta'][$page_id]['author'], $_POST['meta'][$page_id]['description'], $_POST['meta'][$page_id]['keyword'], $page_id);
+		// ¥Ç¡¼¥¿¹¹¿·
+		lfUpdPageData($arrUpdData);
+	}else{	
+		// POST¤Î¥Ç¡¼¥¿¤òºÆÉ½¼¨
+		$arrPageData = lfSetData($arrPageData, $_POST['meta']);
+		$objPage->arrPageData = $arrPageData;
+	}
+}
+
+// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¥Ç¡¼¥¿¤Î¼èÆÀ
+if(count($objPage->arrErr[$page_id]) == 0) {
+	// ¥Ç¡¼¥¿¤Î¼èÆÀ
+	$arrPageData = lfgetPageData(" edit_flg = 2 ");
+	$objPage->arrPageData = $arrPageData;
+}
+
+// É½¼¨¥ÈóÉ½¼¨ÀÚ¤êÂØ¤¨
+$arrDisp_flg = array();
+foreach($arrPageData as $key => $val){
+	$arrDisp_flg[$val['page_id']] = $_POST['disp_flg'.$val['page_id']];
+}
+
+$objPage->disp_flg = $arrDisp_flg;
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdPageData
+ * ½èÍýÆâÍÆ	¡§¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È¥Æ¡¼¥Ö¥ë¤Ë¥Ç¡¼¥¿¹¹¿·¤ò¹Ô¤¦
+ * °ú¿ô		¡§¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿··ë²Ì
+ **************************************************************************************************************/
+function lfUpdPageData($arrUpdData = array()){
+	$objQuery = new SC_Query();
+	$sql = "";
+
+	// SQLÀ¸À®
+	$sql .= " UPDATE ";
+	$sql .= "     dtb_pagelayout ";
+	$sql .= " SET ";
+	$sql .= "     author = ? , ";
+	$sql .= "     description = ? , ";
+	$sql .= "     keyword = ? ";
+	$sql .= " WHERE ";
+	$sql .= "     page_id = ? ";
+	$sql .= " ";
+
+	// SQL¼Â¹Ô
+	$ret = $objQuery->query($sql, $arrUpdData);
+	
+	return $ret;	
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfErrorCheck
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§¥¨¥é¡¼¥Á¥§¥Ã¥¯ÂÐ¾Ý¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥á¥¿¥¿¥°:Author", "author", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥¿¥¿¥°:Description", "description", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥¿¥¿¥°:Keywords", "keyword", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfSetData
+ * ½èÍýÆâÍÆ	¡§¥Æ¥ó¥×¥ì¡¼¥ÈÉ½¼¨¥Ç¡¼¥¿¤ËÃÍ¤ò¥»¥Ã¥È¤¹¤ë
+ * °ú¿ô1	¡§É½¼¨¸µ¥Ç¡¼¥¿
+ * °ú¿ô2	¡§É½¼¨¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§É½¼¨¥Ç¡¼¥¿
+ **************************************************************************************************************/
+function lfSetData($arrPageData, $arrDispData){
+	
+	foreach($arrPageData as $key => $val){
+		$page_id = $val['page_id'];
+		$arrPageData[$key]['author'] = $arrDispData[$page_id]['author'];
+		$arrPageData[$key]['description'] = $arrDispData[$page_id]['description'];
+		$arrPageData[$key]['keyword'] = $arrDispData[$page_id]['keyword'];
+	}
+	
+	return $arrPageData;
+}
+
+?>
Index: /temp/trunk/html/admin/basis/index.php
===================================================================
--- /temp/trunk/html/admin/basis/index.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/index.php	(revision 1328)
@@ -0,0 +1,210 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/index.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		$this->tpl_subtitle = 'SHOP¥Þ¥¹¥¿';
+	}
+}
+
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$cnt = $objQuery->count("dtb_baseinfo");
+
+if ($cnt > 0) {
+	$objPage->tpl_mode = "update";
+} else {
+	$objPage->tpl_mode = "insert";
+}
+
+if($_POST['mode'] != "") {
+	// POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ÆþÎÏ¥Ç¡¼¥¿¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	
+	if(count($objPage->arrErr) == 0) {
+		switch($_POST['mode']) {
+		case 'update':
+			lfUpdateData($objPage->arrForm);	// ´ûÂ¸ÊÔ½¸
+			break;
+		case 'insert':
+			lfInsertData($objPage->arrForm);	// ¿·µ¬ºîÀ®
+			break;
+		default:
+			break;
+		}
+		// ºÆÉ½¼¨
+		//sfReload();
+		$objPage->tpl_onload = "window.alert('SHOP¥Þ¥¹¥¿ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+} else {
+	$arrCol = lfGetCol();
+	$col	= sfGetCommaList($arrCol);
+	$arrRet = $objQuery->select($col, "dtb_baseinfo");
+	$objPage->arrForm = $arrRet[0];
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+// ´ðËÜ¾ðÊóÍÑ¤Î¥«¥é¥à¤ò¼è¤ê½Ð¤¹¡£
+function lfGetCol() {
+	$arrCol = array(
+		"company_name",
+		"company_kana",
+		"shop_name",
+		"shop_kana",
+		"zip01",
+		"zip02",
+		"pref",
+		"addr01",
+		"addr02",
+		"tel01",
+		"tel02",
+		"tel03",
+		"fax01",
+		"fax02",
+		"fax03",
+		"business_hour",
+		"email01",
+		"email02",
+		"email03",
+		"email04",
+		"tax",
+		"tax_rule",
+		"free_rule",
+		"good_traded",
+		"message"
+		
+	);
+	return $arrCol;
+}
+
+function lfUpdateData($array) {
+	$objQuery = new SC_Query();
+	$arrCol = lfGetCol();
+	foreach($arrCol as $val) {
+		$sqlval[$val] = $array[$val];
+	}
+	$sqlval['update_date'] = 'Now()';
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_baseinfo", $sqlval);
+}
+
+function lfInsertData($array) {
+	$objQuery = new SC_Query();
+	$arrCol = lfGetCol();
+	foreach($arrCol as $val) {
+		$sqlval[$val] = $array[$val];
+	}	
+	$sqlval['update_date'] = 'Now()';
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_baseinfo", $sqlval);
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¿ÍÊª´ðËÜ¾ðÊó
+	
+	// ¥¹¥Ý¥Ã¥È¾¦ÉÊ
+	$arrConvList['company_name'] = "KVa";
+	$arrConvList['company_kana'] = "KVC";
+	$arrConvList['shop_name'] = "KVa";
+	$arrConvList['shop_kana'] = "KVC";
+	$arrConvList['addr01'] = "KVa";
+	$arrConvList['addr02'] = "KVa";
+	$arrConvList['zip01'] = "n";
+	$arrConvList['zip02'] = "n";
+	$arrConvList['tel01'] = "n";
+	$arrConvList['tel02'] = "n";
+	$arrConvList['tel03'] = "n";
+	$arrConvList['fax01'] = "n";
+	$arrConvList['fax02'] = "n";
+	$arrConvList['fax03'] = "n";
+	$arrConvList['email01'] = "a";
+	$arrConvList['email02'] = "a";
+	$arrConvList['email03'] = "a";
+	$arrConvList['email04'] = "a";
+	$arrConvList['tax'] = "n";
+	$arrConvList['free_rule'] = "n";
+	$arrConvList['business_hour'] = "KVa";
+	$arrConvList['good_traded'] = "";
+	$arrConvList['message'] = "";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("²ñ¼ÒÌ¾", "company_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("²ñ¼ÒÌ¾(¥«¥Ê)", "company_kana", STEXT_LEN), array("KANA_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Å¹Ì¾", "shop_name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Å¹Ì¾(¥«¥Ê)", "shop_kana", STEXT_LEN), array("KANA_CHECK","MAX_LENGTH_CHECK"));
+	// Í¹ÊØÈÖ¹æ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1","zip01",ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK","NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2","zip02",ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK","NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	// ½»½ê¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "pref"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("½»½ê1", "addr01", STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("½»½ê2", "addr02", STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	// ¥á¡¼¥ë¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array('¾¦ÉÊÃíÊ¸¼õÉÕ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email01", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('Ìä¤¤¹ç¤ï¤»¼õÉÕ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email02", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ëÁ÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email03", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('Á÷¿®¥¨¥é¡¼¼õÉÕ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email04", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK","MAX_LENGTH_CHECK"));
+	// ÅÅÏÃÈÖ¹æ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("TEL", "tel01", "tel02", "tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "fax01", "fax02", "fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	// ¤½¤ÎÂ¾
+	$objErr->doFunc(array("¾ÃÈñÀÇÎ¨", "tax", PERCENTAGE_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Á÷ÎÁÌµÎÁ¾ò·ï", "free_rule", PRICE_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Å¹ÊÞ±Ä¶È»þ´Ö", "business_hour", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	$objErr->doFunc(array("¼è°·¾¦ÉÊ", "good_traded", LLTEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥Ã¥»¡¼¥¸", "message", LLTEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/admin/basis/point.php
===================================================================
--- /temp/trunk/html/admin/basis/point.php	(revision 1328)
+++ /temp/trunk/html/admin/basis/point.php	(revision 1328)
@@ -0,0 +1,99 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/point.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'point';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subtitle = '¥Ý¥¤¥ó¥ÈÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+$cnt = $objQuery->count("dtb_baseinfo");
+
+if ($cnt > 0) {
+	$objPage->tpl_mode = "update";
+} else {
+	$objPage->tpl_mode = "insert";
+}
+
+if($_POST['mode'] != "") {
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = $objFormParam->checkError();
+	
+	if(count($objPage->arrErr) == 0) {
+		switch($_POST['mode']) {
+		case 'update':
+			lfUpdateData(); // ´ûÂ¸ÊÔ½¸
+			break;
+		case 'insert':
+			lfInsertData(); // ¿·µ¬ºîÀ®
+			break;
+		default:
+			break;
+		}
+		// ºÆÉ½¼¨
+		//sfReload();
+		$objPage->tpl_onload = "window.alert('¥Ý¥¤¥ó¥ÈÀßÄê¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+} else {
+	$arrCol = $objFormParam->getKeyList(); // ¥­¡¼Ì¾°ìÍ÷¤ò¼èÆÀ
+	$col	= sfGetCommaList($arrCol);
+	$arrRet = $objQuery->select($col, "dtb_baseinfo");
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("²ñ°÷ÅÐÏ¿»þÉÕÍ¿¥Ý¥¤¥ó¥È", "welcome_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+}
+
+function lfUpdateData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_baseinfo", $sqlval);
+}
+
+function lfInsertData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_baseinfo", $sqlval);
+}
+
Index: /temp/trunk/html/admin/customer/edit.php
===================================================================
--- /temp/trunk/html/admin/customer/edit.php	(revision 1328)
+++ /temp/trunk/html/admin/customer/edit.php	(revision 1328)
@@ -0,0 +1,303 @@
+<?php
+
+require_once("../require.php");
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $list_data;
+
+	var $arrErr;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDay;
+	var $arrPref;
+	var $arrJob;
+	var $arrSex;
+	var $arrReminder;
+	var $count;
+	
+	var $tpl_strnavi;
+				
+	function LC_Page() {
+		$this->tpl_mainpage = 'customer/edit.tpl';
+		$this->tpl_mainno = 'customer';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¸ÜµÒ¥Þ¥¹¥¿';
+		
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrJob;
+		$this->arrJob = $arrJob;
+		global $arrSex;		
+		$this->arrSex = $arrSex;
+		global $arrReminder;
+		$this->arrReminder = $arrReminder;
+	}
+}
+$objQuery = new SC_Query();
+$objConn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date(1901);
+$objPage->arrYear = $objDate->getYear();	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "email",		"convert" => "a" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+							 array(  "column" => "fax01",		"convert" => "n" ),
+							 array(  "column" => "fax02",		"convert" => "n" ),
+							 array(  "column" => "fax03",		"convert" => "n" ),
+							 array(  "column" => "sex",			"convert" => "n" ),
+							 array(  "column" => "job",			"convert" => "n" ),
+							 array(  "column" => "birth",		"convert" => "n" ),
+							 array(  "column" => "password",	"convert" => "a" ),
+							 array(  "column" => "reminder",	"convert" => "n" ),
+							 array(  "column" => "reminder_answer", "convert" => "aKV" ),
+							 array(  "column" => "note",		"convert" => "aKV" ),
+							 array(  "column" => "point",		"convert" => "n" ),
+							 array(  "column" => "status",		"convert" => "n" )
+						 );
+
+//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
+$arrRejectRegistColumn = array("year", "month", "day");
+
+//----¡¡¸ÜµÒÊÔ½¸¾ðÊó¼èÆÀ
+if ($_POST["mode"] == "edit" && is_numeric($_POST["edit_customer_id"])) {
+
+	//--¡¡¸ÜµÒ¥Ç¡¼¥¿¼èÆÀ
+	$sql = "SELECT A.*, EXTRACT(EPOCH FROM A.birth) AS birth_unix, B.mail_flag FROM dtb_customer AS A LEFT OUTER JOIN dtb_customer_mail AS B USING(email)
+			 WHERE A.delete = 0 AND A.customer_id = ?";
+	$result = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
+	$objPage->list_data = $result[0];
+	if (strlen($objPage->list_data["birth_unix"]) > 0) {
+		$objPage->list_data["year"] = date("Y", $objPage->list_data["birth_unix"]);
+		$objPage->list_data["month"] = date("m", $objPage->list_data["birth_unix"]);
+		$objPage->list_data["day"] = date("d", $objPage->list_data["birth_unix"]);
+	}
+	$objPage->list_data["password"] = DEFAULT_PASSWORD;
+	//DBÅÐÏ¿¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÅÏ¤¹
+	$objPage->tpl_edit_email = $result[0]['email'];
+	//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+	$objPage->arrPurchaseHistory = lfPurchaseHistory($_POST['edit_customer_id']);
+	// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+	$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+}
+
+//----¡¡¸ÜµÒ¾ðÊóÊÔ½¸
+if ( $_POST["mode"] != "edit" && is_numeric($_POST["customer_id"])) {
+
+	//-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	//-- ÆþÎÏ¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+
+	//-- ÆþÎÏ¥¨¥é¡¼È¯À¸ or ¥ê¥¿¡¼¥ó»þ
+	if ($objPage->arrErr || $_POST["mode"] == "return") {
+		foreach($objPage->arrForm as $key => $val) {
+			$objPage->list_data[ $key ] = $val;
+		}
+		//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+		$objPage->arrPurchaseHistory = lfPurchaseHistory($_POST['customer_id']);
+	} else {
+		//-- ³ÎÇ§
+		if ($_POST["mode"] == "confirm") {
+			$objPage->tpl_mainpage = 'customer/edit_confirm.tpl';
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+		}
+		//--¡¡ÊÔ½¸
+		if($_POST["mode"] == "complete") {
+			$objPage->tpl_mainpage = 'customer/edit_complete.tpl';
+			//-- ÊÔ½¸ÅÐÏ¿
+			sfEditCustomerData($objPage->arrForm, $arrRegistColumn);
+		}
+	}
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+
+//-------------- function
+
+// ÊÔ½¸ÅÐÏ¿
+function lfRegisDatat($array, $arrRegistColumn) {
+	global $objConn;
+	
+	foreach ($arrRegistColumn as $data) {
+		if($array[$data["column"]] != "") {
+			$arrRegist[$data["column"]] = $array[$data["column"]];
+		} else {
+			$arrRegist[$data["column"]] = NULL;
+		}
+	}
+	if (strlen($array["year"]) > 0) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	}
+
+	//-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEÊ¸¤ò¹½À®¤·¤Ê¤¤¡Ë
+	if ($array["password"] != DEFAULT_PASSWORD) {
+		$arrRegist["password"] = crypt($array["password"]);
+	} else {
+		unset($arrRegist['password']);
+	}
+	
+	$arrRegist["update_date"] = "NOW()";
+	$arrRegistMail["mail_flag"] = $array["mail_flag"];
+	$arrRegistMail['email'] = $array['email'];
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	$objConn->autoExecute("dtb_customer", $arrRegist, "customer_id = '" .addslashes($array["customer_id"]). "'");
+	//-- ¥á¥ë¥Þ¥¬ÅÐÏ¿
+	$objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($array["edit_email"]). "'");
+	$objConn->query("COMMIT");
+}
+
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+
+	$objErr->doFunc(array("²ñ°÷¾õÂÖ", 'status'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÀ«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÌ¾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê1¡Ë", "addr01", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê2¡Ë", "addr02", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	
+	//¸½²ñ°÷¤ÎÈ½Äê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇÆ±¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
+	if (strlen($array["email"]) > 0) {
+		$sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? escape '#' AND (status = 1 OR status = 2) AND delete = 0 AND customer_id <> ?";
+		$checkMail = ereg_replace( "_", "#_", $array["email"]);
+		$result = $objConn->getAll($sql, array($checkMail, $array["customer_id"]));
+		if (count($result) > 0) {
+			$objErr->arrErr["email"] .= "¢¨ ¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+		} 
+	}
+	
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(¥â¥Ð¥¤¥ë)', "email_mobile", MTEXT_LEN) ,array("EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¤´¿¦¶È", "job") ,array("NUM_CHECK"));
+	if ($array["password"] != DEFAULT_PASSWORD) {
+		$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	}
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È ¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È Åú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag") ,array("SELECT_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", 'mail_flag'), array("SELECT_CHECK"));
+	$objErr->doFunc(array("SHOPÍÑ¥á¥â", 'note', LTEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("½ê»ý¥Ý¥¤¥ó¥È", "point", TEL_LEN) ,array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+function lfPurchaseHistory($customer_id){
+		global $objQuery;
+		global $objPage;
+		
+		$objPage->tpl_pageno = $_POST['search_pageno'];
+		$objPage->edit_customer_id = $customer_id;
+
+		// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+		$page_max = SEARCH_PMAX;
+		//¹ØÆþÍúÎò¤Î·ï¿ô¼èÆÀ
+		$objPage->tpl_linemax = $objQuery->count("dtb_order","customer_id=?", array($customer_id));
+		$linemax = $objPage->tpl_linemax;
+		
+		// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+		$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage2", NAVI_PMAX);
+		$objPage->arrPagenavi = $objNavi->arrPagenavi;
+		$objPage->arrPagenavi['mode'] = 'edit';
+		$startno = $objNavi->start_row;
+		
+		// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+		$objQuery->setlimitoffset($page_max, $startno);
+		// É½¼¨½ç½ø
+		$order = "order_id DESC";
+		$objQuery->setorder($order);
+		//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+		$arrPurchaseHistory = $objQuery->select("*", "dtb_order", "customer_id=?", array($customer_id));
+		
+		return $arrPurchaseHistory;
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+
+?>
Index: /temp/trunk/html/admin/customer/index.php
===================================================================
--- /temp/trunk/html/admin/customer/index.php	(revision 1328)
+++ /temp/trunk/html/admin/customer/index.php	(revision 1328)
@@ -0,0 +1,420 @@
+<?php
+
+require_once("../require.php");
+require_once(ROOT_DIR."data/include/csv_output.inc");
+
+//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $list_data;
+	var $search_data;
+	var $arrErr;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDay;
+	var $arrJob;
+	var $arrSex;
+	var $arrPageMax;
+	var $count;
+	var $search_SQL;
+	
+	var $tpl_strnavi;
+	
+	var $arrHtmlmail;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'customer/index.tpl';
+		$this->tpl_mainno = 'customer';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¸ÜµÒ¥Þ¥¹¥¿';
+		
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrJob;
+		$arrJob["ÉÔÌÀ"] = "ÉÔÌÀ";
+		$this->arrJob = $arrJob;
+		global $arrSex;		
+		$this->arrSex = $arrSex;
+		global $arrPageRows;
+		$this->arrPageRows = $arrPageRows;
+		
+		global $arrMAILMAGATYPE;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		$this->arrHtmlmail[''] = "¤¹¤Ù¤Æ";
+		$this->arrHtmlmail[1] = $arrMAILMAGATYPE[1];
+		$this->arrHtmlmail[2] = $arrMAILMAGATYPE[2];		
+	}
+}
+
+//----¡¡CSV¥À¥¦¥ó¥í¡¼¥ÉÍÑ
+$arrColumnCSV= array(
+						0  => array("sql" => "customer_id", "csv" => "customer_id", "header" => "¸ÜµÒID"),
+						1  => array("sql" => "name01", "csv" => "name01", "header" => "Ì¾Á°1"),
+						2  => array("sql" => "name02", "csv" => "name02", "header" => "Ì¾Á°2"),
+						3  => array("sql" => "kana01", "csv" => "kana01", "header" => "¥Õ¥ê¥¬¥Ê1"),
+						4  => array("sql" => "kana02", "csv" => "kana02", "header" => "¥Õ¥ê¥¬¥Ê2"),
+						5  => array("sql" => "zip01", "csv" => "zip01", "header" => "Í¹ÊØÈÖ¹æ1"),
+						6  => array("sql" => "zip02", "csv" => "zip02", "header" => "Í¹ÊØÈÖ¹æ2"),
+						7  => array("sql" => "pref", "csv" => "pref", "header" => "ÅÔÆ»ÉÜ¸©"),
+						8  => array("sql" => "addr01", "csv" => "addr01", "header" => "½»½ê1"),
+						9  => array("sql" => "addr02", "csv" => "addr02", "header" => "½»½ê2"),
+						10 => array("sql" => "email", "csv" => "email", "header" => "E-MAIL"),
+						11 => array("sql" => "tel01", "csv" => "tel01", "header" => "TEL1"),
+						12 => array("sql" => "tel02", "csv" => "tel02", "header" => "TEL2"),
+						13 => array("sql" => "tel03", "csv" => "tel03", "header" => "TEL3"),
+						14 => array("sql" => "fax01", "csv" => "fax01", "header" => "FAX1"),
+						15 => array("sql" => "fax02", "csv" => "fax02", "header" => "FAX2"),
+						16 => array("sql" => "fax03", "csv" => "fax03", "header" => "FAX3"),
+						17 => array("sql" => "CASE WHEN sex = 1 THEN 'ÃËÀ­' ELSE '½÷À­' END AS sex", "csv" => "sex", "header" => "À­ÊÌ"),
+						18 => array("sql" => "job", "csv" => "job", "header" => "¿¦¶È"),
+						19 => array("sql" => "to_char(birth, 'YYYYÇ¯MM·îDDÆü') AS birth", "csv" => "birth", "header" => "ÃÂÀ¸Æü"),
+						20 => array("sql" => "to_char(first_buy_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS first_buy_date", "csv" => "first_buy_date", "header" => "½é²ó¹ØÆþÆü"),
+						21 => array("sql" => "to_char(last_buy_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS last_buy_date", "csv" => "last_buy_date", "header" => "ºÇ½ª¹ØÆþÆü"),
+						22 => array("sql" => "buy_times", "csv" => "buy_times", "header" => "¹ØÆþ²ó¿ô"),
+						23 => array("sql" => "point", "csv" => "point", "header" => "¥Ý¥¤¥ó¥È»Ä¹â"),
+						24 => array("sql" => "note", "csv" => "note", "header" => "È÷¹Í"),
+						25 => array("sql" => "to_char(create_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS create_date", "csv" => "create_date", "header" => "ÅÐÏ¿Æü"),
+						26 => array("sql" => "to_char(update_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS update_date", "csv" => "update_date", "header" => "¹¹¿·Æü")
+					);
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$objConn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date(1901);
+$objPage->arrYear = $objDate->getYear();	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+$objPage->objDate = $objDate;
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// POSTÃÍ¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+// ¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+
+	if (ereg("^search_", $key)) {
+		switch($key) {
+			case 'search_sex':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				if(!is_array($val)) {
+					$objPage->arrForm[$key] = split("-", $val);
+				}
+				break;
+			default:
+				$objPage->arrHidden[$key] = $val;
+				break;
+		}
+	}
+}
+
+// ¸ÜµÒºï½ü
+if ($_POST['mode'] == "delete") {
+	$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND delete = 0";
+	$result_customer = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
+
+	if ($result_customer[0]["status"] == 2) {			//ËÜ²ñ°÷ºï½ü
+		$arrDel = array("delete" => 1, "update_date" => "NOW()"); 
+		$objConn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["edit_customer_id"]) );
+	} elseif ($result_customer[0]["status"] == 1) {		//²¾²ñ°÷ºï½ü
+		$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
+		$objConn->query($sql, array($_POST["edit_customer_id"]));
+	}
+	$sql = "DELETE FROM dtb_customer_mail WHERE email = ?";
+	$objConn->query($sql, array($result_customer[0]["email"]));
+}
+
+if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError($objPage->arrForm);
+
+	$where = "delete = 0";
+
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	if (count($objPage->arrErr) == 0) {
+		
+		//-- ¸¡º÷¥Ç¡¼¥¿¼èÆÀ
+		$objSelect = new SC_CustomerList($objPage->arrForm, "customer");
+		if ($_POST["mode"] == 'csv') {
+			$searchSql = $objSelect->getListCSV($arrColumnCSV);
+		}else{
+			$searchSql = $objSelect->getList();
+		}
+		$objPage->search_data = $objConn->getAll($searchSql, $objSelect->arrVal);
+
+		switch($_POST['mode']) {
+		case 'csv':
+			$i = 0;
+			$header = "";
+			
+			// CSV¥«¥é¥à¼èÆÀ
+			$arrCsvOutput = (sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1"));
+
+			if (count($arrCsvOutput) <= 0) break;
+
+			foreach($arrCsvOutput as $data) {
+				$arrColumn[] = $data["col"];
+				if ($i != 0) $header .= ", ";
+				$header .= $data["disp_name"];
+				$i ++;
+			}
+			$header .= "\n";
+
+			//-¡¡ÅÔÆ»ÉÜ¸©/¿¦¶È¤ÎÊÑ´¹
+			for($i = 0; $i < count($objPage->search_data); $i ++) {
+				$objPage->search_data[$i]["pref"] = $arrPref[ $objPage->search_data[$i]["pref"] ];
+				$objPage->search_data[$i]["job"]  = $arrJob[ $objPage->search_data[$i]["job"] ];
+			}
+
+			//-¡¡CSV½ÐÎÏ
+			$data = lfGetCSVData($objPage->search_data, $arrColumn);
+			sfCSVDownload($header.$data);
+			exit;
+			break;
+		case 'delete_all':
+			// ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
+			$where = "product_id IN (SELECT product_id FROM vw_products_nonclass WHERE $where)";
+			$sqlval['delete'] = 1;
+			$objQuery->update("dtb_products", $sqlval, $where, $arrval);
+
+			$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND delete = 0";
+			$result_customer = $objConn->getAll($sql, array($_POST["del_customer_id"]));
+
+			if ($result_customer[0]["status"] == 2) {			//ËÜ²ñ°÷ºï½ü
+				$arrDel = array("delete" => 1, "update_date" => "NOW()");
+				$objConn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["del_customer_id"]) );
+			} elseif ($result_customer[0]["status"] == 1) {		//²¾²ñ°÷ºï½ü
+				$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
+				$objConn->query($sql, array($_POST["del_customer_id"]));
+			}
+			$sql = "DELETE FROM dtb_customer_mail WHERE email = ?";
+			$objConn->query($sql, array($result_customer[0]["email"]));	
+			
+			break;
+		default:
+
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objConn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
+			$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+			if(is_numeric($_POST['search_page_max'])) {	
+				$page_max = $_POST['search_page_max'];
+			} else {
+				$page_max = SEARCH_PMAX;
+			}
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnCustomerPage", NAVI_PMAX);
+			$startno = $objNavi->start_row;
+			$objPage->arrPagenavi = $objNavi->arrPagenavi;		
+		}
+	}
+}
+
+$objPage->arrCatList = sfGetCategoryList();
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+//--------------------------------------------------------------------------------------------------------------------------------------
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam() {
+	global $objPage;
+	
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	$arrConvList['search_customer_id'] = "n" ;
+	$arrConvList['search_name'] = "aKV" ;
+	$arrConvList['search_pref'] = "n" ;
+	$arrConvList['search_kana'] = "CKV" ;
+	$arrConvList['search_b_start_year'] = "n" ;
+	$arrConvList['search_b_start_month'] = "n" ;
+	$arrConvList['search_b_start_day'] = "n" ;
+	$arrConvList['search_b_end_year'] = "n" ;
+	$arrConvList['search_b_end_month'] = "n" ;
+	$arrConvList['search_b_end_day'] = "n" ;
+	$arrConvList['search_tel'] = "n" ;
+	$arrConvList['search_birth_month'] = "n" ;
+	$arrConvList['search_email'] = "a" ;
+	$arrConvList['search_buy_total_from'] = "n" ;
+	$arrConvList['search_buy_total_to'] = "n" ;
+	$arrConvList['search_buy_times_from'] = "n" ;
+	$arrConvList['search_buy_times_to'] = "n" ;
+	$arrConvList['search_start_year'] = "n" ;
+	$arrConvList['search_start_month'] = "n" ;
+	$arrConvList['search_start_day'] = "n" ;
+	$arrConvList['search_end_year'] = "n" ;
+	$arrConvList['search_end_month'] = "n" ;
+	$arrConvList['search_end_day'] = "n" ;
+	$arrConvList['search_page_rows'] = "n" ;
+	$arrConvList['search_buy_start_year'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü START Ç¯
+	$arrConvList['search_buy_start_month'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü START ·î
+	$arrConvList['search_buy_start_day'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü START Æü
+	$arrConvList['search_buy_end_year'] = "n" ;			//¡¡ºÇ½ª¹ØÆþÆü END Ç¯
+	$arrConvList['search_buy_end_month'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü END ·î
+	$arrConvList['search_buy_end_day'] = "n" ;			//¡¡ºÇ½ª¹ØÆþÆü END Æü
+	$arrConvList['search_buy_product_name'] = "aKV" ;	//¡¡¹ØÆþ¾¦ÉÊÌ¾
+	$arrConvList['search_buy_product_code'] = "aKV" ;	//¡¡¹ØÆþ¾¦ÉÊ¥³¡¼¥É
+	$arrConvList['search_category_id'] = "" ;			//¡¡¥«¥Æ¥´¥ê
+		
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError($array) {
+
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¸ÜµÒ¥³¡¼¥É", "search_customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "search_pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾", "search_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾(¥«¥Ê)", "search_kana", STEXT_LEN), array("KANA_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)", "search_b_start_year", "search_b_start_month", "search_b_start_day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(½ªÎ»Æü)", "search_b_end_year", "search_b_end_month", "search_b_end_day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)","ÃÂÀ¸Æü(½ªÎ»Æü)", "search_b_start_year", "search_b_start_month", "search_b_start_day", "search_b_end_year", "search_b_end_month", "search_b_end_day"), array("CHECK_SET_TERM"));
+	$objErr->doFunc(array("ÃÂÀ¸·î", "search_birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "search_email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "search_tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(³«»Ï)", "search_buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(½ªÎ»)", "search_buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	if ( (is_numeric($array["search_buy_total_from"]) && is_numeric($array["search_buy_total_to"]) ) && ($array["search_buy_total_from"] > $array["search_buy_total_to"]) ) $objErr->arrErr["search_buy_total_from"] .= "¢¨ ¹ØÆþ¶â³Û¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(³«»Ï)", "search_buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(½ªÎ»)", "search_buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	if ( (is_numeric($array["search_buy_times_from"]) && is_numeric($array["search_buy_times_to"]) ) && ($array["search_buy_times_from"] > $array["search_buy_times_to"]) ) $objErr->arrErr["search_buy_times_from"] .= "¢¨ ¹ØÆþ²ó¿ô¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)", "search_start_year", "search_start_month", "search_start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "search_end_year", "search_end_month", "search_end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "search_start_year", "search_start_month", "search_start_day", "search_end_year", "search_end_month", "search_end_day"), array("CHECK_SET_TERM"));
+	$objErr->doFunc(array("É½¼¨·ï¿ô", "search_page_rows", 3), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)", "search_buy_start_year", "search_buy_start_month", "search_buy_start_day",), array("CHECK_DATE"));	//ºÇ½ª¹ØÆþÆü(³«»ÏÆü)
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþ(½ªÎ»Æü)", "search_buy_end_year", "search_buy_end_month", "search_buy_end_day"), array("CHECK_DATE"));			//ºÇ½ª¹ØÆþÆü(½ªÎ»Æü)
+	//¹ØÆþ¶â³Û(from) ¡ä ¹ØÆþ¶â³Û(to) ¤Î¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "search_buy_start_year", "search_buy_start_month", "search_buy_start_day", "search_buy_end_year", "search_buy_end_month", "search_buy_end_day"), array("CHECK_SET_TERM"));	
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊ¥³¡¼¥É", "search_buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));						//¹ØÆþ¾¦ÉÊ¥³¡¼¥É
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊÌ¾", "search_buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));							//¹ØÆþ¾¦ÉÊÌ¾¾Î
+	
+	return $objErr->arrErr;
+}
+
+function lfSetWhere($arrForm){
+	foreach ($arrForm as $key => $val) {
+		
+		$val = sfManualEscape($val);
+		
+		if($val == "") continue;
+		
+		switch ($key) {
+			case 'search_product_id':
+				$where .= " AND product_id = ?";
+				$arrval[] = $val;
+				break;
+			case 'search_product_class_id':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
+				$arrval[] = $val;
+				break;
+			case 'search_name':
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
+				if($tmp_where != "") {
+					$where.= " AND $tmp_where";
+					$arrval = array_merge($arrval, $tmp_arrval);
+				}
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_startyear':
+				$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+				$where.= " AND update_date >= ?";
+				$arrval[] = $date;
+				break;
+			case 'search_endyear':
+				$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
+				$where.= " AND update_date <= ?";
+				$arrval[] = $date;
+				break;
+			case 'search_product_flag':
+				global $arrSTATUS;
+				$search_product_flag = sfSearchCheckBoxes($val);
+				if($search_product_flag != "") {
+					$where.= " AND product_flag LIKE ?";
+					$arrval[] = $search_product_flag;					
+				}
+				break;
+			case 'search_status':
+				$tmp_where = "";
+				foreach ($val as $element){
+					if ($element != ""){
+						if ($tmp_where == ""){
+							$tmp_where.="AND (status LIKE ? "; 
+						}else{
+							$tmp_where.="OR status LIKE ? ";
+						}
+						$arrval[]=$element;
+					}
+				}
+				if ($tmp_where != ""){
+					$tmp_where.=")";
+					$where.= "$tmp_where";
+				}	
+				break;
+			default:
+				break;
+		}
+	}
+}
+
+//---- CSV½ÐÎÏÍÑ¥Ç¡¼¥¿¼èÆÀ
+function lfGetCSVData( $array, $arrayIndex){	
+	
+	for ($i=0; $i<count($array); $i++){
+		
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	
+	return $return;
+}
+
+
+?>
Index: /temp/trunk/html/admin/require.php
===================================================================
--- /temp/trunk/html/admin/require.php	(revision 1328)
+++ /temp/trunk/html/admin/require.php	(revision 1328)
@@ -0,0 +1,27 @@
+<?php
+
+$include_dir = realpath(dirname( __FILE__));
+
+require_once($include_dir . "/../../data/conf/conf.php");	
+require_once($include_dir . "/../../data/lib/glib.php");
+require_once($include_dir . "/../../data/lib/slib.php");
+require_once($include_dir . "/../../data/class/SC_View.php");
+require_once($include_dir . "/../../data/class/SC_DbConn.php");
+require_once($include_dir . "/../../data/class/SC_Session.php");
+require_once($include_dir . "/../../data/class/SC_Query.php");
+require_once($include_dir . "/../../data/class/SC_SelectSql.php");
+require_once($include_dir . "/../../data/class/SC_CheckError.php");
+require_once($include_dir . "/../../data/class/SC_PageNavi.php");
+require_once($include_dir . "/../../data/class/SC_Date.php");
+require_once($include_dir . "/../../data/class/SC_Image.php");
+require_once($include_dir . "/../../data/class/SC_UploadFile.php");
+require_once($include_dir . "/../../data/class/SC_JpGraph.php");
+require_once($include_dir . "/../../data/class/SC_SiteInfo.php");
+require_once($include_dir . "/../../data/class/GC_SendMail.php");
+require_once($include_dir . "/../../data/class/SC_FormParam.php");
+require_once($include_dir . "/../../data/class/SC_CustomerList.php");
+require_once($include_dir . "/../../data/class/SC_Customer.php");
+require_once($include_dir . "/../../data/class/SC_Pdf.php");
+
+//fnSetErrorHandler();
+?>
Index: /temp/trunk/html/admin/products/classcategory.php
===================================================================
--- /temp/trunk/html/admin/products/classcategory.php	(revision 1328)
+++ /temp/trunk/html/admin/products/classcategory.php	(revision 1328)
@@ -0,0 +1,170 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrHidden;
+	var $arrForm;
+	var $tpl_class_name;
+	var $arrClassCat;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/classcategory.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_subno = 'class';
+		$this->tpl_subtitle = 'µ¬³ÊÅÐÏ¿';
+		$this->tpl_mainno = 'products';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$get_check = false;
+
+// µ¬³ÊID¤Î¥Á¥§¥Ã¥¯
+if(sfIsInt($_GET['class_id'])) {
+	// µ¬³ÊÌ¾¤Î¼èÆÀ
+	$objPage->tpl_class_name = $objQuery->get("dtb_class", "name", "class_id = ?", array($_GET['class_id']));
+	if($objPage->tpl_class_name != "") {
+		// µ¬³ÊID¤Î°ú¤­·Ñ¤®
+		$objPage->arrHidden['class_id'] = $_GET['class_id'];
+		$get_check = true;
+	}
+}
+
+if(!$get_check) {
+	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸¤ËÈô¤Ð¤¹¡£
+	header("Location: " . URL_CLASS_REGIST);
+	exit;
+}
+
+// ¿·µ¬ºîÀ® or ÊÔ½¸
+switch($_POST['mode']) {
+// ÅÐÏ¿¥Ü¥¿¥ó²¡²¼
+case 'edit':
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	$_POST = lfConvertParam($_POST);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck();
+	if(count($objPage->arrErr) <= 0) {
+		if($_POST['classcategory_id'] == "") {
+			lfInsertClass();	// DB¤Ø¤Î½ñ¤­¹þ¤ß
+		} else {
+			lfUpdateClass();	// DB¤Ø¤Î½ñ¤­¹þ¤ß
+		}
+		// ºÆÉ½¼¨
+		sfReload("class_id=" . $_GET['class_id']);
+	} else {
+		// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+		$objPage->tpl_classcategory_id = $_POST['classcategory_id'];
+	}
+	break;
+// ºï½ü
+case 'delete':
+	// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+	$where = "class_id = " . addslashes($_POST['class_id']);
+	sfDeleteRankRecord("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where, true);
+	break;
+// ÊÔ½¸Á°½èÍý
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$where = "classcategory_id = ?";
+	$name = $objQuery->get("dtb_classcategory", "name", $where, array($_POST['classcategory_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['name'] = $name;
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->tpl_classcategory_id = $_POST['classcategory_id'];
+	break;
+case 'down':
+	$where = "class_id = " . addslashes($_POST['class_id']);
+	sfRankDown("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where);
+	break;
+case 'up':
+	$where = "class_id = " . addslashes($_POST['class_id']);
+	sfRankUp("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where);
+	break;
+default:
+	break;
+}
+
+// µ¬³ÊÊ¬Îà¤ÎÆÉ¹þ
+$where = "delete <> 1 AND class_id = ?";
+$objQuery->setorder("rank DESC");
+$objPage->arrClassCat = $objQuery->select("name, classcategory_id", "dtb_classcategory", $where, array($_GET['class_id']));
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------
+
+/* DB¤Ø¤ÎÁÞÆþ */
+function lfInsertClass() {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	// ¿Æµ¬³ÊID¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+	$where = "delete <> 1 AND class_id = ?";
+	$ret = 	$objQuery->get("dtb_class", "class_id", $where, array($_POST['class_id']));
+	if($ret != "") {	
+		// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+		$sqlval['name'] = $_POST['name'];
+		$sqlval['class_id'] = $_POST['class_id'];
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		$sqlval['rank'] = $objQuery->max("dtb_classcategory", "rank", $where, array($_POST['class_id'])) + 1;
+		// INSERT¤Î¼Â¹Ô
+		$ret = $objQuery->insert("dtb_classcategory", $sqlval);
+	}
+	$objQuery->commit();
+	return $ret;
+}
+
+/* DB¤Ø¤Î¹¹¿· */
+function lfUpdateClass() {
+	$objQuery = new SC_Query();
+	// UPDATE¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['update_date'] = "Now()";
+	$where = "classcategory_id = ?";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_classcategory", $sqlval, $where, array($_POST['classcategory_id']));
+	return $ret;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	// Ê¸»úÊÑ´¹
+	$arrConvList['name'] = "KVa";
+
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("Ê¬ÎàÌ¾", "name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	if(!isset($objErr->arrErr['name'])) {
+		$objQuery = new SC_Query();
+		$where = "class_id = ? AND name = ?";
+		$arrRet = $objQuery->select("classcategory_id, name", "dtb_classcategory", $where, array($_GET['class_id'], $_POST['name']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç
+		if ($arrRet[0]['classcategory_id'] != $_POST['classcategory_id'] && $arrRet[0]['name'] == $_POST['name']) {
+			$objErr->arrErr['name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/admin/products/class.php
===================================================================
--- /temp/trunk/html/admin/products/class.php	(revision 1328)
+++ /temp/trunk/html/admin/products/class.php	(revision 1328)
@@ -0,0 +1,144 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/class.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_subno = 'class';
+		$this->tpl_subtitle = 'µ¬³ÊÅÐÏ¿';
+		$this->tpl_mainno = 'products';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// Í×µáÈ½Äê
+switch($_POST['mode']) {
+// ÊÔ½¸½èÍý
+case 'edit':
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck();
+	if(count($objPage->arrErr) <= 0) {
+		if($_POST['class_id'] == "") {
+			lfInsertClass();	// ¿·µ¬ºîÀ®
+		} else {
+			lfUpdateClass();	// ´ûÂ¸ÊÔ½¸
+		}
+		// ºÆÉ½¼¨
+		sfReload();
+	} else {
+		// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+		$objPage->tpl_class_id = $_POST['class_id'];
+	}
+	break;
+// ºï½ü
+case 'delete':
+	sfDeleteRankRecord("dtb_class", "class_id", $_POST['class_id'], "", true);
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_classcategory", "class_id = ?", $_POST['class_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+// ÊÔ½¸Á°½èÍý
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$where = "class_id = ?";
+	$class_name = $objQuery->get("dtb_class", "name", $where, array($_POST['class_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['name'] = $class_name;
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->tpl_class_id = $_POST['class_id'];
+break;
+case 'down':
+	sfRankDown("dtb_class", "class_id", $_POST['class_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_class", "class_id", $_POST['class_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+default:
+	break;
+}
+
+// µ¬³Ê¤ÎÆÉ¹þ
+$where = "delete <> 1";
+$objQuery->setorder("rank DESC");
+$objPage->arrClass = $objQuery->select("name, class_id", "dtb_class", $where);
+$objPage->arrClassCatCount = sfGetClassCatCount();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------------
+
+/* DB¤Ø¤ÎÁÞÆþ */
+function lfInsertClass() {
+	$objQuery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_class", "rank") + 1;
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_class", $sqlval);
+	return $ret;
+}
+
+/* DB¤Ø¤Î¹¹¿· */
+function lfUpdateClass() {
+	$objQuery = new SC_Query();
+	// UPDATE¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['update_date'] = "Now()";
+	$where = "class_id = ?";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_class", $sqlval, $where, array($_POST['class_id']));
+	return $ret;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	// Ê¸»úÊÑ´¹
+	$arrConvList['name'] = "KVa";
+
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("µ¬³ÊÌ¾", "name", STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	if(!isset($objErr->arrErr['name'])) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("class_id, name", "dtb_class", "delete = 0 AND name = ?", array($_POST['name']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç		
+		if ($arrRet[0]['class_id'] != $_POST['class_id'] && $arrRet[0]['name'] == $_POST['name']) {
+			$objErr->arrErr['name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/admin/products/product_class.php
===================================================================
--- /temp/trunk/html/admin/products/product_class.php	(revision 1328)
+++ /temp/trunk/html/admin/products/product_class.php	(revision 1328)
@@ -0,0 +1,357 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrCatList;
+	var $arrSRANK;
+	var $arrForm;
+	var $arrSubList;
+	var $arrHidden;
+	var $arrTempImage;
+	var $arrSaveImage;
+	var $tpl_mode;
+	var $arrSearchHidden;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product_class.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'product';
+		$this->tpl_subtitle = '¾¦ÉÊÅÐÏ¿';
+		global $arrSRANK;
+		$this->arrSRANK = $arrSRANK;
+		global $arrDISP;
+		$this->arrDISP = $arrDISP;
+		global $arrCLASS;
+		$this->arrCLASS = $arrCLASS;
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		$this->tpl_onload = "";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+$objPage->tpl_product_id = $_POST['product_id'];
+$objPage->tpl_pageno = $_POST['pageno'];
+
+switch($_POST['mode']) {
+// ÊÔ½¸Í×µá
+case 'pre_edit':
+	$objQuery = new SC_Query();
+	$where = "product_id = ? AND NOT(classcategory_id1 = 0 AND classcategory_id2 = 0) ";
+	$ret = $objQuery->count("dtb_products_class", $where, array($_POST['product_id']));
+	
+	if($ret > 0) {
+		// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ(DB¤ÎÃÍ¤òÍ¥Àè¤¹¤ë¡£)
+		$objPage->arrClassCat = lfGetClassCatListEdit($_POST['product_id']);	
+	}
+	
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// µ¬³ÊÁÈ¤ß¹ç¤ï¤»É½¼¨
+case 'disp':
+	$objPage->arrForm['select_class_id1'] = $_POST['select_class_id1'];
+	$objPage->arrForm['select_class_id2'] = $_POST['select_class_id2'];
+
+	$objPage->arrErr = lfClassError();
+	if (count($objPage->arrErr) == 0) {
+		// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ
+		$objPage->arrClassCat = lfGetClassCatListDisp($_POST['select_class_id1'], $_POST['select_class_id2']);
+	}
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// µ¬³ÊÅÐÏ¿Í×µá
+case 'edit':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($_POST);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfProductClassError($objPage->arrForm);
+	
+	if(count($objPage->arrErr) == 0) {
+		// ³ÎÇ§¥Ú¡¼¥¸ÀßÄê
+		$objPage->tpl_mainpage = 'products/product_class_confirm.tpl';
+		lfProductConfirmPage(); // ³ÎÇ§¥Ú¡¼¥¸É½¼¨
+	} else {
+		// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ
+		$objPage->arrClassCat = lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
+		lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤é¤ÎÌá¤ê
+case 'confirm_return':
+	// ¥Õ¥©¡¼¥à¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// µ¬³Ê¤ÎÁªÂò¾ðÊó¤Ï°ú¤­·Ñ¤¬¤Ê¤¤¡£
+	$objPage->arrForm['select_class_id1'] = "";
+	$objPage->arrForm['select_class_id2'] = "";
+	// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ(¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï½ÐÎÏ¤·¤Ê¤¤)
+	$objPage->arrClassCat = lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+case 'complete':
+	// ´°Î»¥Ú¡¼¥¸ÀßÄê	
+	$objPage->tpl_mainpage = 'products/product_class_complete.tpl';
+	// ¾¦ÉÊµ¬³Ê¤ÎÅÐÏ¿
+	lfInsertProductClass($_POST, $_POST['product_id']);
+	break;
+default:
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------
+/* µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductClassPage() {
+	global $objPage;
+	$objPage->arrHidden = $_POST;
+	$objPage->arrHidden['select_class_id1'] = "";
+	$objPage->arrHidden['select_class_id2'] = "";
+	$arrClass = sfGetIDValueList("dtb_class", 'class_id', 'name');
+	// µ¬³ÊÊ¬Îà¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤µ¬³Ê¤ÏÉ½¼¨¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
+	$arrClassCatCount = sfGetClassCatCount();
+	foreach($arrClass as $key => $val) {
+		if($arrClassCatCount[$key] > 0) {
+			$objPage->arrClass[$key] = $arrClass[$key];
+		}
+	}
+}
+
+function lfSetDefaultClassCat($objQuery, $product_id, $max) {
+	global $objPage;
+	
+	// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤ÎÆÉ¹þ
+	$col = "product_code, price01, price02, stock, stock_unlimited";
+	$arrRet = $objQuery->select($col, "dtb_products_class", "product_id = ? AND classcategory_id1 = 0 AND classcategory_id2 = 0", array($product_id));;
+	
+	if(count($arrRet) > 0) {
+		$no = 1;
+		for($cnt = 0; $cnt < $max; $cnt++) {
+			$objPage->arrForm["product_code:".$no] = $arrRet[0]['product_code'];
+			$objPage->arrForm['stock:'.$no] = $arrRet[0]['stock'];
+			$objPage->arrForm['price01:'.$no] = $arrRet[0]['price01'];
+			$objPage->arrForm['price02:'.$no] = $arrRet[0]['price02'];
+			$objPage->arrForm['stock_unlimited:'.$no] = $arrRet[0]['stock_unlimited'];
+			$no++;
+		}
+	}
+}
+
+/* µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ */
+function lfGetClassCatListDisp($class_id1, $class_id2, $default = true) {
+	global $objPage;
+	$objQuery = new SC_Query();
+		
+	if($class_id2 != "") {
+		// µ¬³Ê1¤Èµ¬³Ê2
+		$sql = "SELECT * ";
+		$sql.= "FROM vw_cross_class ";
+		$sql.= "WHERE class_id1 = ? AND class_id2 = ? ORDER BY rank1 DESC, rank2 DESC;";
+		$arrRet = $objQuery->getall($sql, array($class_id1, $class_id2));
+	} else {
+		// µ¬³Ê1¤Î¤ß
+		$sql = "SELECT * ";
+		$sql.= "FROM vw_cross_class ";
+		$sql.= "WHERE class_id1 = ? AND class_id2 = 0 ORDER BY rank1 DESC;";
+		$arrRet = $objQuery->getall($sql, array($class_id1));
+		
+	}
+	
+	$max = count($arrRet);
+	
+	if($default) {
+		// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤òÀßÄê
+		lfSetDefaultClassCat($objQuery, $_POST['product_id'], $max);
+	}
+	
+	$objPage->arrForm["class_id1"] = $arrRet[0]['class_id1'];
+	$objPage->arrForm["class_id2"] = $arrRet[0]['class_id2'];
+	$objPage->tpl_onload.= "fnCheckAllStockLimit('$max', '" . DISABLED_RGB . "');";
+	
+	return $arrRet;
+}
+
+/* µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ(ÊÔ½¸²èÌÌ) */
+function lfGetClassCatListEdit($product_id) {
+	global $objPage;
+	// ´ûÂ¸ÊÔ½¸¤Î¾ì¹ç
+	$objQuery = new SC_Query();
+	
+	$col = "class_id1, class_id2, name1, name2, rank1, rank2, ";
+	$col.= "product_class_id, product_id, T1_classcategory_id AS classcategory_id1, T2_classcategory_id AS classcategory_id2, ";
+	$col.= "product_code, stock, stock_unlimited, sale_limit, price01, price02, status";
+	
+	$sql = "SELECT $col FROM ";
+	$sql.= "( ";
+	$sql.= "SELECT T1.class_id AS class_id1, T2.class_id AS class_id2, T1.classcategory_id AS T1_classcategory_id, T2.classcategory_id AS T2_classcategory_id, T1.name AS name1, T2.name AS name2, T1.rank AS rank1, T2.rank AS rank2 ";
+	$sql.= "FROM dtb_classcategory AS T1, dtb_classcategory AS T2 ";
+	$sql.= "WHERE T1.class_id || '|' || T2.class_id IN (SELECT class_id1 || '|' || class_id2 FROM vw_cross_products_class WHERE product_id = ? GROUP BY class_id1, class_id2) ";
+	$sql.= ") AS T1 ";
+			
+	$sql.= "LEFT JOIN (SELECT * FROM dtb_products_class WHERE product_id = ?) AS T3 ";
+	$sql.= "ON T1_classcategory_id = T3.classcategory_id1 AND T2_classcategory_id = T3.classcategory_id2 ";
+	$sql.= "ORDER BY rank1 DESC, rank2 DESC";
+	
+	$arrList =  $objQuery->getAll($sql, array($product_id, $product_id));
+	
+	$objPage->arrForm["class_id1"] = $arrList[0]['class_id1'];
+	$objPage->arrForm["class_id2"] = $arrList[0]['class_id2'];
+	
+	$max = count($arrList);
+	
+	// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤òÀßÄê
+	lfSetDefaultClassCat($objQuery, $product_id, $max);
+	
+	$no = 1;
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		$objPage->arrForm["classcategory_id1:".$no] = $arrList[$cnt]['classcategory_id1'];
+		$objPage->arrForm["classcategory_id2:".$no] = $arrList[$cnt]['classcategory_id2'];
+		if($arrList[$cnt]['product_id'] != "") {
+			$objPage->arrForm["product_code:".$no] = $arrList[$cnt]['product_code'];
+			$objPage->arrForm['stock:'.$no] = $arrList[$cnt]['stock'];
+			$objPage->arrForm['stock_unlimited:'.$no] = $arrList[$cnt]['stock_unlimited'];
+			$objPage->arrForm['price01:'.$no] = $arrList[$cnt]['price01'];
+			$objPage->arrForm['price02:'.$no] = $arrList[$cnt]['price02'];
+			// JavaScript½é´ü²½ÍÑÊ¸»úÎó
+			$line.= "'check:".$no."',";			
+		}
+		$no++;
+	}
+		
+	$line = ereg_replace(",$", "", $line);
+	$objPage->tpl_javascript = "list = new Array($line);";
+	$color = DISABLED_RGB;
+	$objPage->tpl_onload.= "fnListCheck(list); fnCheckAllStockLimit('$max', '$color');";
+
+	return $arrList;
+}
+
+/* µ¬³Ê¤ÎÅÐÏ¿ */
+function lfInsertProductClass($arrList, $product_id) {
+	$objQuery = new SC_Query();
+	
+	$objQuery->begin();
+		
+	// ´ûÂ¸µ¬³Ê¤Îºï½ü
+	$where = "product_id = ?";
+	$objQuery->delete("dtb_products_class", $where, array($product_id));
+	
+	$cnt = 1;
+	// ¤¹¤Ù¤Æ¤Îµ¬³Ê¤òÅÐÏ¿¤¹¤ë¡£
+	while($arrList["classcategory_id1:".$cnt] != "") {
+		if($arrList["check:".$cnt] == 1) {
+			$sqlval['product_id'] = $product_id;
+			$sqlval['classcategory_id1'] = $arrList["classcategory_id1:".$cnt];
+			$sqlval['classcategory_id2'] = $arrList["classcategory_id2:".$cnt];
+			$sqlval['product_code'] = $arrList["product_code:".$cnt];
+			$sqlval['stock'] = $arrList["stock:".$cnt];
+			$sqlval['stock_unlimited'] = $arrList["stock_unlimited:".$cnt];
+			$sqlval['price01'] = $arrList['price01:'.$cnt];
+			$sqlval['price02'] = $arrList['price02:'.$cnt];
+			$sqlval['creator_id'] = $_SESSION['member_id'];
+			// INSERT¤Î¼Â¹Ô
+			$objQuery->insert("dtb_products_class", $sqlval);
+		}
+		$cnt++;
+	}
+	
+	$objQuery->commit();
+}
+
+// µ¬³ÊÁªÂò¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfClassError() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("µ¬³Ê1", "select_class_id1"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("µ¬³Ê", "select_class_id1", "select_class_id2"), array("TOP_EXIST_CHECK"));
+	$objErr->doFunc(array("µ¬³Ê1", "µ¬³Ê2", "select_class_id1", "select_class_id2"), array("DIFFERENT_CHECK"));
+	return $objErr->arrErr;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+
+	$no = 1;
+	while($array["classcategory_id1:".$no] != "") {
+		$arrConvList["product_code:".$no] = "KVa";
+		$arrConvList["price01:".$no] = "n";
+		$arrConvList["price02:".$no] = "n";
+		$arrConvList["stock:".$no] = "n";
+		$no++;
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ¾¦ÉÊµ¬³Ê¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfProductClassError($array) {
+	$objErr = new SC_CheckError($array);
+	$no = 1;
+		
+	while($array["classcategory_id1:".$no] != "") {
+		if($array["check:".$no] == 1) {
+			$objErr->doFunc(array("¾¦ÉÊ¥³¡¼¥É", "product_code:".$no, STEXT_LEN), array("MAX_LENGTH_CHECK"));
+			$objErr->doFunc(array("»²¹Í»Ô¾ì²Á³Ê", "price01:".$no, PRICE_LEN), array("ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+			$objErr->doFunc(array("²Á³Ê", "price02:".$no, PRICE_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+
+			if($array["stock_unlimited:".$no] != '1') {
+				$objErr->doFunc(array("ºß¸Ë¿ô", "stock:".$no, AMOUNT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+			}
+		}
+		if(count($objErr->arrErr) > 0) {
+			$objErr->arrErr["error:".$no] = $objErr->arrErr["product_code:".$no];
+			$objErr->arrErr["error:".$no].= $objErr->arrErr["price01:".$no];
+			$objErr->arrErr["error:".$no].= $objErr->arrErr["price02:".$no];
+			$objErr->arrErr["error:".$no].= $objErr->arrErr["stock:".$no];
+		}
+		$no++;
+	}
+	return $objErr->arrErr;
+}
+
+/* ³ÎÇ§¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductConfirmPage() {
+	global $objPage;
+	$objPage->arrForm['mode'] = 'complete';
+	$objPage->arrClass = sfGetIDValueList("dtb_class", 'class_id', 'name');
+	$cnt = 0;
+	$check = 0;
+	$no = 1;
+	while($_POST["classcategory_id1:".$no] != "") {
+		if($_POST["check:".$no] != "") {
+			$check++;
+		}
+		$no++;
+		$cnt++;
+	}
+	$objPage->tpl_check = $check;
+	$objPage->tpl_count = $cnt;
+}
+?>
Index: /temp/trunk/html/admin/products/review_edit.php
===================================================================
--- /temp/trunk/html/admin/products/review_edit.php	(revision 1328)
+++ /temp/trunk/html/admin/products/review_edit.php	(revision 1328)
@@ -0,0 +1,153 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/review_edit.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'review';
+		global $arrRECOMMEND;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		$this->tpl_subtitle = '¥ì¥Ó¥å¡¼´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+//¸¡º÷¥ï¡¼¥É¤Î°ú·Ñ¤®
+foreach ($_POST as $key => $val){
+	if (ereg("^search_", $key)){
+	$objPage->arrSearchHidden[$key] = $val;
+	}
+}
+
+//¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ÍÑ¥«¥é¥à
+$arrRegistColumn = array (		
+								array( "column" => "status"),
+								array( "column" => "recommend_level"),		
+								array(	"column" => "title",		"convert" => "KVa"),
+								array(	"column" => "comment",		"convert" => "KVa")	
+							);
+
+//¥ì¥Ó¥å¡¼ID¤òÅÏ¤¹
+$objPage->tpl_review_id = $_POST['review_id'];
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¥«¥é¥à¤Î¼èÆÀ
+$objPage->arrReview = lfGetReviewData($_POST['review_id']);
+//ÅÐÏ¿ºÑ¤ß¤Î¥¹¥Æ¡¼¥¿¥¹¤òÅÏ¤¹
+$objPage->tpl_pre_status = $objPage->arrReview['status'];
+//¾¦ÉÊ¤´¤È¤Î¥ì¥Ó¥å¡¼É½¼¨¿ô¼èÆÀ
+$count = $objQuery->count("dtb_review", "delete=0 AND status=1 AND product_id=?", array($objPage->arrReview['product_id']));
+//¥ì¥Ó¥å¡¼É½¼¨¿ô¤¬ÀßÄêÃÍ°Ê¾å¤Î¾ì¹ç
+if ($count >= REVIEW_REGIST_MAX){
+	//É½¼¨¤ÏÁªÂò¤Ç¤­¤Ê¤¤
+	$objPage->tpl_status_change = false;
+}else{
+	//Î¾ÊýÁªÂò²ÄÇ½
+	$objPage->tpl_status_change = true;
+}
+					
+switch($_POST['mode']) {
+//ÅÐÏ¿
+case 'complete':
+	//¥Õ¥©¡¼¥àÃÍ¤ÎÊÑ´¹
+	$arrReview = lfConvertParam($_POST, $arrRegistColumn);
+	$objPage->arrErr = lfCheckError($arrReview);
+	//ÈóÉ½¼¨¤«¤éÉ½¼¨¤Ë¥¹¥Æ¡¼¥¿¥¹¤òÀÚ¤êÂØ¤¨¤Æ¡¢¾¦ÉÊ¤´¤È¤ÎÉ½¼¨¥ì¥Ó¥å¡¼¿ô¤¬ÀßÄêÃÍ¤òÄ¶¤¨¤Æ¤¤¤ë¤È¤­
+	if ($arrReview['pre_status'] == '2' && $arrReview['status'] == '1' && $count >= REVIEW_REGIST_MAX){
+		$objPage->arrErr['status'] = '¢¨ ¥ì¥Ó¥å¡¼É½¼¨¿ô¤Ï5·ï¤Þ¤Ç¤Ç¤¹¡£';
+		$objPage->arrReview = $arrReview;
+	} else {
+		//¥¨¥é¡¼Ìµ¤·
+		if (!$objPage->arrErr){
+			//¥ì¥Ó¥å¡¼¾ðÊó¤ÎÊÔ½¸ÅÐÏ¿
+			lfRegistReviewData($arrReview, $arrRegistColumn);
+			$objPage->arrReview = $arrReview;
+			$objPage->tpl_onload = "confirm('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//------------------------------------------------------------------------------------------------------------------------------------
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError($array) {
+	$objErr = new SC_CheckError($array);
+		$objErr->doFunc(array("¤ª¤¹¤¹¤á¥ì¥Ù¥ë", "recommend_level"), array("SELECT_CHECK"));
+		$objErr->doFunc(array("¥¿¥¤¥È¥ë", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	return $objErr->arrErr;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¼èÆÀ
+function lfGetReviewData($review_id){
+	global $objPage;
+	global $objQuery;
+	$select="review_id, A.product_id, reviewer_name, sex, recommend_level, ";
+	$select.="reviewer_url, title, comment, A.status, A.create_date, A.update_date, name";
+	$from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
+	$where = "A.delete = 0 AND B.delete = 0 AND review_id = ? ";
+	$arrReview = $objQuery->select($select, $from, $where, array($review_id));
+	if(!empty($arrReview)) {
+		$objPage->arrReview = $arrReview[0];
+	} else {
+		sfDispError("");
+	}
+	return $objPage->arrReview;
+}
+
+//¥ì¥Ó¥å¡¼¾ðÊó¤ÎÊÔ½¸ÅÐÏ¿
+function lfRegistReviewData($array, $arrRegistColumn){
+	global $objQuery;
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0 ) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+		if ($data['column'] == 'update_date'){
+			$arrRegist['update_date'] = 'now()';
+		}
+	}
+	//ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->update("dtb_review", $arrRegist, "review_id='".$_POST['review_id']."'");
+	$objQuery->commit();
+}
+?>
Index: /temp/trunk/html/admin/products/index.php
===================================================================
--- /temp/trunk/html/admin/products/index.php	(revision 1328)
+++ /temp/trunk/html/admin/products/index.php	(revision 1328)
@@ -0,0 +1,325 @@
+<?php
+
+require_once("../require.php");
+require_once("./index_csv.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+	var $arrProducts;
+	var $arrPageMax;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/index.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¾¦ÉÊ¥Þ¥¹¥¿';
+		
+		global $arrPageMax;
+		$this->arrPageMax = $arrPageMax;
+		global $arrDISP;
+		$this->arrDISP = $arrDISP;
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrPRODUCTSTATUS_COLOR;
+		$this->arrPRODUCTSTATUS_COLOR = $arrPRODUCTSTATUS_COLOR;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷³«»ÏÇ¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrStartYear = $objDate->getYear();
+$objPage->arrStartMonth = $objDate->getMonth();
+$objPage->arrStartDay = $objDate->getDay();
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷½ªÎ»Ç¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrEndYear = $objDate->getYear();
+$objPage->arrEndMonth = $objDate->getMonth();
+$objPage->arrEndDay = $objDate->getDay();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+//¥­¥ã¥ó¥Ú¡¼¥ó¤ÎÊÔ½¸»þ
+if(sfIsInt($_POST['campaign_id']) && $_POST['mode'] == "camp_search") {
+	$objQuery = new SC_Query();
+	$search_data = $objQuery->get("dtb_campaign", "search_condition", "campaign_id = ? ", array($_POST['campaign_id']));
+	$arrSearch = unserialize($search_data);
+	foreach ($arrSearch as $key => $val) {
+		$_POST[$key] = $val;
+	}
+}
+
+// POSTÃÍ¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key) || ereg("^campaign_", $key)) {
+		switch($key) {
+			case 'search_product_flag':
+			case 'search_status':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				if(!is_array($val)) {
+					$objPage->arrForm[$key] = split("-", $val);
+				}
+				break;
+			default:
+				$objPage->arrHidden[$key] = $val;
+				break;
+		}
+	}
+}
+
+// ¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
+
+// ¾¦ÉÊºï½ü
+if ($_POST['mode'] == "delete") {
+	if($_POST['category_id'] != "") {
+		// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+		$where = "category_id = " . addslashes($_POST['category_id']);
+		sfDeleteRankRecord("dtb_products", "product_id", $_POST['product_id'], $where);
+	} else {
+		sfDeleteRankRecord("dtb_products", "product_id", $_POST['product_id']);
+	}
+	// »Ò¥Æ¡¼¥Ö¥ë(¾¦ÉÊµ¬³Ê)¤Îºï½ü
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_products_class", "product_id = ?", array($_POST['product_id']));
+	
+	// ·ï¿ô¥«¥¦¥ó¥È¥Ð¥Ã¥Á¼Â¹Ô
+	sfCategory_Count($objQuery);	
+}
+
+if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "camp_search") {
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+
+	$where = "delete = 0";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	if (count($objPage->arrErr) == 0) {
+			foreach ($objPage->arrForm as $key => $val) {
+				
+			$val = sfManualEscape($val);
+			
+			if($val == "") {
+				continue;
+			}
+			
+			switch ($key) {
+				case 'search_product_id':
+					$where .= " AND product_id = ?";
+					$arrval[] = $val;
+					break;
+				case 'search_product_class_id':
+					$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
+					$arrval[] = $val;
+					break;
+				case 'search_name':
+					$where .= " AND name ILIKE ?";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_category_id':
+					list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
+					if($tmp_where != "") {
+						$where.= " AND $tmp_where";
+						$arrval = array_merge($arrval, $tmp_arrval);
+					}
+					break;
+				case 'search_product_code':
+					$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_startyear':
+					$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+					$where.= " AND update_date >= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_endyear':
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
+					$where.= " AND update_date <= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_product_flag':
+					global $arrSTATUS;
+					$search_product_flag = sfSearchCheckBoxes($val);
+					if($search_product_flag != "") {
+						$where.= " AND product_flag LIKE ?";
+						$arrval[] = $search_product_flag;					
+					}
+					break;
+				case 'search_status':
+					$tmp_where = "";
+					foreach ($val as $element){
+						if ($element != ""){
+							if ($tmp_where == ""){
+								$tmp_where.="AND (status LIKE ? ";
+							}else{
+								$tmp_where.="OR status LIKE ? ";
+							}
+							$arrval[]=$element;
+						}
+					}
+					if ($tmp_where != ""){
+						$tmp_where.=")";
+						$where.= "$tmp_where";
+					}
+					break;
+				default:
+					break;
+			}
+		}
+
+		$order = "update_date DESC";
+		$objQuery = new SC_Query();
+
+		switch($_POST['mode']) {
+		case 'csv':
+			// ¥ª¥×¥·¥ç¥ó¤Î»ØÄê
+			$option = "ORDER BY $order";
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤ÎºîÀ®
+			$arrOutput = sfSwapArray(sfgetCsvOutput(1, " WHERE csv_id = 1 AND status = 1"));
+			
+			if (count($arrOutput) <= 0) break;
+			
+			$arrOutputCols = $arrOutput['col'];
+			$arrOutputTitle = $arrOutput['disp_name'];
+			
+			$head = sfGetCSVList($arrOutputTitle);
+			
+			$data = lfGetProductsCSV($where, $option, $arrval, $arrOutputCols);
+
+			// CSV¤òÁ÷¿®¤¹¤ë¡£
+			sfCSVDownload($head.$data);
+			exit;
+			break;
+		case 'delete_all':
+			// ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
+			$where = "product_id IN (SELECT product_id FROM vw_products_nonclass WHERE $where)";
+			$sqlval['delete'] = 1;
+			$objQuery->update("dtb_products", $sqlval, $where, $arrval);
+			break;
+		default:
+			// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+			$col = "product_id, name, category_id, main_list_image, status, product_code, price01, price02, stock, stock_unlimited";
+			$from = "vw_products_nonclass";
+
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objQuery->count($from, $where, $arrval);
+			$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+			if(is_numeric($_POST['search_page_max'])) {	
+				$page_max = $_POST['search_page_max'];
+			} else {
+				$page_max = SEARCH_PMAX;
+			}
+
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+			$startno = $objNavi->start_row;
+			$objPage->arrPagenavi = $objNavi->arrPagenavi;
+			
+			//¥­¥ã¥ó¥Ú¡¼¥ó¾¦ÉÊ¸¡º÷»þ¤Ï¡¢Á´·ë²Ì¤Î¾¦ÉÊID¤òÊÑ¿ô¤Ë³ÊÇ¼¤¹¤ë
+			if($_POST['search_mode'] == 'campaign') {
+				$arrRet = $objQuery->select($col, $from, $where, $arrval);
+				if(count($arrRet) > 0) {
+					$arrRet = sfSwapArray($arrRet);
+					$pid = implode("-", $arrRet['product_id']);
+					$objPage->arrHidden['campaign_product_id'] = $pid;
+				}
+			}
+
+			// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+			$objQuery->setlimitoffset($page_max, $startno);
+			// É½¼¨½ç½ø
+			$objQuery->setorder($order);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+
+			break;
+		}
+	}
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÆÉ¹þ
+$objPage->arrCatList = sfGetCategoryList();
+$objPage->arrCatIDName = lfGetIDName($objPage->arrCatList);
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+/* ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+	return $objErr->arrErr;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹ÍÑWHEREÊ¸ºîÀ®
+function lfGetCBWhere($key, $max) {
+	$str = "";
+	$find = false;
+	for ($cnt = 1; $cnt <= $max; $cnt++) {
+		if ($_POST[$key . $cnt] == "1") {
+			$str.= "1";
+			$find = true;
+		} else {
+			$str.= "_";
+		}
+	}
+	if (!$find) {
+		$str = "";
+	}
+	return $str;
+}
+
+// ¥«¥Æ¥´¥êID¤ò¥­¡¼¡¢¥«¥Æ¥´¥êÌ¾¤òÃÍ¤Ë¤¹¤ëÇÛÎó¤òÊÖ¤¹¡£
+function lfGetIDName($arrCatList) {
+	$max = count($arrCatList);
+	for ($cnt = 0; $cnt < $max; $cnt++ ) {
+		$key = $arrCatList[$cnt]['category_id'];
+		$val = $arrCatList[$cnt]['category_name'];
+		$arrRet[$key] = $val;	
+	}
+	return $arrRet;
+}
Index: /temp/trunk/html/admin/products/bak_upload_csv.php
===================================================================
--- /temp/trunk/html/admin/products/bak_upload_csv.php	(revision 1328)
+++ /temp/trunk/html/admin/products/bak_upload_csv.php	(revision 1328)
@@ -0,0 +1,231 @@
+<?php
+
+require_once("../require.php");
+
+// 1¹Ô¤¢¤¿¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("CSV_LINE_MAX", 10000);
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/upload_csv.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_csv';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objPage->arrTitle = $objFormParam->getTitleArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, CSV_LINE_MAX);
+						
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+			
+			if($line <= 1) {
+				continue;
+			}			
+							
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				// ÃÍ¤ò¥Õ¥©¡¼¥Þ¥Ã¥ÈÊÑ´¹¤·¤Æ³ÊÇ¼¤¹¤ë¡£
+				$arrRet = lfConvFormat($arrRet);
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				lfInsertProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥Æ¥´¥êID", "category_id", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price01", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ÆÃÊÌ²Á³Ê", "price02", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(1)", "sub_title1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(1)", "sub_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(2)", "sub_title2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(2)", "sub_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(3)", "sub_title3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(3)", "sub_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(4)", "sub_title4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(4)", "sub_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(5)", "sub_title5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(5)", "sub_comment5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(6)", "sub_title6", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(6)", "sub_comment6", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+
+/* ÆÃ¼ì¹àÌÜ¤ÎÊÑ´¹ */
+function lfConvFormat($array) {
+	global $arrDISP;
+	foreach($array as $key => $val) {
+		switch($key) {
+		case 'status':
+			$arrRet[$key] = sfSearchKey($arrDISP, $val, 1);
+			break;
+		default:
+			$arrRet[$key] = $val;
+			break;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¾¦ÉÊ¤Î¿·µ¬ÄÉ²Ã */
+function lfInsertProduct($objQuery) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	
+	// µ¬³Ê¤ËÅÐÏ¿¤µ¤ì¤ëÃÍ¤ò½ü³°¤¹¤ë¡£
+	foreach($arrRet as $key => $val) {
+		switch($key) {
+		case 'product_code':
+		case 'price01':
+		case 'price02':
+		case 'point_rate':
+		case 'stock':
+			break;
+		default:
+			$sqlval[$key] = $val;
+			break;
+		}
+	}
+	
+	$product_id = $objQuery->nextval("dtb_products", "product_id");
+	$sqlval['product_id'] = $product_id;
+	$sqlval['status'] = 2;	// ÈóÉ½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "delete = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_products", $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError(false);
+	
+	if(!isset($objErr->arrErr['category_id'])) {
+		$objQuery = new SC_Query();
+		$col = "level";
+		$table = "dtb_category";
+		$where = "category_id = ?";
+		$level = $objQuery->get($table, $col, $where, array($arrRet['category_id']));
+		if($level != LEVEL_MAX) {
+			$objErr->arrErr['category_id'] = "¢¨ ¤³¤Î¥«¥Æ¥´¥êID¤Ë¤Ï¾¦ÉÊ¤òÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/trunk/html/admin/products/upload_rakuten.php
===================================================================
--- /temp/trunk/html/admin/products/upload_rakuten.php	(revision 1328)
+++ /temp/trunk/html/admin/products/upload_rakuten.php	(revision 1328)
@@ -0,0 +1,162 @@
+<?php
+require_once("../require.php");
+require_once("./upload_csv.inc");
+
+// 1¹Ô¤¢¤¿¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("CSV_LINE_MAX", 10000);
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/upload_csv.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_rakuten';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objFormParam->setHtmlDispNameArray();
+$objPage->arrTitle = $objFormParam->getHtmlDispNameArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, CSV_LINE_MAX);
+						
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+			
+			if($line <= 1) {
+				continue;
+			}			
+							
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				lfRegistProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+			// ¾¦ÉÊ·ï¿ô¥«¥¦¥ó¥È´Ø¿ô¤Î¼Â¹Ô
+			sfCategory_Count($objQuery);
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¥Õ¥é¥°(ÂÐ±þ¤Ê¤·)", "dummy1");
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥â¥Ð¥¤¥ëÍÑ¾¦ÉÊÌ¾(ÂÐ±þ¤Ê¤·)", "dummy2");
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊID(ÂÐ±þ¤Ê¤·)", "dummy3");
+	$objFormParam->addParam("¾¦ÉÊ¥Ú¡¼¥¸ID(ÂÐ±þ¤Ê¤·)", "dummy1");
+	$objFormParam->addParam("¼ÂÇä²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("É½¼¨²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÃÈñÀÇ¥Õ¥é¥°(ÂÐ±þ¤Ê¤·)", "dummy4");
+	$objFormParam->addParam("Á÷ÎÁ(ÂÐ±þ¤Ê¤·)", "dummy5");
+	$objFormParam->addParam("¸ÄÊÌÁ÷ÎÁ(ÂÐ±þ¤Ê¤·)", "dummy6");
+	$objFormParam->addParam("ÃíÊ¸¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy7");
+	$objFormParam->addParam("»ñÎÁÀÁµá¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy8");
+	$objFormParam->addParam("Ìä¤¤¹ç¤ï¤»¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy9");
+	$objFormParam->addParam("¤ª´«¤á¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy10");
+	$objFormParam->addParam("¤Î¤·ÂÐ±þ¥Õ¥é¥°(ÂÐ±þ¤Ê¤·)", "dummy11");
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹àÌÜÁªÂò»è(ÂÐ±þ¤Ê¤·)", "dummy12");
+	$objFormParam->addParam("´ü´Ö¸ÂÄêÈÎÇä(ÂÐ±þ¤Ê¤·)", "dummy13");
+	$objFormParam->addParam("ÀâÌÀÊ¸", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥â¥Ð¥¤¥ëÀâÌÀÊ¸(ÂÐ±þ¤Ê¤·)", "dummy14");
+	$objFormParam->addParam("²èÁü(ÂÐ±þ¤Ê¤·)", "dummy15");
+	$objFormParam->addParam("³ÚÅ·¥Ç¥£¥ì¥¯¥È¥êID(ÂÐ±þ¤Ê¤·)", "dummy16");
+	$objFormParam->addParam("¥â¥Ð¥¤¥ë(ÂÐ±þ¤Ê¤·)", "dummy17");
+}
+?>
Index: /temp/trunk/html/admin/products/category.php
===================================================================
--- /temp/trunk/html/admin/products/category.php	(revision 1328)
+++ /temp/trunk/html/admin/products/category.php	(revision 1328)
@@ -0,0 +1,302 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/category.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'category';
+		$this->tpl_onload = " fnSetFocus('category_name'); ";
+		$this->tpl_subtitle = '¥«¥Æ¥´¥ê¡¼ÅÐÏ¿';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ÄÌ¾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄê¤¹¤ë¡£
+$objPage->arrForm['parent_category_id'] = $_POST['parent_category_id'];
+
+switch($_POST['mode']) {
+case 'edit':
+	$objFormParam->convParam();
+	$arrRet =  $objFormParam->getHashArray();
+	$objPage->arrErr = lfCheckError($arrRet);
+	
+	if(count($objPage->arrErr) == 0) {
+		if($_POST['category_id'] == "") {
+			$objQuery = new SC_Query();
+			$count = $objQuery->count("dtb_category");
+			if($count < CATEGORY_MAX) {			
+				lfInsertCat($_POST['parent_category_id']);
+			} else {
+				print("¥«¥Æ¥´¥ê¤ÎÅÐÏ¿ºÇÂç¿ô¤òÄ¶¤¨¤Þ¤·¤¿¡£");
+			}
+		} else {
+			lfUpdateCat($_POST['category_id']);
+		}
+	} else {
+		$objPage->arrForm = array_merge($objPage->arrForm, $objFormParam->getHashArray());
+		$objPage->arrForm['category_id'] = $_POST['category_id'];
+	}
+	break;
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤Î¥«¥Æ¥´¥êÌ¾¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$oquery = new SC_Query();
+	$where = "category_id = ?";
+	$cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['category_name'] = $cat_name;
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->arrForm['category_id'] = $_POST['category_id'];
+	break;
+case 'delete':
+	$objQuery = new SC_Query();
+	// »Ò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯
+	$where = "parent_category_id = ? AND delete = 0";
+	$count = $objQuery->count("dtb_category", $where, array($_POST['category_id']));
+	if($count != 0) {
+		$objPage->arrErr['category_name'] = "¢¨ »Ò¥«¥Æ¥´¥ê¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>";
+	}
+	// ÅÐÏ¿¾¦ÉÊ¤Î¥Á¥§¥Ã¥¯
+	$where = "category_id = ? AND delete = 0";
+	$count = $objQuery->count("dtb_products", $where, array($_POST['category_id']));
+	if($count != 0) {
+		$objPage->arrErr['category_name'] = "¢¨ ¥«¥Æ¥´¥êÆâ¤Ë¾¦ÉÊ¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>";
+	}	
+	
+	if(!isset($objPage->arrErr['category_name'])) {
+		// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü(¢¨½èÍýÉé²Ù¤ò¹ÍÎ¸¤·¤Æ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¡£)
+		sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true);
+	}
+	break;
+case 'up':
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$up_id = lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+	if($up_id != "") {
+		// ¾å¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô
+		$my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+		// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô
+		$up_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id);
+		if($my_count > 0 && $up_count > 0) {
+			// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Ë²Ã»»
+			lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count);
+			// ¾å¤Î¥°¥ë¡¼¥×¤«¤é¸º»»
+			lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count);
+		}
+	}
+	$objQuery->commit();
+	break;
+case 'down':
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$down_id = lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+	if($down_id != "") {
+		// ²¼¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô
+		$my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+		// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô
+		$down_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id);
+		if($my_count > 0 && $down_count > 0) {
+			// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤«¤é¸º»»
+			lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count);
+			// ²¼¤Î¥°¥ë¡¼¥×¤Ë²Ã»»
+			lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count);
+		}
+	}
+	$objQuery->commit();
+	break;
+case 'tree':
+	break;
+default:
+	$objPage->arrForm['parent_category_id'] = 0;
+	break;
+}
+
+$objPage->arrList = lfGetCat($objPage->arrForm['parent_category_id']);
+$objPage->arrTree = sfGetCatTree($objPage->arrForm['parent_category_id']);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+// ¥«¥Æ¥´¥ê¤Î¿·µ¬ÄÉ²Ã
+function lfInsertCat($parent_category_id) {
+	global $objFormParam;
+	
+	$objQuery = new SC_Query();
+	$objQuery->begin();	// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î³«»Ï
+	
+	
+	if($parent_category_id == 0) {
+		// ROOT³¬ÁØ¤ÇºÇÂç¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£		
+		$where = "parent_category_id = ?";
+		$rank = $objQuery->max("dtb_category", "rank", $where, array($parent_category_id)) + 1;
+	} else {
+		// ¿Æ¤Î¥é¥ó¥¯¤ò¼«Ê¬¤Î¥é¥ó¥¯¤È¤¹¤ë¡£
+		$where = "category_id = ?";
+		$rank = $objQuery->get("dtb_category", "rank", $where, array($parent_category_id));
+		// ÄÉ²Ã¥ì¥³¡¼¥É¤Î¥é¥ó¥¯°Ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤¢¤²¤ë¡£
+		$sqlup = "UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?";
+		$objQuery->exec($sqlup, array($rank));
+	}
+	
+	$where = "category_id = ?";
+	// ¼«Ê¬¤Î¥ì¥Ù¥ë¤ò¼èÆÀ¤¹¤ë(¿Æ¤Î¥ì¥Ù¥ë + 1)	
+	$level = $objQuery->get("dtb_category", "level", $where, array($parent_category_id)) + 1;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['parent_category_id'] = $parent_category_id;
+	$sqlval['rank'] = $rank;
+	$sqlval['level'] = $level;
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_category", $sqlval);
+	
+	$objQuery->commit();	// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î½ªÎ»
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÊÔ½¸
+function lfUpdateCat($category_id) {
+	global $objFormParam;
+	$objQuery = new SC_Query();
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = "Now()";
+	$where = "category_id = ?";
+	$objQuery->update("dtb_category", $sqlval, $where, array($category_id));
+}
+
+// ¥«¥Æ¥´¥ê¤Î¼èÆÀ
+function lfGetCat($parent_category_id) {
+	$objQuery = new SC_Query();
+	$col = "category_id, category_name, level, rank";
+	$where = "delete = 0 AND parent_category_id = ?";
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, "dtb_category", $where, array($parent_category_id));
+	return $arrRet;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥«¥Æ¥´¥êÌ¾", "category_name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError($array) {
+	global $objFormParam;
+	$objErr = new SC_CheckError($array);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ³¬ÁØ¥Á¥§¥Ã¥¯
+	if(!isset($objErr->arrErr['category_name'])) {
+		$objQuery = new SC_Query();
+		$level = $objQuery->get("dtb_category", "level", "category_id = ?", array($_POST['parent_category_id']));
+		
+		if($level >= LEVEL_MAX) {
+			$objErr->arrErr['category_name'] = "¢¨ ".LEVEL_MAX."³¬ÁØ°Ê¾å¤ÎÅÐÏ¿¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+		
+	// ½ÅÊ£¥Á¥§¥Ã¥¯
+	if(!isset($objErr->arrErr['category_name'])) {
+		$objQuery = new SC_Query();
+		$where = "parent_category_id = ? AND category_name = ?";
+		$arrRet = $objQuery->select("category_id, category_name", "dtb_category", $where, array($_POST['parent_category_id'], $array['category_name']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç
+		if ($arrRet[0]['category_id'] != $_POST['category_id'] && $arrRet[0]['category_name'] == $_POST['category_name']) {
+			$objErr->arrErr['category_name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+
+	return $objErr->arrErr;
+}
+
+
+// ÊÂ¤Ó¤¬1¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetDownRankID($objQuery, $table, $pid_name, $id_name, $id) {
+	// ¿ÆID¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$pid_name";
+	$where = "$id_name = ?";
+	$pid = $objQuery->get($table, $col, $where, $id);
+	// ¤¹¤Ù¤Æ¤Î»Ò¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$id_name";
+	$where = "delete = 0 AND $pid_name = ? ORDER BY rank DESC";
+	$arrRet = $objQuery->select($col, $table, $where, array($pid));
+	$max = count($arrRet);
+	$down_id = "";
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($arrRet[$cnt][$id_name] == $id) {
+			$down_id = $arrRet[($cnt + 1)][$id_name];
+			break;
+		}
+	}
+	return $down_id;
+}
+
+// ÊÂ¤Ó¤¬1¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetUpRankID($objQuery, $table, $pid_name, $id_name, $id) {
+	// ¿ÆID¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$pid_name";
+	$where = "$id_name = ?";
+	$pid = $objQuery->get($table, $col, $where, $id);
+	// ¤¹¤Ù¤Æ¤Î»Ò¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$id_name";
+	$where = "delete = 0 AND $pid_name = ? ORDER BY rank DESC";
+	$arrRet = $objQuery->select($col, $table, $where, array($pid));
+	$max = count($arrRet);
+	$up_id = "";
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($arrRet[$cnt][$id_name] == $id) {
+			$up_id = $arrRet[($cnt - 1)][$id_name];
+			break;
+		}
+	}
+	return $up_id;
+}
+
+function lfCountChilds($objQuery, $table, $pid_name, $id_name, $id) {
+	// »ÒID°ìÍ÷¤ò¼èÆÀ
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);	
+	return count($arrRet);
+}
+
+function lfUpRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) {
+	// »ÒID°ìÍ÷¤ò¼èÆÀ
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);	
+	$line = sfGetCommaList($arrRet);
+	$sql = "UPDATE $table SET rank = (rank + $count) WHERE $id_name IN ($line) ";
+	$sql.= "AND delete = 0";
+	$ret = $objQuery->exec($sql);
+	return $ret;
+}
+
+function lfDownRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) {
+	// »ÒID°ìÍ÷¤ò¼èÆÀ
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);	
+	$line = sfGetCommaList($arrRet);
+	$sql = "UPDATE $table SET rank = (rank - $count) WHERE $id_name IN ($line) ";
+	$sql.= "AND delete = 0";
+	$ret = $objQuery->exec($sql);
+	return $ret;
+}
+?>
Index: /temp/trunk/html/admin/products/regist_review.php
===================================================================
--- /temp/trunk/html/admin/products/regist_review.php	(revision 1328)
+++ /temp/trunk/html/admin/products/regist_review.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'home.tpl';
+		$this->tpl_mainpage = 'products/regist_review.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 3;
+		$this->tpl_subtitle = '¥ì¥Ó¥å¡¼´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+?>
Index: /temp/trunk/html/admin/products/product_select.php
===================================================================
--- /temp/trunk/html/admin/products/product_select.php	(revision 1328)
+++ /temp/trunk/html/admin/products/product_select.php	(revision 1328)
@@ -0,0 +1,146 @@
+<?php
+
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product_select.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subnavi = '';
+		$this->tpl_subno = "";
+		$this->tpl_subtitle = '¾¦ÉÊÁªÂò';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+if ($_POST['mode'] == "search") {
+	
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	
+	$where = "delete = 0";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	foreach ($objPage->arrForm as $key => $val) {
+		if($val == "") {
+			continue;
+		}
+		
+		switch ($key) {
+			case 'search_name':
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+				$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
+				$tmp_where = "";
+				foreach ($arrRet as $val) {
+					if($tmp_where == "") {
+						$tmp_where.= " AND ( category_id = ?";
+					} else {
+						$tmp_where.= " OR category_id = ?";
+					}
+					$arrval[] = $val;
+				}
+				$where.= $tmp_where . " )";
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$where .= " OR product_code ILIKE ?";
+				$arrval[] = "%$val%";
+				$arrval[] = "%$val%";
+				break;
+			default:
+				break;
+		}
+	}
+	
+	$order = "update_date DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+		
+}
+
+// ¥«¥Æ¥´¥ê¼èÆÀ
+$objPage->arrCatList = sfGetCategoryList();
+
+
+
+
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+
+
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+
+?>
Index: /temp/trunk/html/admin/products/product.php
===================================================================
--- /temp/trunk/html/admin/products/product.php	(revision 1328)
+++ /temp/trunk/html/admin/products/product.php	(revision 1328)
@@ -0,0 +1,464 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrCatList;
+	var $arrSRANK;
+	var $arrForm;
+	var $arrSubList;
+	var $arrHidden;
+	var $arrTempImage;
+	var $arrSaveImage;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'product';
+		$this->tpl_subtitle = '¾¦ÉÊÅÐÏ¿';
+		global $arrSRANK;
+		$this->arrSRANK = $arrSRANK;
+		global $arrDISP;
+		$this->arrDISP = $arrDISP;
+		global $arrCLASS;
+		$this->arrCLASS = $arrCLASS;
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrSTATUS_VALUE;
+		$this->arrSTATUS_VALUE = $arrSTATUS_VALUE;
+		global $arrSTATUS_IMAGE;
+		$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
+		global $arrDELIVERYDATE;
+		$this->arrDELIVERYDATE = $arrDELIVERYDATE;
+		$this->tpl_nonclass = true;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSiteInfo = new SC_SiteInfo();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// Hidden¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setHiddenFileList($_POST);
+
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+// FORM¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+switch($_POST['mode']) {
+// ¸¡º÷²èÌÌ¤«¤é¤ÎÊÔ½¸
+case 'pre_edit':
+	// ÊÔ½¸»þ
+	if(sfIsInt($_POST['product_id'])){
+		// DB¤«¤é¾¦ÉÊ¾ðÊó¤ÎÆÉ¹þ
+		$objPage->arrForm = lfGetProduct($_POST['product_id']);
+		// ¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹¤ÎÊÑ´¹
+		$arrRet = sfSplitCBValue($objPage->arrForm['product_flag'], "product_flag");
+		$objPage->arrForm = array_merge($objPage->arrForm, $arrRet);
+		// DB¤«¤é¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß
+		$objPage->arrRecommend = lfPreGetRecommendProducts($_POST['product_id']);
+		// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+		$objUpFile->setDBFileList($objPage->arrForm);
+		// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+		$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+		lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+		
+// ¾¦ÉÊÅÐÏ¿¡¦ÊÔ½¸
+case 'edit':
+	// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+	$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	// ¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge((array)$objPage->arrErr, (array)$objUpFile->checkEXISTS());
+	// ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç
+	if(count($objPage->arrErr) == 0) {
+		lfProductConfirmPage(); // ³ÎÇ§¥Ú¡¼¥¸
+	} else {
+		lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤é´°Î»¥Ú¡¼¥¸¤Ø
+case 'complete':
+	$objPage->tpl_mainpage = 'products/complete.tpl';
+	
+	$objPage->tpl_product_id = lfRegistProduct($_POST);		// ¥Ç¡¼¥¿ÅÐÏ¿
+	
+	$objQuery = new SC_Query();
+	// ·ï¿ô¥«¥¦¥ó¥È¥Ð¥Ã¥Á¼Â¹Ô
+	sfCategory_Count($objQuery);
+	// °ì»þ¥Õ¥¡¥¤¥ë¤òËÜÈÖ¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤¹¤ë
+	$objUpFile->moveTempFile();
+
+	break;
+// ²èÁü¤Î¥¢¥Ã¥×¥í¡¼¥É
+case 'upload_image':
+	// ¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge((array)$objPage->arrErr, (array)$objUpFile->checkEXISTS($_POST['image_key']));
+	// ²èÁüÊÝÂ¸½èÍý
+	$objPage->arrErr[$_POST['image_key']] = $objUpFile->makeTempFile($_POST['image_key']);
+	lfProductPage(); // ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// ²èÁü¤Îºï½ü
+case 'delete_image':
+	$objUpFile->deleteFile($_POST['image_key']);
+	lfProductPage(); // ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤é¤ÎÌá¤ê
+case 'confirm_return':
+	// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+	$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+	lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// ¤ª¤¹¤¹¤á¾¦ÉÊÁªÂò
+case 'recommend_select' :
+	lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+default:
+	// ¸ø³«¡¦Èó¸ø³«¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ
+	$objPage->arrForm['status'] = DEFAULT_PRODUCT_DISP;
+	lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+}
+
+if($_POST['mode'] != 'pre_edit') {
+	// ¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß
+	$objPage->arrRecommend = lfGetRecommendProducts();
+}
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $objSiteInfo->data;
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------
+
+/* ¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */
+function lfGetRecommendProducts() {
+	global $objPage;
+	$objQuery = new SC_Query();
+	
+	for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
+		$keyname = "recommend_id" . $i;
+		$delkey = "recommend_delete" . $i;
+		$commentkey = "recommend_comment" . $i;
+
+		if($_POST[$keyname] != "" && $_POST[$delkey] != 1) {
+			$arrRet = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass", "product_id = ?", array($_POST[$keyname])); 
+			$arrRecommend[$i] = $arrRet[0];
+			$arrRecommend[$i]['product_id'] = $_POST[$keyname];
+			$arrRecommend[$i]['comment'] = $objPage->arrForm[$commentkey];
+		}
+	}
+	return $arrRecommend;
+}
+
+/* ¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÅÐÏ¿ */
+function lfInsertRecommendProducts($objQuery, $arrList, $product_id) {
+	// °ìÃ¶¥ª¥¹¥¹¥á¾¦ÉÊ¤ò¤¹¤Ù¤Æºï½ü¤¹¤ë
+	$objQuery->delete("dtb_recommend_products", "product_id = ?", array($product_id));
+	$sqlval['product_id'] = $product_id;
+	$rank = RECOMMEND_PRODUCT_MAX;
+	for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
+		$keyname = "recommend_id" . $i;
+		$commentkey = "recommend_comment" . $i;
+		$deletekey = "recommend_delete" . $i;
+		if($arrList[$keyname] != "" && $arrList[$deletekey] != '1') {
+			$sqlval['recommend_product_id'] = $arrList[$keyname];
+			$sqlval['comment'] = $arrList[$commentkey];
+			$sqlval['rank'] = $rank;
+			$sqlval['creator_id'] = $_SESSION['member_id'];
+			$objQuery->insert("dtb_recommend_products", $sqlval);
+			$rank--;
+		}
+	}
+}
+
+/* ÅÐÏ¿ºÑ¤ß¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */
+function lfPreGetRecommendProducts($product_id) {
+	$objQuery = new SC_Query();
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
+	$max = count($arrRet);
+	$no = 1;
+	
+	for($i = 0; $i < $max; $i++) {
+		$arrProductInfo = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass", "product_id = ?", array($arrRet[$i]['recommend_product_id'])); 
+		$arrRecommend[$no] = $arrProductInfo[0];
+		$arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
+		$arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
+		$no++;
+	}
+	return $arrRecommend;
+}
+
+/* ¾¦ÉÊ¾ðÊó¤ÎÆÉ¤ß¹þ¤ß */
+function lfGetProduct($product_id) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$table = "vw_products_nonclass";
+	$where = "product_id = ?";
+	$arrRet = $objQuery->select($col, $table, $where, array($product_id));
+		
+	return $arrRet[0];
+}
+
+/* ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductPage() {
+	global $objPage;
+	global $objUpFile;
+	
+	// ¥«¥Æ¥´¥ê¤ÎÆÉ¹þ
+	list($objPage->arrCatVal, $objPage->arrCatOut) = sfGetLevelCatList();
+
+	if($objPage->arrForm['status'] == "") {
+		$objPage->arrForm['status'] = 1;
+	}
+	
+	if(!is_array($objPage->arrForm['product_flag'])) {
+		// ¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹¤ÎÊ¬³äÆÉ¹þ
+		$objPage->arrForm['product_flag'] = sfSplitCheckBoxes($objPage->arrForm['product_flag']);
+	}
+	
+	// HIDDENÍÑ¤ËÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrHidden = array_merge((array)$objPage->arrHidden, (array)$objUpFile->getHiddenFileList());
+	// FormÍÑÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+	
+	$objPage->tpl_onload = "fnCheckSaleLimit('" . DISABLED_RGB . "'); fnCheckStockLimit('" . DISABLED_RGB . "');";
+}
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("°ìÍ÷-¥á¥¤¥ó²èÁü", 'main_list_image', array('jpg', 'gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó²èÁü", 'main_image', array('jpg', 'gif'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó³ÈÂç²èÁü", 'main_large_image', array('jpg', 'gif'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö²èÁü$cnt", "sub_image$cnt", array('jpg', 'gif'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);	
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü$cnt", "sub_large_image$cnt", array('jpg', 'gif'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
+	}
+	$objUpFile->addFile("¾¦ÉÊÈæ³Ó²èÁü", 'file1', array('jpg', 'gif'), IMAGE_SIZE, false, OTHER_IMAGE1_HEIGHT, OTHER_IMAGE1_HEIGHT);
+	$objUpFile->addFile("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false);
+}
+
+/* ¾¦ÉÊ¤ÎÅÐÏ¿ */
+function lfRegistProduct($arrList) {
+	global $objUpFile;
+	global $arrSTATUS;
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $arrList['name'];
+	$sqlval['category_id'] = $arrList['category_id'];
+	$sqlval['status'] = $arrList['status'];
+	$sqlval['product_flag'] = $arrList['product_flag'];
+	$sqlval['main_list_comment'] = $arrList['main_list_comment'];
+	$sqlval['main_comment'] = $arrList['main_comment'];
+	$sqlval['point_rate'] = $arrList['point_rate'];
+	
+	$sqlval['deliv_fee'] = $arrList['deliv_fee'];
+	$sqlval['comment1'] = $arrList['comment1'];
+	$sqlval['comment2'] = $arrList['comment2'];
+	$sqlval['comment3'] = $arrList['comment3'];
+	$sqlval['comment4'] = $arrList['comment4'];
+	$sqlval['comment5'] = $arrList['comment5'];
+	$sqlval['comment6'] = $arrList['comment6'];
+	$sqlval['main_list_comment'] = $arrList['main_list_comment'];
+	$sqlval['sale_limit'] = $arrList['sale_limit'];
+	$sqlval['sale_unlimited'] = $arrList['sale_unlimited'];
+	$sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$arrRet = $objUpFile->getDBFileList();
+	$sqlval = array_merge($sqlval, $arrRet);
+		
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$sqlval['sub_title'.$cnt] = $arrList['sub_title'.$cnt];
+		$sqlval['sub_comment'.$cnt] = $arrList['sub_comment'.$cnt];
+	}
+
+	if($arrList['product_id'] == "") {
+		$product_id = $objQuery->nextval("dtb_products", "product_id");
+		$sqlval['product_id'] = $product_id;
+		// ¥«¥Æ¥´¥êÆâ¤ÇºÇÂç¤Î¥é¥ó¥¯¤ò³ä¤êÅö¤Æ¤ë
+		$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "category_id = ?", array($arrList['category_id'])) + 1;
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_products", $sqlval);
+	} else {
+		$product_id = $arrList['product_id'];
+		// ºï½üÍ×µá¤Î¤¢¤Ã¤¿´ûÂ¸¥Õ¥¡¥¤¥ë¤Îºï½ü
+		$arrRet = lfGetProduct($arrList['product_id']);
+		$objUpFile->deleteDBFile($arrRet);
+		
+		// ¥«¥Æ¥´¥êÆâ¥é¥ó¥¯¤ÎÄ´À°½èÍý
+		$old_catid = $objQuery->get("dtb_products", "category_id", "product_id = ?", array($arrList['product_id']));
+		sfMoveCatRank($objQuery, "dtb_products", "product_id", "category_id", $old_catid, $arrList['category_id'], $arrList['product_id']);
+		
+		// UPDATE¤Î¼Â¹Ô
+		$where = "product_id = ?";
+		$objQuery->update("dtb_products", $sqlval, $where, array($arrList['product_id']));
+	}
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrList, $product_id);
+	
+	// ¤ª¤¹¤¹¤á¾¦ÉÊÅÐÏ¿
+	lfInsertRecommendProducts($objQuery, $arrList, $product_id);
+	
+	$objQuery->commit();
+	return $product_id;
+}
+
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	// ¿ÍÊª´ðËÜ¾ðÊó
+	
+	// ¥¹¥Ý¥Ã¥È¾¦ÉÊ
+	$arrConvList['name'] = "KVa";
+	$arrConvList['main_list_comment'] = "KVa";
+	$arrConvList['main_comment'] = "KVa";
+	$arrConvList['price01'] = "n";
+	$arrConvList['price02'] = "n";
+	$arrConvList['stock'] = "n";
+	$arrConvList['sale_limit'] = "n";
+	$arrConvList['point_rate'] = "n";
+	$arrConvList['product_code'] = "KVna";
+	$arrConvList['comment1'] = "a";
+	//¥Û¥Í¥±¡¼¥­:Á÷ÎÁ¤Î»ØÄê¤Ê¤·
+	$arrConvList['deliv_fee'] = "n";
+	
+	// ¾ÜºÙ-¥µ¥Ö
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$arrConvList["sub_title$cnt"] = "KVa";
+	}
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$arrConvList["sub_comment$cnt"] = "KVa";
+	}
+	
+	// ¤ª¤¹¤¹¤á¾¦ÉÊ
+	for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) {
+		$arrConvList["recommend_comment$cnt"] = "KVa";
+	}
+
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	
+	global $arrSTATUS;
+	$array['product_flag'] = sfMergeCheckBoxes($array['product_flag'], count($arrSTATUS));
+	
+	return $array;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+	global $objPage;
+	global $arrAllowedTag;
+	
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(array("¾¦ÉÊÌ¾", "name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾¦ÉÊ¥«¥Æ¥´¥ê", "category_id", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("°ìÍ÷-¥á¥¤¥ó¥³¥á¥ó¥È", "main_list_comment", MTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾ÜºÙ-¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LLTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾ÜºÙ-¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", $arrAllowedTag), array("HTML_TAG_CHECK"));
+	$objErr->doFunc(array("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN), array("EXIST_CHECK", "NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾¦ÉÊÁ÷ÎÁ", "deliv_fee", PRICE_LEN), array("NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸¡º÷¥ï¡¼¥É", "comment3", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥«¡¼URL", "comment1", URL_LEN), array("SPTAB_CHECK", "URL_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("È¯Á÷ÆüÌÜ°Â", "deliv_date_id", INT_LEN), array("NUM_CHECK"));
+	
+	if($objPage->tpl_nonclass) {
+		$objErr->doFunc(array("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK","MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("ÄÌ¾ï²Á³Ê", "price01", PRICE_LEN), array("ZERO_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("ÆÃÊÌ²Á³Ê", "price02", PRICE_LEN), array("EXIST_CHECK", "NUM_CHECK", "ZERO_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+			
+		if($array['stock_unlimited'] != "1") {
+			$objErr->doFunc(array("ºß¸Ë¿ô", "stock", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+		}
+	}
+	
+	if($array['sale_unlimited'] != "1") {	
+		$objErr->doFunc(array("¹ØÆþÀ©¸Â", "sale_limit", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	}
+	
+	if(isset($objErr->arrErr['category_id'])) {
+		// ¼«Æ°ÁªÂò¤òËÉ¤°¤¿¤á¤Ë¥À¥ß¡¼Ê¸»ú¤òÆþ¤ì¤Æ¤ª¤¯
+		$objPage->arrForm['category_id'] = "#";
+	}
+	
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objErr->doFunc(array("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë$cnt", "sub_title$cnt", STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È$cnt", "sub_comment$cnt", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È$cnt", "sub_comment$cnt", $arrAllowedTag),  array("HTML_TAG_CHECK"));	
+	}
+	
+	for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) {
+		if($_POST["recommend_id$cnt"] != "" && $_POST["recommend_delete$cnt"] != 1) {
+			$objErr->doFunc(array("¤ª¤¹¤¹¤á¾¦ÉÊ¥³¥á¥ó¥È$cnt", "recommend_comment$cnt", LTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		}
+	}
+	
+	return $objErr->arrErr;
+}
+
+/* ³ÎÇ§¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductConfirmPage() {
+	global $objPage;
+	global $objUpFile;
+	$objPage->tpl_mainpage = 'products/confirm.tpl';
+	$objPage->arrForm['mode'] = 'complete';
+	// ¥«¥Æ¥´¥ê¤ÎÆÉ¹þ
+	$objPage->arrCatList = sfGetCategoryList();
+	// FormÍÑÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+}
+
+/* µ¬³Ê¤¢¤êÈ½ÄêÍÑ(µ¬³Ê¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç:TRUE) */
+function lfCheckNonClass($product_id) {
+	if(sfIsInt($product_id)) {
+		$objQuery  = new SC_Query();
+		$where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
+		$count = $objQuery->count("dtb_products_class", $where, array($product_id));
+		if($count > 0) {
+			return false;
+		}
+	}
+	return true;
+}
+?>
Index: /temp/trunk/html/admin/products/index_csv.php
===================================================================
--- /temp/trunk/html/admin/products/index_csv.php	(revision 1328)
+++ /temp/trunk/html/admin/products/index_csv.php	(revision 1328)
@@ -0,0 +1,136 @@
+<?php
+require_once(ROOT_DIR."data/include/csv_output.inc");
+$arrREVIEW_CVSCOL = array( 
+						'B.name',
+						'A.status',
+						'A.create_date',
+						'A.reviewer_name',
+						'A.sex',
+						'A.recommend_level',
+						'A.title',
+						'A.comment'
+						);
+						
+$arrREVIEW_CVSTITLE = array(
+						'¾¦ÉÊÌ¾',
+						'¥ì¥Ó¥å¡¼É½¼¨',
+						'Åê¹ÆÆü',
+						'Åê¹Æ¼ÔÌ¾',
+						'À­ÊÌ',
+						'¤ª¤¹¤¹¤á¥ì¥Ù¥ë',
+						'¥¿¥¤¥È¥ë',
+						'¥³¥á¥ó¥È'
+						);
+
+// CSV½ÐÎÏ¥Ç¡¼¥¿¤òºîÀ®¤¹¤ë¡£(¾¦ÉÊ)
+function lfGetProductsCSV($where, $option, $arrval, $arrOutputCols) {
+	global $arrPRODUCTS_CVSCOL;
+
+	$from = "vw_product_class";
+	$cols = sfGetCommaList($arrOutputCols);
+	
+	$objQuery = new SC_Query();
+	$objQuery->setoption($option);
+	
+	$list_data = $objQuery->select($cols, $from, $where, $arrval);
+	$max = count($list_data);
+	
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	
+	for($i = 0; $i < $max; $i++) {
+		// ´ØÏ¢¾¦ÉÊ¾ðÊó¤ÎÉÕÍ¿
+		$list_data[$i]['classcategory_id1'] = $arrClassCatName[$list_data[$i]['classcategory_id1']];
+		$list_data[$i]['classcategory_id2'] = $arrClassCatName[$list_data[$i]['classcategory_id2']];
+		
+		// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+		$data .= lfMakeProductsCSV($list_data[$i]);	
+	}
+	return $data;
+}
+
+// CSV½ÐÎÏ¥Ç¡¼¥¿¤òºîÀ®¤¹¤ë¡£(¥ì¥Ó¥å¡¼)
+function lfGetReviewCSV($where, $option, $arrval) {
+	global $arrREVIEW_CVSCOL;
+
+	$from = "dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id ";
+	$cols = sfGetCommaList($arrREVIEW_CVSCOL);
+	
+	$objQuery = new SC_Query();
+	$objQuery->setoption($option);
+	
+	$list_data = $objQuery->select($cols, $from, $where, $arrval);	
+
+	$max = count($list_data);
+	for($i = 0; $i < $max; $i++) {
+		// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+		$data .= lfMakeReviewCSV($list_data[$i]);
+	}
+	return $data;
+}
+
+// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£(¾¦ÉÊ)
+function lfMakeProductsCSV($list) {
+	global $arrDISP;
+	$line = "";
+	if(is_array($list)) {
+		foreach($list as $key => $val) {
+			$tmp = "";
+			switch($key) {
+			case 'point_rate':
+				if($val == "") {
+					$tmp = '0';
+				} else {
+					$tmp = $val;
+				}
+				break;
+			default:
+				$tmp = $val;
+				break;
+			}
+	
+			$tmp = ereg_replace("[\",]", " ", $tmp);
+			$line .= "\"".$tmp."\",";
+		}
+		// Ê¸Ëö¤Î","¤òÊÑ´¹
+		$line = ereg_replace(",$", "\n", $line);
+	}
+	return $line;
+}
+
+
+// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£(¥ì¥Ó¥å¡¼)
+function lfMakeReviewCSV($list) {
+	global $arrSex;
+	global $arrRECOMMEND;
+	global $arrDISP;
+	
+	$line = "";
+	
+	foreach($list as $key => $val) {
+		$tmp = "";
+		switch($key) {
+		case 'sex':
+			$tmp = $arrSex[$val];
+			break;
+		case 'recommend_level':
+			$tmp = $arrRECOMMEND[$val];
+			break;
+		case 'status':
+			$tmp = $arrDISP[$val];
+			break;
+		default:
+			$tmp = $val;
+			break;
+		}
+
+		$tmp = ereg_replace("[\",]", " ", $tmp);
+		$line .= "\"".$tmp."\",";
+	}
+	// Ê¸Ëö¤Î","¤òÊÑ´¹
+	$line = ereg_replace(",$", "\n", $line);
+	return $line;
+}
+
+
+?>
Index: /temp/trunk/html/admin/products/edit.php
===================================================================
--- /temp/trunk/html/admin/products/edit.php	(revision 1328)
+++ /temp/trunk/html/admin/products/edit.php	(revision 1328)
@@ -0,0 +1,174 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../css/contents.css" type="text/css" />
+<script type="text/javascript" src="../js/css.js"></script>
+<script type="text/javascript" src="../js/navi.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+</head>
+
+<body bgcolor="#f3f3f3" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../css/common.css" type="text/css" />
+</noscript>
+
+
+<div align="center">
+<!--¢§HEADER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#bfbf9f" height="3" colspan="2"></td></tr>
+	<tr bgcolor="#dedecd">
+		<td height="40" width="365"><a href="../home.php"><img src="../misc/logo.gif" width="365" height="16" alt="EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸" border="0" /></a></td>
+		<td width="415" align="right"><a href="../home.php" onmouseover="chgImg('../misc/home_on.gif','home');" onmouseout="chgImg('../misc/home.gif','home');"><img src="../misc/home.gif" width="70" height="20" alt="HOME" border="0" name="home" id="home" /></a><img src="../misc/_.gif" width="3" height="1" alt="" />
+		<a href="#" onmouseover="chgImg('../misc/hp_on.gif','hp');" onmouseout="chgImg('../misc/hp.gif','hp');" target="_blank"><img src="../misc/hp.gif" width="70" height="20" alt="HP¤ò¸«¤ë" border="0" name="hp" id="hp" /></a><img src="../misc/_.gif" width="3" height="1" alt="" />
+		<a href="../index.html" onmouseover="chgImg('../misc/logout_on.gif','logout');" onmouseout="chgImg('../misc/logout.gif','logout');"><img src="../misc/logout.gif" width="70" height="20" alt="¥í¥°¥¢¥¦¥È" border="0" name="logout" id="logout" /></a><img src="../misc/_.gif" width="20" height="1" alt="" /></td>
+	</tr>
+	<tr><td bgcolor="#ffffff" height="1" colspan="3"></td></tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§MAIN NAVI-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td><a href="../basis/index.php" onmouseover="chgImg('../misc/basis_on.gif','basis');" onmouseout="chgImg('../misc/basis.gif','basis');"><img src="../misc/basis.gif" width="108" height="26" alt="´ðËÜ¾ðÊó" border="0" name="basis" id="basis" /></a></td>
+		<td><a href="../product/index.php"><img src="../misc/product_on.gif" width="108" height="26" alt="¾¦ÉÊ´ÉÍý" border="0" /></a></td>
+		<td><a href="../customer/index.php" onmouseover="chgImg('../misc/customer_on.gif','customer');" onmouseout="chgImg('../misc/customer.gif','customer');"><img src="../misc/customer.gif" width="108" height="26" alt="¸ÜµÒ´ÉÍý" border="0" name="customer" id="customer" /></a></td>
+		<td><a href="../order/index.php" onmouseover="chgImg('../misc/order_on.gif','order');" onmouseout="chgImg('../misc/order.gif','order');"><img src="../misc/order.gif" width="108" height="26" alt="¼õÃí´ÉÍý" border="0" name="order" id="order" /></a></td>
+		<td><a href="../sales/index.php" onmouseover="chgImg('../misc/sales_on.gif','sales');" onmouseout="chgImg('../misc/sales.gif','sales');"><img src="../misc/sales.gif" width="108" height="26" alt="Çä¾å´ÉÍý" border="0" name="sales" id="sales" /></a></td>
+		<td><a href="../mail/index.php" onmouseover="chgImg('../misc/mail_on.gif','mail');" onmouseout="chgImg('../misc/mail.gif','mail');"><img src="../misc/mail.gif" width="108" height="26" alt="¥á¡¼¥ëÇÛ¿®" border="0" name="mail" id="mail" /></a></td>
+		<td><a href="../contents/index.php" onmouseover="chgImg('../misc/contents_on.gif','contents');" onmouseout="chgImg('../misc/contents.gif','contents');"><img src="../misc/contents.gif" width="132" height="26" alt="¥³¥ó¥Æ¥ó¥Ä´ÉÍý" border="0" name="contents" id="contents" /></a></td>
+	</tr>
+	<tr><td colspan="7" height="1" bgcolor="#dedecd"></td></tr>
+	<tr><td colspan="7" bgcolor="#ffffff" height="15"></td></tr>
+</table>
+<!--¢¥MAIN NAVI-->
+
+<!--¢§CONTENTS-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#ffffff" align="center" valign="top" height="400">
+		<table width="740" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<tr>
+				<!--¢§SUB NAVI-->
+				<td class="fs12n"><span class="over">¢£¾¦ÉÊ¥Þ¥¹¥¿</span>¡¡<a href="./csv.php">¢£CSV¥¢¥Ã¥×¥í¡¼¥É</a>¡¡<a href="./input.php">¢£¾¦ÉÊÅÐÏ¿</a>¡¡<a href="./standard_input.php">¢£µ¬³ÊÅÐÏ¿</a>¡¡<a href="./category.php">¢£¥«¥Æ¥´¥êÀßÄê</a>¡¡<a href="./review.php">¢£¥ì¥Ó¥å¡¼´ÉÍý</a></td>
+				<!--¢¥SUB NAVI-->
+			</tr><tr><td height="25"></td></tr>
+		</table>
+		
+		<!--¢§MAIN CONTENTS-->
+		<table width="740" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<tr>
+				<td class="fs14n"><strong>¢£¾¦ÉÊ¥Þ¥¹¥¿¡§¾¦ÉÊÊÔ½¸</strong></td>
+			</tr>
+		</table>
+		
+		<!--¢§ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤«¤é-->
+		<form name="form1" id="form1" method="post" action="">
+		<table width="740" border="0" cellspacing="1" cellpadding="5" summary=" " bgcolor="#cccccc">
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾¦ÉÊ¥³¡¼¥É<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="code" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾¦ÉÊÌ¾<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="name" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¥«¥Æ¥´¥ê<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><select name="category">
+				<option value="" selected="selected">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>
+				<option value="¥À¥ß¡¼">¥À¥ß¡¼</option>
+				</select></td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">¾¦ÉÊ²Á³Ê<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557">¡ï<input type="text" name="price" size="6" class="box6" /><span class="red10"> ¡ÊÈ¾³Ñ¿ô»ú¤ÇÆþÎÏ Îã¡§28800¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">À½Â¤¸µ</td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="maker" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">ÈÎÇä¸µ</td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="dealer" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="radio" name="status" value="Ìµ¤·" checked="checked" />Ìµ¤·¡¡<input type="radio" name="status" value="NEW" />NEW¡¡<input type="radio" name="status" value="¥ª¥¹¥¹¥á" />¥ª¥¹¥¹¥á¡¡<input type="radio" name="status" value="ÃíÌÜ" />ÃíÌÜ¡¡<input type="radio" name="status" value="¸ÂÄê" />¸ÂÄê</td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">°ìÍ÷²èÌÌ¥³¥á¥ó¥È<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><textarea name="textfield01" cols="60" rows="8" class="area60"></textarea><span class="red"> ¡Ê¾å¸Â200Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¤ª¤¹¤¹¤á¥Ý¥¤¥ó¥È<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><textarea name="textfield02" cols="60" rows="8" class="area60"></textarea><span class="red"> ¡Ê¾å¸Â3000Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">À½ÉÊ¾Ò²ð<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><textarea name="textfield03" cols="60" rows="8" class="area60"></textarea><span class="red"> ¡Ê¾å¸Â3000Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">ºß¸Ë¿ô<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="text" name="stock" size="6" class="box6" /> Ã±°Ì¡¡<input type="checkbox" name="nostock" value="ºß¸ËÀ©¸ÂÌµ¤·" />ºß¸ËÀ©¸ÂÌµ¤·</td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">¹ØÆþÀ©¸Â¿ô<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="text" name="purchase" size="6" class="box6" /> Ã±°Ì¤Þ¤Ç</td>
+			</tr>
+			<tr class="fs12">
+				<td bgcolor="#f0f0f0" width="160">ÇÛÁ÷¶È¼Ô<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="checkbox" name="delivery01" value="¥ä¥Þ¥È±¿Í¢" />¥ä¥Þ¥È±¿Í¢<br />
+				<input type="checkbox" name="delivery02" value="º´ÀîµÞÊØ" />º´ÀîµÞÊØ<br />
+				<input type="checkbox" name="delivery03" value="ÆüËÜÍ¹À¯¸ø¼Ò" />ÆüËÜÍ¹À¯¸ø¼Ò</td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">°ìÍ÷ÍÑ²èÁü</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image00" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾ÜºÙÍÑ²èÁü¡Ê1¡Ë<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image01" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾ÜºÙÍÑ²èÁü¡Ê2¡Ë</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image02" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾ÜºÙÍÑ²èÁü¡Ê3¡Ë</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image03" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">ÊÌ¥¦¥¤¥ó¥É¥¦ÍÑ²èÁü</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image_window" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë</td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="file" name="product_file" size="60" class="box60" /><span class="red"> ¡Ê¡û¡û·Á¼°¡Ë</span></td>
+			</tr>
+		</table>
+		<!--¢¥ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤Þ¤Ç-->
+		<br />
+		<input type="button" name="subm" value="¤³¤ÎÆâÍÆ¤ÇÅÐÏ¿¤¹¤ë" />
+		</form>
+		
+		<!--¢¥MAIN CONTENTS-->
+		</td>
+	</tr>
+</table>
+<!--¢¥CONTENTS-->
+
+<!--¢§FOOTER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#ffffff" height="60"></td></tr>
+	<tr><td bgcolor="#e5e5df" height="5"></td></tr>
+</table>
+<!--¢¥FOOTER-->
+</div>
+</body>
+</html>
Index: /temp/trunk/html/admin/products/product_rank.php
===================================================================
--- /temp/trunk/html/admin/products/product_rank.php	(revision 1328)
+++ /temp/trunk/html/admin/products/product_rank.php	(revision 1328)
@@ -0,0 +1,88 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product_rank.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'product_rank';
+		$this->tpl_subtitle = '¾¦ÉÊÊÂ¤ÓÂØ¤¨';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objPage->tpl_pageno = $_POST['pageno'];
+
+// ÄÌ¾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄê¤¹¤ë¡£
+$objPage->arrForm['parent_category_id'] = $_POST['parent_category_id'];
+
+switch($_POST['mode']) {
+case 'up':
+	$where = "category_id = " . addslashes($_POST['parent_category_id']);
+	sfRankUp("dtb_products", "product_id", $_POST['product_id'], $where);
+	break;
+case 'down':
+	$where = "category_id = " . addslashes($_POST['parent_category_id']);
+	sfRankDown("dtb_products", "product_id", $_POST['product_id'], $where);
+	break;
+case 'move':
+	$key = "pos-".$_POST['product_id'];
+	$input_pos = mb_convert_kana($_POST[$key], "n");
+	if(sfIsInt($input_pos)) {
+		$where = "category_id = " . addslashes($_POST['parent_category_id']);
+		sfMoveRank("dtb_products", "product_id", $_POST['product_id'], $input_pos, $where);
+	}
+	break;
+case 'tree':
+	// ¥«¥Æ¥´¥ê¤ÎÀÚÂØ¤Ï¡¢¥Ú¡¼¥¸ÈÖ¹æ¤ò¥¯¥ê¥¢¤¹¤ë¡£
+	$objPage->tpl_pageno = "";
+	break;
+default:
+	break;
+}
+
+$objPage->arrTree = sfGetCatTree($_POST['parent_category_id']);
+$objPage->arrProductsList = lfGetProduct($_POST['parent_category_id']);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¾¦ÉÊÆÉ¤ß¹þ¤ß */
+function lfGetProduct($category_id) {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$col = "product_id, name, main_list_image, rank, product_code";
+	$table = "vw_products_nonclass";
+	$where = "delete = 0 AND category_id = ?";
+	
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($table, $where, array($category_id));
+	// ½ç°Ì¡¢³ºÅö·ï¿ôÉ½¼¨ÍÑ
+	$objPage->tpl_linemax = $linemax;
+	
+	$objNavi = new SC_PageNavi($objPage->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
+	$startno = $objNavi->start_row;
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// NaviÉ½¼¨Ê¸»úÎó
+	$objPage->tpl_pagemax = $objNavi->max_page;		// ¥Ú¡¼¥¸ºÇÂç¿ô¡Ê¡Ö¾å¤Ø²¼¤Ø¡×É½¼¨È½ÄêÍÑ¡Ë
+	$objPage->tpl_disppage = $objNavi->now_page;	// É½¼¨¥Ú¡¼¥¸ÈÖ¹æ¡Ê¡Ö¾å¤Ø²¼¤Ø¡×É½¼¨È½ÄêÍÑ¡Ë
+			
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+	
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select($col, $table, $where, array($category_id));
+	return $arrRet;
+}
+
+?>
Index: /temp/trunk/html/admin/products/upload_csv.php
===================================================================
--- /temp/trunk/html/admin/products/upload_csv.php	(revision 1328)
+++ /temp/trunk/html/admin/products/upload_csv.php	(revision 1328)
@@ -0,0 +1,198 @@
+<?php
+require_once("../require.php");
+require_once("./upload_csv.inc");
+
+// 1¹Ô¤¢¤¿¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("CSV_LINE_MAX", 10000);
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/upload_csv.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_csv';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objFormParam->setHtmlDispNameArray();
+$objPage->arrTitle = $objFormParam->getHtmlDispNameArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, CSV_LINE_MAX);
+						
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+			
+			if($line <= 1) {
+				continue;
+			}			
+							
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				lfRegistProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+			// ¾¦ÉÊ·ï¿ô¥«¥¦¥ó¥È´Ø¿ô¤Î¼Â¹Ô
+			sfCategory_Count($objQuery);
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+		
+	$objFormParam->addParam("¾¦ÉÊID", "product_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("µ¬³ÊID", "product_class_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	
+	$objFormParam->addParam("µ¬³ÊÌ¾1(ÊÑ¹¹ÉÔ²Ä)", "dummy1");
+	$objFormParam->addParam("µ¬³ÊÌ¾2(ÊÑ¹¹ÉÔ²Ä)", "dummy2");
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸ø³«¥Õ¥é¥°(1:¸ø³« 2:Èó¸ø³«)", "status", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»²¹Í»Ô¾ì²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥«¡¼URL", "comment1", STEXT_LEN, "KVa", array("SPTAB_CHECK","URL_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸¡º÷¥ï¡¼¥É", "comment3", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("°ìÍ÷-¥á¥¤¥ó¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("°ìÍ÷-¥á¥¤¥ó²èÁü", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó²èÁü", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó³ÈÂç²èÁü", "main_large_image", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥é¡¼Èæ³Ó²èÁü", "file1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", "file2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(1)", "sub_title1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(1)", "sub_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(1)", "sub_image1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(1)", "sub_large_image1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(2)", "sub_title2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(2)", "sub_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(2)", "sub_image2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(2)", "sub_large_image2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(3)", "sub_title3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(3)", "sub_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(3)", "sub_image3", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(3)", "sub_large_image3", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(4)", "sub_title4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(4)", "sub_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(4)", "sub_image4", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(4)", "sub_large_image4", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(5)", "sub_title5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(5)", "sub_comment5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(5)", "sub_image5", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(5)", "sub_large_image5", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objFormParam->addParam("È¯Á÷ÆüÌÜ°Â", "deliv_date_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(1)", "recommend_product_id1", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(1)", "recommend_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(2)", "recommend_product_id2", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(2)", "recommend_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(3)", "recommend_product_id3", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(3)", "recommend_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(4)", "recommend_product_id4", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(4)", "recommend_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+?>
Index: /temp/trunk/html/admin/products/review.php
===================================================================
--- /temp/trunk/html/admin/products/review.php	(revision 1328)
+++ /temp/trunk/html/admin/products/review.php	(revision 1328)
@@ -0,0 +1,238 @@
+<?php
+
+require_once("../require.php");
+require_once("./index_csv.php");
+
+session_start();
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		global $arrPageMax;
+		global $arrRECOMMEND;
+		global $arrSex;
+		$this->arrPageMax = $arrPageMax;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		$this->arrSex = $arrSex;
+		$this->tpl_mainpage = 'products/review.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'review';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¥ì¥Ó¥å¡¼´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+$objQuery = new SC_Query();
+
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷³«»ÏÇ¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrStartYear = $objDate->getYear();
+$objPage->arrStartMonth = $objDate->getMonth();
+$objPage->arrStartDay = $objDate->getDay();
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷½ªÎ»Ç¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrEndYear = $objDate->getYear();
+$objPage->arrEndMonth = $objDate->getMonth();
+$objPage->arrEndDay = $objDate->getDay();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¥«¥é¥à¤Î¼èÆÀ
+$select="review_id, A.product_id, reviewer_name, sex, recommend_level, ";
+$select.="reviewer_url, title, comment, A.status, A.create_date, A.update_date, name";
+$from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
+
+	// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+	foreach ($_POST as $key => $val) {
+		if (ereg("^search_", $key)) {
+			switch ($key){
+				case 'search_sex':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				if(!is_array($val)) {
+					$objPage->arrForm[$key] = split("-", $val);
+				}
+				break;
+				
+				default:
+					$objPage->arrHidden[$key] = $val;
+					break;
+			}
+		}
+	}
+
+if ($_POST['mode'] == "delete"){
+	//¥ì¥Ó¥å¡¼¤Îºï½ü
+	$objQuery->exec("UPDATE dtb_review SET delete=1 WHERE review_id=?", array($_POST['review_id']));
+}
+	
+if ($_POST['mode'] == 'search' || $_POST['mode'] == 'csv' || $_POST['mode'] == 'delete'){
+	
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤¾¦ÉÊ¤ò¸¡º÷
+	$where="A.delete = 0 AND B.delete = 0";
+	$objPage->arrForm = $_POST;
+	if (!is_array($_POST['search_sex'])){
+		$objPage->arrForm['search_sex'] = split("-", $_POST['search_sex']);
+	}
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+	
+	if (!$objPage->arrErr){
+		foreach ($_POST as $key => $val){
+
+			$val = sfManualEscape($val);
+			
+			if($val == "") {
+				continue;
+			}
+			
+			switch ($key){
+			case 'search_reviewer_name':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND reviewer_name ILIKE ? ";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_reviewer_url':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND reviewer_url ILIKE ? ";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_name':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND name ILIKE ? ";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_product_code':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND A.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? )";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_sex':
+				$tmp_where = "";
+				//$val=ÇÛÎó¤ÎÃæ¿È,$element=³Æ¥­¡¼¤ÎÃÍ(1,2)
+				if (is_array($val)){
+					foreach($val as $element) {
+						if($element != "") {
+							if($tmp_where == "") {
+								$tmp_where .= " AND (sex = ?";
+							} else {
+								$tmp_where .= " OR sex = ?";
+							}
+							$arrval[] = $element;
+						}
+					}
+					if($tmp_where != "") {
+						$tmp_where .= ")";
+						$where .= " $tmp_where ";
+					}
+				}
+				
+				break;
+				
+			case 'search_recommend_level':
+				$where.= "AND recommend_level LIKE ? ";
+				$arrval[] = $val;
+				break;
+				
+			case 'search_startyear':
+				if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])){
+					$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+					$where.= " AND A.create_date >= ? ";
+					$arrval[] = $date;
+				}
+				break;
+				
+			case 'search_endyear':
+				if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])){
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
+					$where.= " AND A.create_date <= ? ";
+					$arrval[] = $date;
+				}
+				break;
+			}
+		}
+			
+	}
+	
+	$order = "A.create_date DESC";
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->arrPagenavi = $objNavi->arrPagenavi;
+	$startno = $objNavi->start_row;
+
+	$objPage->tpl_pageno = $_POST['search_pageno'];
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	
+	//¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrReview = $objQuery->select($select, $from, $where, $arrval);
+	
+	//CSV¥À¥¦¥ó¥í¡¼¥É
+	if ($_POST['mode'] == 'csv'){
+		// ¥ª¥×¥·¥ç¥ó¤Î»ØÄê
+		$option = "ORDER BY review_id";
+		// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤ÎºîÀ®
+		$head = sfGetCSVList($arrREVIEW_CVSTITLE);
+		$data = lfGetReviewCSV($where, '', $arrval);
+		// CSV¤òÁ÷¿®¤¹¤ë¡£
+		sfCSVDownload($head.$data);
+		exit;
+	}	
+}
+	
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-------------------------------------------------------------------------------------
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError() {
+	$objErr = new SC_CheckError();
+	switch ($_POST['mode']){
+		case 'search':
+		$objErr->doFunc(array("Åê¹Æ¼Ô", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+		$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+		$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+		$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+		break;
+		
+		case 'complete':
+		$objErr->doFunc(array("¤ª¤¹¤¹¤á¥ì¥Ù¥ë", "recommend_level"), array("SELECT_CHECK"));
+		$objErr->doFunc(array("¥¿¥¤¥È¥ë", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		break;
+	}
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/admin/products/review_show.php
===================================================================
--- /temp/trunk/html/admin/products/review_show.php	(revision 1328)
+++ /temp/trunk/html/admin/products/review_show.php	(revision 1328)
@@ -0,0 +1,73 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="/admin/css/contents.css" type="text/css" />
+<script type="text/javascript" src="/js/css.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+<script type="text/javascript">
+<!--
+self.moveTo(20,20);self.focus();
+//-->
+</script>
+</head>
+
+<body bgcolor="#ffffff" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+<noscript>
+<link rel="stylesheet" href="/admin/css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¢§MAIN CONTENTS-->
+<table width="400" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td class="fs14n"><strong>¢¡¥ì¥Ó¥å¡¼</strong></td>
+	</tr>
+	<tr><td height="15"></td></tr>
+</table>
+<table width="400" bgcolor="#cccccc" border="0" cellspacing="1" cellpadding="5" summary=" ">
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">Åê¹ÆÆü</td>
+		<td width="287" bgcolor="#ffffff">2005/06/29</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">Åê¹Æ¼ÔÌ¾</td>
+		<td width="287" bgcolor="#ffffff">»³ÅÄÂÀÏº</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¾¦ÉÊÌ¾</td>
+		<td width="287" bgcolor="#ffffff">RAKUWA¥Í¥Ã¥¯</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¤ª¤¹¤¹¤á¥ì¥Ù¥ë</td>
+		<td width="287" bgcolor="#ffffff">¡ú¡ú¡ú¡ú¡ú</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¥¿¥¤¥È¥ë</td>
+		<td width="287" bgcolor="#ffffff">ËèÆü¤ÎÄÌ¶Ð¤¬¤³¤ì¤Ç¤é¤¯¤Ë¤Ê¤ê¤Þ¤·¤¿¡Á</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¥³¥á¥ó¥È</td>
+		<td width="287" bgcolor="#ffffff">¤³¤ì¤¬ËÍ¤Ë¤È¤Ã¤ÆºÇ½é¤ÎNSX¤Ê¤ó¤Ç¤¹¤¬¡¢°ÊÁ°¤«¤éÍß¤·¤¯¤Æ¤º¤Ã¤ÈÁÀ¤Ã¤Æ¤¤¤Þ¤·¤¿¡£¥ê¡¼¥¹¤Î¿·¤·¤¤¥×¥í¥°¥é¥à¤¬½Ð¤¿¤Î¤Ç¡¢¤³¤ì¤Ï¥Á¥ã¥ó¥¹¤È¤Ð¤«¤ê¤Ë¹ØÆþ¤·¤¿¤ó¤Ç¤¹¡£ËÍ¤Ï¡¢¤³¤Î¿·¤·¤¤¥¹¥¿¥¤¥ê¥ó¥°¤¬¤¹¤´¤¯µ¤¤ËÆþ¤Ã¤Æ¤¤¤Þ¤¹¡£ºÇ¿·¤Ç¤¹¤«¤é¤Í¡£NSX¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤Î¤¤¤¤¤È¤³¤í¤Ï¡¢¥Ï¥ó¥É¥ê¥ó¥°¤Î¤è¤µ¤È¥³¡¼¥Ê¥ê¥ó¥°Ãæ¤Î¥Ð¥é¥ó¥¹¤Î¤è¤µ¤Ç¤¹¤Í¡£¤¹¤´¤¯¥Ð¥é¥ó¥¹¤¬¼è¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¾¯¤·ÌµÍý¤ò¤·¤Æ¤â¤¢¤Þ¤ê¥ê¥¢¤¬Î®¤ì¤Ê¤¤¤ó¤Ç¤¹¡£¥µ¥¹¥Ú¥ó¥·¥ç¥ó¤â¤¤¤¤¤Ç¤¹¤Í¡£¥É¥¤¥Ä¤Î¥¹¥Ý¡¼¥Ä¥µ¥ë¡¼¥ó¤Î¥µ¥¹¥Ú¥ó¥·¥ç¥ó¤¬¹¥¤­¤Ç10Ç¯°Ê¾å¾è¤Ã¤Æ¤¤¤¿¤ó¤Ç¤¹¤±¤É¡¢NSX¤Ï¤½¤ì°Ê¾å¤Ç¤¹¡£¤è¤¯Áö¤ê¹þ¤ó¤Ç¥Á¥å¡¼¥Ë¥ó¥°¤·¤¿¤ó¤À¤Ê¡¦¡¦¤È¤¤¤¦¤³¤È¤¬Áö¤ê¤Ê¤¬¤éÅÁ¤ï¤Ã¤Æ¤­¤Þ¤¹¡£²¿¤È¸À¤¦¤«¡¢¥É¥é¥¤¥Ð¡¼¤Ë¸ì¤ê¤«¤±¤Æ¤¯¤ë´¶¤¸¤Ê¤ó¤Ç¤¹¤è¡£¼Á¤Î¹â¤µ¤È¤¤¤¦¤«¡¢²¹¤â¤ê¤È¤¤¤¦¤«¡¢¤ª¸ß¤¤Ê¬¤«¤ê¹ç¤¨¤ë¤è¤¦¤Ê¤Ä¤Ê¤¬¤ê¤ò´¶¤¸¤ë¤ó¤Ç¤¹¡£</td>
+	</tr>
+</table>
+
+<br />
+
+<table width="400" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td align="center">
+		<form name="form1" id="form1" method="post" action="">
+		<input type="button" name="close" value="¥¦¥¤¥ó¥É¥¦¤òÊÄ¤¸¤ë" onClick="window.close()" />
+		</form></td>
+	</tr>
+</table>
+<!--¢¥MAIN CONTENTS-->
+</div>
+
+</body>
+</html>
Index: /temp/trunk/html/admin/sales/index.php
===================================================================
--- /temp/trunk/html/admin/sales/index.php	(revision 1328)
+++ /temp/trunk/html/admin/sales/index.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'sales/index.tpl';
+		$this->tpl_mainno = 'sales';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/admin/login_error.php
===================================================================
--- /temp/trunk/html/admin/login_error.php	(revision 1328)
+++ /temp/trunk/html/admin/login_error.php	(revision 1328)
@@ -0,0 +1,57 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="./css/contents.css" type="text/css" />
+<script type="text/javascript" src="./js/css.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+</head>
+
+<body bgcolor="#f3f3f3" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="./css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¢§HEADER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#bfbf9f" height="3"></td></tr>
+	<tr>
+		<td bgcolor="#dedecd" height="40"><img src="./misc/logo.gif" width="365" height="16" alt="EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸" /></td>
+	</tr>
+	<tr><td height="1" bgcolor="#ffffff"></td></tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§CONTENTS-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td height="400" bgcolor="#ffffff" align="center">
+		<form id="form1" method="post" action="">
+		<table width="400" bgcolor="#cccccc" cellspacing="1" cellpadding="10">
+			<tr>
+				
+			  <td height="200" align="center" class="fs12n" bgcolor="#ffffff"> 
+				<span class="red">¥Ñ¥¹¥ï¡¼¥É¤¬°ã¤¤¤Þ¤¹</span><br />¡¡<br />
+				<input name="subm" id="subm" type="button" onclick="location.href='./index.html'" value="Ìá¤ë" />
+				</td>
+			</tr>
+		</table>
+		</form>
+		</td>
+	</tr>
+</table>
+<!--¢¥CONTENTS-->
+
+<!--¢§FOOTER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#e5e5df" height="5"></td></tr>
+</table>
+<!--¢¥FOOTER-->
+</div>
+</body>
+</html>
Index: /temp/trunk/html/admin/design/index.php
===================================================================
--- /temp/trunk/html/admin/design/index.php	(revision 1328)
+++ /temp/trunk/html/admin/design/index.php	(revision 1328)
@@ -0,0 +1,371 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/index.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno = "layout";		
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥ì¥¤¥¢¥¦¥ÈÊÔ½¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// ¥Ú¡¼¥¸ID¤ò¼èÆÀ
+if (isset($_GET['page_id'])) {
+	$page_id = $_GET['page_id'];
+}else if ($_POST['page_id']){
+	$page_id = $_POST['page_id'];
+}else{
+	$page_id = 1;
+}
+
+// ÊÔ½¸²ÄÇ½¥Ú¡¼¥¸¤ò¼èÆÀ
+$objPage->arrEditPage = lfgetPageData();
+
+// ¥Ö¥í¥Ã¥¯ÇÛÃÖÍÑ¥Ç¡¼¥¿¤ò¼èÆÀ
+$sel   = ", pos.target_id, pos.bloc_id, pos.bloc_row ";
+$from  = ", dtb_blocposition AS pos";
+$where = " where lay.page_id = ? AND lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id ";
+$arrBlocPos = lfgetLayoutData($sel, $from, $where, array($page_id));
+
+// ¥Ö¥í¥Ã¥¯¤ò¼èÆÀ
+$arrBloc = lfgetBlocData();
+
+// ¿·µ¬¥Ö¥í¥Ã¥¯ºîÀ®
+if ($_POST['mode'] == 'new_bloc') {
+	header("location: ./bloc.php");
+}
+
+// ¿·µ¬¥Ú¡¼¥¸ºîÀ®
+if ($_POST['mode'] == 'new_page') {
+	header("location: ./main_edit.php");
+}
+
+// ¥Ç¡¼¥¿ÅÐÏ¿½èÍý
+if ($_POST['mode'] == 'confirm' or $_POST['mode'] == 'preview') {
+	
+	$arrPageData = array();
+	if ($_POST['mode'] == 'preview') {
+		$arrPageData = lfgetPageData(" page_id = ? " , array($page_id));
+		$page_id = 0;
+		$_POST['page_id'] = 0;
+	}
+	
+	// ¹¹¿·ÍÑ¤Ë¥Ç¡¼¥¿¤òÀ°¤¨¤ë
+	$arrUpdBlocData = array();
+	$arrTargetFlip = array_flip($arrTarget);
+	
+	$upd_cnt = 1;
+	$arrUpdData[$upd_cnt]['page_id'] = $_POST['page_id'];
+	
+	// POST¤Î¥Ç¡¼¥¿¤ò»È¤¤¤ä¤¹¤¤¤è¤¦¤Ë½¤Àµ
+	for($upd_cnt = 1; $upd_cnt <= $_POST['bloc_cnt']; $upd_cnt++){
+		if (!isset($_POST['id_'.$upd_cnt])) {
+			break;
+		}
+		$arrUpdBlocData[$upd_cnt]['name'] 		= $_POST['name_'.$upd_cnt];							// ¥Ö¥í¥Ã¥¯Ì¾¾Î
+		$arrUpdBlocData[$upd_cnt]['id']	  		= $_POST['id_'.$upd_cnt];							// ¥Ö¥í¥Ã¥¯ID 
+		$arrUpdBlocData[$upd_cnt]['target_id'] 	= $arrTargetFlip[$_POST['target_id_'.$upd_cnt]];	// ¥¿¡¼¥²¥Ã¥ÈID
+		$arrUpdBlocData[$upd_cnt]['top'] 		= $_POST['top_'.$upd_cnt];							// TOPºÂÉ¸
+		$arrUpdBlocData[$upd_cnt]['update_url']	= $_SERVER['HTTP_REFERER'];							// ¹¹¿·URL
+	}
+	
+	// ¥Ç¡¼¥¿¤Î¹¹¿·¤ò¹Ô¤¦
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// delete¼Â¹Ô
+	$del_sql = "";
+	$del_sql .= "DELETE FROM dtb_blocposition WHERE page_id = ? ";
+	$arrRet = $objDBConn->query($del_sql,array($page_id));
+	
+	// ¥Ö¥í¥Ã¥¯¤Î½ç½ø¤ò¼èÆÀ¤·¡¢¹¹¿·¤ò¹Ô¤¦
+	foreach($arrUpdBlocData as $key => $val){
+		// ¥Ö¥í¥Ã¥¯¤Î½ç½ø¤ò¼èÆÀ
+		$bloc_row = lfGetRowID($arrUpdBlocData, $val);
+		$arrUpdBlocData[$key]['bloc_row'] = $bloc_row;
+		$arrUpdBlocData[$key]['page_id'] 	= $_POST['page_id'];	// ¥Ú¡¼¥¸ID
+		
+		if ($arrUpdBlocData[$key]['target_id'] == 5) {
+			$arrUpdBlocData[$key]['bloc_row'] = "0";
+		}
+		
+		// insertÊ¸À¸À®
+		$ins_sql = "";
+		$ins_sql .= "INSERT INTO dtb_blocposition ";
+		$ins_sql .= " values ( ";
+		$ins_sql .= "	?  ";			// ¥Ú¡¼¥¸ID
+		$ins_sql .= "	,? ";			// ¥¿¡¼¥²¥Ã¥ÈID
+		$ins_sql .= "	,? ";			// ¥Ö¥í¥Ã¥¯ID
+		$ins_sql .= "	,? ";			// ¥Ö¥í¥Ã¥¯¤ÎÊÂ¤Ó½ç½ø
+		$ins_sql .= "	)  ";
+
+		// insert¥Ç¡¼¥¿À¸À®
+		$arrInsData = array($page_id,
+							 $arrUpdBlocData[$key]['target_id'],
+							 $arrUpdBlocData[$key]['id'],
+							 $arrUpdBlocData[$key]['bloc_row']
+							);
+		// SQL¼Â¹Ô
+		$arrRet = $objDBConn->query($ins_sql,$arrInsData);
+	}
+
+	if ($_POST['mode'] == 'preview') {
+		
+		lfSetPreData($arrPageData);
+		
+		$_SESSION['preview'] = "ON";
+		header("location: /preview/index.php");
+	}else{
+		header("location: ./index.php?page_id=$page_id");
+	}
+}
+
+// ¥Ç¡¼¥¿ºï½ü½èÍý ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Ç¤Ê¤±¤ì¤Ð¥Õ¥¡¥¤¥ë¤òºï½ü
+if ($_POST['mode'] == 'delete' and 	!lfCheckBaseData($page_id)) {
+	lfDelPageData($page_id);
+}
+
+// ¥Ö¥í¥Ã¥¯¾ðÊó¤ò²èÌÌÇÛÃÖÍÑ¤ËÊÔ½¸
+$tpl_arrBloc = array();
+$cnt = 0;
+// »ÈÍÑ¤µ¤ì¤Æ¤¤¤ë¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤òÀ¸À®
+foreach($arrBlocPos as $key => $val){
+	if ($val['page_id'] == $page_id) {
+		$tpl_arrBloc = lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
+		$cnt++;
+	}
+}
+
+// Ì¤»ÈÍÑ¤Î¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤òÄÉ²Ã
+foreach($arrBloc as $key => $val){
+	if (!lfChkBloc($val, $tpl_arrBloc)) {
+		$val['target_id'] = 5;	// Ì¤»ÈÍÑ¤ËÄÉ²Ã¤¹¤ë
+		$tpl_arrBloc = lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
+		$cnt++;
+	}
+}
+$objPage->tpl_arrBloc = $tpl_arrBloc;
+$objPage->bloc_cnt = count($tpl_arrBloc);
+$objPage->page_id = $page_id;
+
+// ¥Ú¡¼¥¸Ì¾¾Î¤ò¼èÆÀ
+$arrPageData = lfgetPageData(' page_id = ?', array($page_id));
+$objPage->arrPageData = $arrPageData[0];
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetLayoutData
+ * ½èÍýÆâÍÆ	¡§ÊÔ½¸²ÄÇ½¤Ê¥Ú¡¼¥¸¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$sel    ¥¥¥ Select¶çÊ¸
+ * °ú¿ô2	¡§$where  ¥¥¥ Where¶çÊ¸
+ * °ú¿ô3	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+ * Ìá¤êÃÍ	¡§¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È¾ðÊó
+ **************************************************************************************************************/
+function lfgetLayoutData($sel = '' , $from = '', $where = '', $arrVal = ''){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// SQLÀ¸À®
+
+	$sql = "";
+	$sql .= " select "; 
+	$sql .= "     lay.page_id ";
+	$sql .= "     ,lay.page_name ";
+	$sql .= "     ,lay.url ";
+	$sql .= "     ,lay.author ";
+	$sql .= "     ,lay.description ";
+	$sql .= "     ,lay.keyword ";
+	$sql .= "     ,lay.update_url ";
+	$sql .= "     ,lay.create_date ";
+	$sql .= "     ,lay.update_date ";
+	
+	// Select¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($sel != '') {
+		$sql .= $sel;
+	}
+	
+	$sql .= " from dtb_pagelayout AS lay ";
+	// From¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($from != '') {
+		$sql .= $from;
+	}
+
+	// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($where != '') {
+		$sql .= $where;
+	}else{
+		$sql .= " ORDER BY lay.page_id ";
+	}
+	
+	$arrRet = $objDBConn->getAll($sql, $arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$where  ¥¥¥ Where¶çÊ¸
+ * °ú¿ô2	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+ * Ìá¤êÃÍ	¡§¥Ö¥í¥Ã¥¯¾ðÊó
+ **************************************************************************************************************/
+function lfgetBlocData($where = '', $arrVal = ''){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// SQLÀ¸À®
+	$sql = "";
+	$sql .= " SELECT ";
+	$sql .= "	bloc_id";
+	$sql .= "	,bloc_name";
+	$sql .= "	,tpl_path";
+	$sql .= "	,filename";
+	$sql .= " 	,update_date";
+	$sql .= " FROM ";
+	$sql .= " 	dtb_bloc";
+
+	// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($where != '') {
+		$sql .= " WHERE " . $where;
+	}
+	
+	$sql .= " ORDER BY 	bloc_id";
+	
+	$arrRet = $objDBConn->getAll($sql, $arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfSetBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ÎÇÛÎó¤òÀ¸À®¤¹¤ë
+ * °ú¿ô1	¡§$arrBloc    	¥¥¥ Bloc¾ðÊó
+ * °ú¿ô2	¡§$tpl_arrBloc	¥¥¥ ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ëÇÛÎó
+ * °ú¿ô3	¡§$cnt			¥¥¥ ÇÛÎóÈÖ¹æ
+ * Ìá¤êÃÍ	¡§¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó
+ **************************************************************************************************************/
+function lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt) {
+	global $arrTarget;
+	
+	$tpl_arrBloc[$cnt]['target_id'] = $arrTarget[$val['target_id']];
+	$tpl_arrBloc[$cnt]['bloc_id'] = $val['bloc_id'];
+	$tpl_arrBloc[$cnt]['bloc_row'] = $val['bloc_row'];
+
+	foreach($arrBloc as $bloc_key => $bloc_val){
+		if ($bloc_val['bloc_id'] == $val['bloc_id']) {
+			$bloc_name = $bloc_val['bloc_name'];
+			break;
+		}
+	}
+	$tpl_arrBloc[$cnt]['name'] = $bloc_name;
+	
+	return $tpl_arrBloc;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfChkBloc
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯ID¤¬ÇÛÎó¤ËÄÉ²Ã¤µ¤ì¤Æ¤¤¤ë¤«¤Î¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô1	¡§$arrBloc    ¥¥¥ Bloc¾ðÊó
+ * °ú¿ô2	¡§$arrChkData ¥¥¥ ¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¥Ç¡¼¥¿ÇÛÎó
+ * Ìá¤êÃÍ	¡§True	¥¥¥ Â¸ºß¤¹¤ë
+ * 			¡¡False	¥¥¥ Â¸ºß¤·¤Ê¤¤
+ **************************************************************************************************************/
+function lfChkBloc($arrBloc, $arrChkData) {
+	foreach($arrChkData as $key => $val){
+		if ($val['bloc_id'] === $arrBloc['bloc_id'] ) {
+			// ÇÛÎó¤ËÂ¸ºß¤¹¤ì¤ÐTrue¤òÊÖ¤¹
+			return true;
+		}
+	}
+	
+	// ÇÛÎó¤ËÂ¸ºß¤·¤Ê¤±¤ì¤ÐFlase¤òÊÖ¤¹
+	return false;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetRowID
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯ID¤¬²¿ÈÖÌÜ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤«¤òÄ´¤Ù¤ë
+ * °ú¿ô1	¡§$arrUpdData   ¥¥¥ ¹¹¿·¾ðÊó
+ * °ú¿ô2	¡§$arrObj 		¥¥¥ ¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¥Ç¡¼¥¿ÇÛÎó
+ * Ìá¤êÃÍ	¡§½çÈÖ
+ **************************************************************************************************************/
+function lfGetRowID($arrUpdData, $arrObj){
+	$no = 0; // ¥«¥¦¥ó¥ÈÍÑ¡ÊÆ±¤¸¥Ç¡¼¥¿¤¬É¬¤º1·ï¤¢¤ë¤Î¤Ç¡¢½é´üÃÍ¤Ï0¡Ë
+	
+	// ÂÐ¾Ý¥Ç¡¼¥¿¤¬²¿ÈÖÌÜ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤«¤ò¼èÆÀ¤¹¤ë¡£
+	foreach ($arrUpdData as $key => $val) {
+		if ($val['target_id'] === $arrObj['target_id'] and $val['top'] <= $arrObj['top']){
+			$no++;
+		}
+	}
+	// ÈÖ¹æ¤òÊÖ¤¹
+	return $no;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetRowID
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯ID¤¬²¿ÈÖÌÜ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤«¤òÄ´¤Ù¤ë
+ * °ú¿ô1	¡§$arrUpdData   ¥¥¥ ¹¹¿·¾ðÊó
+ * °ú¿ô2	¡§$arrObj 		¥¥¥ ¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¥Ç¡¼¥¿ÇÛÎó
+ * Ìá¤êÃÍ	¡§½çÈÖ
+ **************************************************************************************************************/
+function lfSetPreData($arrPageData){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrUpdData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	$filename = uniqid("");
+
+	$arrPreData = lfgetPageData(" page_id = ? " , array(0));
+
+	// tpl¥Õ¥¡¥¤¥ë¤Îºï½ü
+	$del_tpl = ROOT_DIR . USER_DIR . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+	if (file_exists($del_tpl)){
+		unlink($del_tpl);	
+	}
+	
+	// tpl¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+	copy(ROOT_DIR . $arrPageData[0]['tpl_dir'].$arrPageData[0]['filename'].".tpl", ROOT_DIR . USER_DIR."templates/".$filename.".tpl");
+	
+	// db¥Ç¡¼¥¿¤Î¥³¥Ô¡¼
+	$sql = " update dtb_pagelayout set ";
+	$sql .= "     page_name = (select page_name from dtb_pagelayout where page_id = ?)";
+	$sql .= "     ,header_chk = (select header_chk from dtb_pagelayout where page_id = ?)";
+	$sql .= "     ,footer_chk = (select footer_chk from dtb_pagelayout where page_id = ?)";
+	$sql .= "     ,url = ?";
+	$sql .= "     ,tpl_dir = ?";
+	$sql .= "     ,filename = ?";
+	$sql .= " where page_id = 0";
+	
+	$arrUpdData = array($arrPageData[0]['page_id']
+						,$arrPageData[0]['page_id']
+						,$arrPageData[0]['page_id']
+						,USER_DIR."templates/"
+						,USER_DIR."templates/"
+						,$filename
+						);
+	
+	$objDBConn->query($sql,$arrUpdData);
+}
Index: /temp/trunk/html/admin/design/css.php
===================================================================
--- /temp/trunk/html/admin/design/css.php	(revision 1328)
+++ /temp/trunk/html/admin/design/css.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/css.tpl';
+		$this->tpl_subnavi 	= 'design/subnavi.tpl';
+		$this->area_row = 30;
+		$this->tpl_subno = "css";
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = 'CSSÊÔ½¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$css_path = ROOT_DIR . USER_DIR . "css/contents.css";
+
+// ¥Ç¡¼¥¿¹¹¿·½èÍý
+if ($_POST['mode'] == 'confirm'){
+	// ¥×¥ì¥Ó¥å¡¼ÍÑ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ñ¤­¹þ¤ß	
+	$fp = fopen($css_path,"w");
+	fwrite($fp, $_POST['css']);
+	fclose($fp);
+	
+	$objPage->tpl_onload="alert('ÊÔ½¸¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+}
+
+// CSS¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+if(file_exists($css_path)){
+	$css_data = file_get_contents($css_path);
+}
+
+// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤ËÉ½¼¨
+$objPage->css_data = $css_data;
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
Index: /temp/trunk/html/admin/design/header.php
===================================================================
--- /temp/trunk/html/admin/design/header.php	(revision 1328)
+++ /temp/trunk/html/admin/design/header.php	(revision 1328)
@@ -0,0 +1,78 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/header.tpl';
+		$this->tpl_subnavi 	= 'design/subnavi.tpl';
+		$this->header_row = 13;
+		$this->footer_row = 13;
+		$this->tpl_subno = "header";
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Ø¥Ã¥À¡¼¥¥Õ¥Ã¥¿¡¼ÊÔ½¸';
+		$this->tpl_onload = 'comment_start(); comment_end();';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$division = $_POST['division'];
+$tpl_DIR = ROOT_DIR . INCLUDE_DIR;
+$pre_DIR = ROOT_DIR . INCLUDE_DIR. 'preview/';
+
+// ¥Ç¡¼¥¿¹¹¿·½èÍý
+if ($division != ''){
+	// ¥×¥ì¥Ó¥å¡¼ÍÑ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ñ¤­¹þ¤ß	
+	$fp = fopen($pre_DIR.$division.'.tpl',"w");
+	fwrite($fp, $_POST[$division]);
+	fclose($fp);
+
+	// ÅÐÏ¿»þ¤Ï¥×¥ì¥Ó¥å¡¼ÍÑ¥Æ¥ó¥×¥ì¡¼¥È¤ò¥³¥Ô¡¼¤¹¤ë
+	if ($_POST['mode'] == 'confirm'){
+		copy($pre_DIR.$division.".tpl", $tpl_DIR.$division.".tpl");
+	}
+
+	// ¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß(¥×¥ì¥Ó¥å¡¼¥Ç¡¼¥¿)
+	$header_data = file_get_contents($pre_DIR . "header.tpl");
+	
+	// ¥Õ¥Ã¥¿¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß(¥×¥ì¥Ó¥å¡¼¥Ç¡¼¥¿)
+	$footer_data = file_get_contents($pre_DIR . "footer.tpl");
+	
+}else{
+	// post¤Ç¥Ç¡¼¥¿¤¬ÅÏ¤µ¤ì¤Ê¤±¤ì¤Ð¿·µ¬ÆÉ¤ß¹þ¤ß¤ÈÈ½ÃÇ¤ò¤·¡¢¥×¥ì¥Ó¥å¡¼ÍÑ¥Ç¡¼¥¿¤òÀµµ¬¤Î¥Ç¡¼¥¿¤Ç¾å½ñ¤­¤¹¤ë
+	copy($tpl_DIR . "header.tpl", $pre_DIR . "header.tpl");
+	copy($tpl_DIR . "footer.tpl", $pre_DIR . "footer.tpl");
+	
+	// ¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$header_data = file_get_contents($tpl_DIR . "header.tpl");
+	// ¥Õ¥Ã¥¿¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$footer_data = file_get_contents($tpl_DIR . "footer.tpl");
+
+}
+
+// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤ËÉ½¼¨
+$objPage->header_data = $header_data;
+$objPage->footer_data = $footer_data;
+
+if ($_POST['header_row'] != ''){
+	$objPage->header_row = $_POST['header_row'];
+}
+
+if ($_POST['footer_row'] != ''){
+	$objPage->footer_row = $_POST['footer_row'];
+}
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
Index: /temp/trunk/html/admin/design/main_edit.php
===================================================================
--- /temp/trunk/html/admin/design/main_edit.php	(revision 1328)
+++ /temp/trunk/html/admin/design/main_edit.php	(revision 1328)
@@ -0,0 +1,334 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/main_edit.tpl';
+		$this->tpl_subnavi 	= 'design/subnavi.tpl';
+		$this->user_URL	 	= USER_URL;
+		$this->text_row 	= 13;
+		$this->tpl_subno = "main_edit";
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Ú¡¼¥¸ÊÔ½¸';
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ú¡¼¥¸°ìÍ÷¤ò¼èÆÀ
+$objPage->arrPageList = lfgetPageData();
+
+// ¥Ö¥í¥Ã¥¯ID¤ò¼èÆÀ
+if (isset($_POST['page_id'])) {
+	$page_id = $_POST['page_id'];
+}else if ($_GET['page_id']){
+	$page_id = $_GET['page_id'];
+}else{
+	$page_id = '';
+}
+
+$objPage->page_id = $page_id;
+
+// page_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤Î¼èÆÀ
+if (is_numeric($page_id) and $page_id != '') {
+	$arrPageData = lfgetPageData(" page_id = ? " , array($page_id));
+
+	if ($arrPageData[0]['tpl_dir'] === "") {
+		$objPage->arrErr['page_id_err'] = "¢¨ »ØÄê¤µ¤ì¤¿¥Ú¡¼¥¸¤ÏÊÔ½¸¤Ç¤­¤Þ¤»¤ó¡£";
+		// ²èÌÌ¤ÎÉ½¼¨
+		$objView->assignobj($objPage);
+		$objView->display(MAIN_FRAME);
+		exit;
+	}
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Æ¤¤¤ì¤ÐÆÉ¤ß¹þ¤à
+	$tpl_file = ROOT_DIR . $arrPageData[0]['tpl_dir'] . $arrPageData[0]['filename'] . ".tpl";
+	if (file_exists($tpl_file)){
+		$arrPageData[0]['tpl_data'] = file_get_contents($tpl_file);		
+	}
+	
+	// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍÊÑ¹¹
+	$arrPageData[0]['header_chk'] = sfChangeCheckBox($arrPageData[0]['header_chk'], true);
+	$arrPageData[0]['footer_chk'] = sfChangeCheckBox($arrPageData[0]['footer_chk'], true);
+
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤ò²èÌÌÉ½¼¨ÍÑ¤ËÊÔ½¸
+	$arrPageData[0]['directory'] = str_replace( USER_DIR,'', $arrPageData[0]['php_dir']);
+	
+	$objPage->arrPageData = $arrPageData[0];
+}
+
+// ¥×¥ì¥Ó¥å¡¼½èÍý
+if ($_POST['mode'] == 'preview') {
+	
+	$page_id_old = $page_id;
+	$page_id = 0;
+	$url = uniqid("");
+
+	$_POST['page_id'] = $page_id;
+	$_POST['url'] = $url;
+	
+	$arrPreData = lfgetPageData(" page_id = ? " , array($page_id));
+
+	// tpl¥Õ¥¡¥¤¥ë¤Îºï½ü
+	$del_tpl = ROOT_DIR . USER_DIR . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+	if (file_exists($del_tpl)){
+		unlink($del_tpl);	
+	}
+	
+	// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+	lfEntryPageData($_POST);
+
+	// TPL¥Õ¥¡¥¤¥ëºîÀ®
+	$cre_tpl = ROOT_DIR . USER_DIR . "templates/" . $url . '.tpl';
+	lfCreateFile($cre_tpl);
+	
+	// blocposition ¤òºï½ü
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = 'delete from dtb_blocposition where page_id = 0';
+	$ret = $objDBConn->query($sql);
+	
+	if ($page_id_old != "") {
+		// blocposition ¤òÊ£À½
+		$sql = " insert into dtb_blocposition ";
+		$sql .= " select ";
+		$sql .= "     0,";
+		$sql .= "     target_id,";
+		$sql .= "     bloc_id,";
+		$sql .= "     bloc_row";
+		$sql .= " from dtb_blocposition";
+		$sql .= " where page_id = ?";
+		$ret = $objDBConn->query($sql,array($page_id_old));
+	}
+	
+	$_SESSION['preview'] = "ON";
+	
+	header("location: /preview/index.php");
+}
+
+// ¥Ç¡¼¥¿ÅÐÏ¿½èÍý
+if ($_POST['mode'] == 'confirm') {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($_POST);
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¹¹¿·½èÍý¤ò¹Ô¤¦	
+	if (count($objPage->arrErr) == 0) {
+
+		// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+		lfEntryPageData($_POST);
+		
+		// ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Ç¤Ê¤±¤ì¤Ð¥Õ¥¡¥¤¥ë¤òºï½ü¤·¡¢PHP¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë
+		if (!lfCheckBaseData($page_id)) {
+			// ¥Õ¥¡¥¤¥ëºï½ü
+			lfDelFile($arrPageData[0]);
+			
+			// PHP¥Õ¥¡¥¤¥ëºîÀ®
+			// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+			$cre_php = ROOT_DIR . USER_DIR . $_POST['url'];
+
+			if (!is_dir(dirname($cre_php))) {
+				mkdir(dirname($cre_php));
+			}
+			copy(USER_DEF_PHP, $cre_php . ".php");
+		}
+
+		// TPL¥Õ¥¡¥¤¥ëºîÀ®
+		$cre_tpl = dirname( ROOT_DIR . USER_DIR . "templates/" . $_POST['url']) . "/" . basename($_POST['url']) . '.tpl';
+
+		lfCreateFile($cre_tpl);
+
+		// ÊÔ½¸²ÄÇ½¥Ú¡¼¥¸¤Î¾ì¹ç¤Ë¤Î¤ß½èÍý¤ò¹Ô¤¦
+		if ($arrPageData[0]['edit_flg'] != 2) {
+			// ¿·µ¬ºîÀ®¤·¤¿¾ì¹ç¤Î¤¿¤á¤Ë²þ¤Ë¥Ú¡¼¥¸ID¤ò¼èÆÀ¤¹¤ë
+			$arrPageData = lfgetPageData(" url = ? " , array(USER_URL.$_POST['url'].".php"));
+			$page_id = $arrPageData[0]['page_id'];
+		}
+
+		header("location: ./main_edit.php?page_id=$page_id");
+	}else{
+		// ¥¨¥é¡¼¤¬¤¢¤ì¤ÐÆþÎÏ»þ¤Î¥Ç¡¼¥¿¤òÉ½¼¨¤¹¤ë
+		$objPage->arrPageData = $_POST;
+		$objPage->arrPageData['header_chk'] = sfChangeCheckBox(sfChangeCheckBox($_POST['header_chk']), true);
+		$objPage->arrPageData['footer_chk'] = sfChangeCheckBox(sfChangeCheckBox($_POST['footer_chk']), true);
+		$objPage->arrPageData['directory'] = $_POST['url'];
+		$objPage->arrPageData['filename'] = "";
+	}
+}
+
+// ¥Ç¡¼¥¿ºï½ü½èÍý ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Ç¤Ê¤±¤ì¤Ð¥Õ¥¡¥¤¥ë¤òºï½ü
+if ($_POST['mode'] == 'delete' and 	!lfCheckBaseData($page_id)) {
+	lfDelPageData($_POST['page_id']);
+}
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfEntryPageData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿··ë²Ì
+ **************************************************************************************************************/
+function lfEntryPageData($arrData){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrUpdData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	$arrChk = array();				// ÇÓÂ¾¥Á¥§¥Ã¥¯ÍÑ
+
+	// ¹¹¿·¥Ç¡¼¥¿À¸À®
+	$arrUpdData = lfGetUpdData($arrData);
+	
+	// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+	if($arrData['page_id'] !== ''){
+		$arrChk = lfgetPageData(" page_id = ?", array($arrData['page_id']));
+	}
+
+	// page_id ¤¬¶õ ¼ã¤·¤¯¤Ï ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤ÏINSERT¤ò¹Ô¤¦
+	if ($arrData['page_id'] === '' or !isset($arrChk[0])) {
+		// SQLÀ¸À®
+		$sql = " INSERT INTO dtb_pagelayout ";
+		$sql .= " ( ";
+		$sql .= " 	  page_name";
+		$sql .= "	  ,url";
+		$sql .= "	  ,php_dir";
+		$sql .= "	  ,tpl_dir";
+		$sql .= "	  ,filename";
+		$sql .= "	  ,header_chk";
+		$sql .= "	  ,footer_chk";
+		$sql .= "	  ,update_url";
+		$sql .= " ) VALUES ( ?,?,?,?,?,?,?,? )";
+		$sql .= " ";
+	}else{
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤ë¾ì¹ç¤Ë¤Ï¥¢¥Ã¥×¥Ç¡¼¥È¤ò¹Ô¤¦
+		// SQLÀ¸À®
+		$sql = " UPDATE dtb_pagelayout ";
+		$sql .= " SET";
+		$sql .= "	  page_name = ? ";
+		$sql .= "	  ,url = ? ";
+		$sql .= "	  ,php_dir = ? ";
+		$sql .= "	  ,tpl_dir = ? ";
+		$sql .= "	  ,filename = ? ";
+		$sql .= "	  ,header_chk = ? ";
+		$sql .= "	  ,footer_chk = ? ";
+		$sql .= "	  ,update_url = ? ";
+		$sql .= "     ,update_date = now() ";
+		$sql .= " WHERE page_id = ?";
+		$sql .= " ";
+
+		// ¹¹¿·¥Ç¡¼¥¿¤Ë¥Ö¥í¥Ã¥¯ID¤òÄÉ²Ã
+		array_push($arrUpdData, $arrData['page_id']);
+	}
+
+	// SQL¼Â¹Ô
+	$ret = $objDBConn->query($sql,$arrUpdData);
+	
+	return $ret;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetUpdData
+ * ½èÍýÆâÍÆ	¡§DB¤Ø¹¹¿·¤ò¹Ô¤¦¥Ç¡¼¥¿¤òÀ¸À®¤¹¤ë
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿·¥Ç¡¼¥¿
+ **************************************************************************************************************/
+function lfGetUpdData($arrData){
+	
+	// ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Î¾ì¹ç¤Ë¤ÏÊÑ¹¹¤·¤Ê¤¤¡£
+	if (lfCheckBaseData($arrData['page_id'])) {
+		$arrPageData = lfgetPageData( ' page_id = ? ' , array($arrData['page_id']));
+
+		$name = $arrPageData[0]['page_name'] ;
+		$url = $arrPageData[0]['url'];
+		$php_dir = $arrPageData[0]['php_dir'];
+		$tpl_dir = $arrPageData[0]['tpl_dir'];
+		$filename = $arrPageData[0]['filename'];
+	}else{
+		$name = $arrData['page_name'] ;
+		$url = USER_URL.$arrData['url'].".php";
+		$php_dir = dirname(USER_DIR.$arrData['url'])."/";
+		$tpl_dir = dirname(USER_DIR."templates/".$arrData['url'])."/";
+		$filename = basename($arrData['url']);
+	}
+
+	// ¹¹¿·¥Ç¡¼¥¿ÇÛÎó¤ÎºîÀ®
+	$arrUpdData = array(
+					$name										// Ì¾¾Î	
+					,$url										// URL
+					,$php_dir									// PHP¥Ç¥£¥ì¥¯¥È¥ê
+					,$tpl_dir									// TPL¥Ç¥£¥ì¥¯¥È¥ê
+					,$filename									// ¥Õ¥¡¥¤¥ëÌ¾
+					,sfChangeCheckBox($arrData['header_chk'])	// ¥Ø¥Ã¥À¡¼»ÈÍÑ
+					,sfChangeCheckBox($arrData['footer_chk'])	// ¥Õ¥Ã¥¿¡¼»ÈÍÑ
+					,$_SERVER['HTTP_REFERER']					// ¹¹¿·URL
+					);
+					
+	return $arrUpdData;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfErrorCheck
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ÆþÎÏ¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¥¨¥é¡¼¾ðÊó
+ **************************************************************************************************************/
+function lfErrorCheck($array) {
+	global $objPage;
+	
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(array("Ì¾¾Î", "page_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("URL", "url", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+
+	// URL¥Á¥§¥Ã¥¯
+	if (substr(strrev(trim($array['url'])),0,1) == "/") {
+		$objErr->arrErr['url'] = "¢¨ URL¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+	}
+	
+	$check_url = USER_URL . $array['url'] . ".php";
+	if( strlen($array['url']) > 0 && !ereg( "^https?://+($|[a-zA-Z0-9_~=&\?\.\/-])+$", $check_url ) ) {
+		$objErr->arrErr['url'] = "¢¨ URL¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+	}
+
+	// Æ±°ì¤ÎURL¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
+	if(!isset($objErr->arrErr['url']) and $array['url'] !== ''){
+		$arrChk = lfgetPageData(" url = ? " , array(USER_URL . $array['url'].".php"));
+
+		if (count($arrChk[0]) >= 1 and $arrChk[0]['page_id'] != $array['page_id']) {
+			$objErr->arrErr['url'] = '¢¨ Æ±¤¸URL¤Î¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£ÊÌ¤ÎURL¤òÉÕ¤±¤Æ¤¯¤À¤µ¤¤¡£';
+		}
+	}
+	
+	return $objErr->arrErr;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfCreateFile
+ * ½èÍýÆâÍÆ	¡§TPL¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë
+ * °ú¿ô1	¡§$path¥¥¥¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹
+ * Ìá¤êÃÍ	¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfCreateFile($path){
+	
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+	if (!is_dir(dirname($path))) {
+		mkdir(dirname($path));
+	}
+
+	// ¥Õ¥¡¥¤¥ëºîÀ®
+	$fp = fopen($path,"w");
+	fwrite($fp, $_POST['tpl_data']);
+	fclose($fp);	
+}
+
+
Index: /temp/trunk/html/admin/design/template.php
===================================================================
--- /temp/trunk/html/admin/design/template.php	(revision 1328)
+++ /temp/trunk/html/admin/design/template.php	(revision 1328)
@@ -0,0 +1,256 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+	var $arrSubnavi = array(
+		1 => 'top',
+		2 => 'product',
+		3 => 'detail',
+		4 => 'mypage',
+	);
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/template.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno = 'template';
+		$this->tpl_subno_template = $this->arrSubnavi[1];
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Æ¥ó¥×¥ì¡¼¥ÈÁªÂò';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// GET¤ÎÃÍ¤ò¼õ¤±¼è¤ë
+$get_tpl_subno_template = $_GET['tpl_subno_template'];
+
+// GET¤ÇÃÍ¤¬Á÷¤é¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¤½¤ÎÃÍ¤ò¸µ¤Ë²èÌÌÉ½¼¨¤òÀÚ¤êÂØ¤¨¤ë
+if ($get_tpl_subno_template != ""){
+	// Á÷¤é¤ì¤Æ¤­¤¿ÃÍ¤¬ÇÛÎó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐTOP¤òÉ½¼¨
+	if (in_array($get_tpl_subno_template,$objPage->arrSubnavi)){
+		$tpl_subno_template = $get_tpl_subno_template;
+	}else{
+		$tpl_subno_template = $objPage->arrSubnavi[1];
+	}
+} else {
+	// GET¤ÇÃÍ¤¬¤Ê¤±¤ì¤ÐPOST¤ÎÃÍ¤ò»ÈÍÑ¤¹¤ë
+	if ($_POST['tpl_subno_template'] != ""){
+		$tpl_subno_template = $_POST['tpl_subno_template'];
+	}else{
+		$tpl_subno_template = $objPage->arrSubnavi[1];
+	}
+}
+$objPage->tpl_subno_template = $tpl_subno_template;
+
+// ÅÐÏ¿¤ò²¡¤µ¤ì¤¿¤Ð¤¢¤Ë¤ÏDB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤Ë¹Ô¤¯
+if ($_POST['mode'] == "confirm"){
+	// DB¤Ø¥Ç¡¼¥¿¹¹¿·
+	lfUpdData();
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¤Î¾å½ñ¤­
+	lfChangeTemplate();
+}
+
+// POSTÃÍ¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+// ²èÁü¼èÆÀ
+$tpl_arrTemplate = array();
+$objPage->arrTemplate = lfgetTemplate();
+
+// ¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯¼èÆÀ
+$objPage->MainImage = $objPage->arrTemplate['check'];
+$objPage->arrTemplate['check'] = array($objPage->arrTemplate['check']=>"check");
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetTemplate
+ * ½èÍýÆâÍÆ	¡§²èÌÌ¤ËÉ½¼¨¤¹¤ë²èÁü¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§²èÌÌ¤ËÉ½¼¨¤¹¤ë²èÁü(ÇÛÎó)
+ **************************************************************************************************************/
+function lfgetTemplate(){
+	global $arrTemplate;
+	global $objPage;
+	
+	$arrTemplateImage = array();	// ²èÌÌÉ½¼¨²èÁü³ÊÇ¼ÍÑ
+	$Image = "";					// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+	$disp = "";
+	$arrDefcheck = array();			// radio¥Ü¥¿¥ó¤Î¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯³ÊÇ¼ÍÑ
+	
+	// DB¤«¤é¥Ç¡¼¥¿¼èÆÀ
+	$arrDefcheck = lfgetTemplaeData();
+
+	switch($objPage->tpl_subno_template) {
+		// TOP
+		case $objPage->arrSubnavi[1]:
+			$Image = "TopImage";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi[1];
+			break;
+			
+		// ¾¦ÉÊ°ìÍ÷
+		case $objPage->arrSubnavi[2]:
+			$Image = "ProdImage";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi[2];
+			break;
+			
+		// ¾¦ÉÊ¾ÜºÙ
+		case $objPage->arrSubnavi[3]:
+			$Image = "DetailImage";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi[3];
+			break;
+			
+		// MY¥Ú¡¼¥¸
+		case $objPage->arrSubnavi[4]:
+			$Image = "MypageImage";			//¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi[4];
+			break;
+	}
+		
+	// ²èÁüÉ½¼¨ÇÛÎóºîÀ®
+	foreach($arrTemplate as $key => $val){
+		$arrTemplateImage['image'][$key] = $val[$Image];
+	}
+
+	// ½é´ü¥Á¥§¥Ã¥¯
+	if (isset($arrDefcheck[$disp])){
+		$arrTemplateImage['check'] = $arrDefcheck[$disp];
+	}else{
+		$arrTemplateImage['check'] = 1;
+	}
+	
+	return $arrTemplateImage;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetTemplaeData
+ * ½èÍýÆâÍÆ	¡§DB¤ËÊÝÂ¸¤µ¤ì¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§DB¤ËÊÝÂ¸¤µ¤ì¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿(ÇÛÎó)
+ **************************************************************************************************************/
+function lfgetTemplaeData(){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	$sql = "SELECT top_tpl AS top, product_tpl AS product, detail_tpl AS detail, mypage_tpl AS mypage FROM dtb_baseinfo";
+	$arrRet = $objDBConn->getAll($sql);
+	
+	return $arrRet[0];
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdData
+ * ½èÍýÆâÍÆ	¡§DB¤Ë¥Ç¡¼¥¿¤òÊÝÂ¸¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§À®¸ù TRUE¡¢¥¨¥é¡¼ FALSE
+ **************************************************************************************************************/
+function lfUpdData(){
+	global $objPage;
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ(¹¹¿·È½Äê)
+
+	// ¥Ç¡¼¥¿¼èÆÀ	
+	$sql = "SELECT top_tpl AS top, product_tpl AS product, detail_tpl AS detail, mypage_tpl AS mypage FROM dtb_baseinfo";
+	$arrRet = $objDBConn->getAll($sql);
+
+	$chk_tpl = $_POST['check_template'];
+	// ¥Ç¡¼¥¿¤¬¼èÆÀ¤Ç¤­¤Ê¤±¤ì¤ÐINSERT¡¢¤Ç¤­¤ì¤ÐUPDATE
+	if (isset($arrRet[0])){
+		// UPDATE
+		$arrVal = $arrRet[0];
+		
+		// TOP¤òÊÑ¹¹¤·¤¿¾ì¹ç¤Ë¤ÏÁ´²èÌÌÊÑ¹¹
+		if ($objPage->tpl_subno_template == $objPage->arrSubnavi[1]){
+			$arrVal = array($chk_tpl,$chk_tpl,$chk_tpl,$chk_tpl);
+		}else{
+			$arrVal[$objPage->tpl_subno_template] = $chk_tpl;
+		}
+		$sql= "update dtb_baseinfo set top_tpl = ?, product_tpl = ?, detail_tpl = ?, mypage_tpl = ?, update_date = now()";
+	}else{
+		// INSERT
+		$arrVal = array(null,null,null,null);
+		
+		// TOP¤òÊÑ¹¹¤·¤¿¾ì¹ç¤Ë¤ÏÁ´²èÌÌÊÑ¹¹
+		if ($objPage->tpl_subno_template == $objPage->arrSubnavi[1]){
+			$arrVal = array($chk_tpl,$chk_tpl,$chk_tpl,$chk_tpl);
+		}else{
+			$arrVal[$chk_tpl-1] =$chk_tpl;
+		}
+		$sql= "insert into dtb_baseinfo (top_tpl,product_tpl,detail_tpl,mypage_tpl, update_date) values (?,?,?,?,now());";
+	}
+
+	// SQL¼Â¹Ô	
+	$arrRet = $objDBConn->query($sql,$arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfChangeTemplate
+ * ½èÍýÆâÍÆ	¡§¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§À®¸ù TRUE¡¢¥¨¥é¡¼ FALSE
+ **************************************************************************************************************/
+function lfChangeTemplate(){
+	global $arrTemplate;
+	global $objPage;
+	
+	$tpl_name = "";
+	$tpl_element = "";
+	
+	$chk_tpl = $_POST['check_template'];
+	
+	switch($objPage->tpl_subno_template) {
+		// TOP
+		case $objPage->arrSubnavi[1]:
+			$tpl_element = "TopTemplate";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "top.tpl";
+			break;
+			
+		// ¾¦ÉÊ°ìÍ÷
+		case $objPage->arrSubnavi[2]:
+			$tpl_element = "ProdTemplate";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "product.tpl";
+			break;
+			
+		// ¾¦ÉÊ¾ÜºÙ
+		case $objPage->arrSubnavi[3]:
+			$tpl_element = "DetailTemplate";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "detail.tpl";
+			break;
+			
+		// MY¥Ú¡¼¥¸
+		case $objPage->arrSubnavi[4]:
+			$tpl_element = "MypageTemplate";			//¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "mypage.tpl";
+			break;
+	}
+	
+	// TOP¤òÊÑ¹¹¤·¤¿¾ì¹ç¤Ë¤ÏÁ´²èÌÌÊÑ¹¹
+	if ($objPage->tpl_subno_template == $objPage->arrSubnavi[1]){
+		// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		copy($arrTemplate[$chk_tpl]["TopTemplate"], ROOT_DIR . INCLUDE_DIR . "top.tpl");
+		copy($arrTemplate[$chk_tpl]["ProdTemplate"], ROOT_DIR . INCLUDE_DIR . "product.tpl");
+		copy($arrTemplate[$chk_tpl]["DetailTemplate"], ROOT_DIR . INCLUDE_DIR . "detail.tpl");
+		copy($arrTemplate[$chk_tpl]["MypageTemplate"], ROOT_DIR . INCLUDE_DIR . "mypage.tpl");
+	}else{
+		// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		copy($arrTemplate[$chk_tpl][$tpl_element], ROOT_DIR . INCLUDE_DIR . $tpl_name);
+	}
+}
Index: /temp/trunk/html/admin/design/bloc.php
===================================================================
--- /temp/trunk/html/admin/design/bloc.php	(revision 1328)
+++ /temp/trunk/html/admin/design/bloc.php	(revision 1328)
@@ -0,0 +1,238 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/bloc.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno_edit = 'bloc';
+		$this->text_row = 13;
+		$this->tpl_subno = "bloc";	
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Ö¥í¥Ã¥¯ÊÔ½¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ö¥í¥Ã¥¯°ìÍ÷¤ò¼èÆÀ
+$objPage->arrBlocList = lfgetBlocData();
+
+// ¥Ö¥í¥Ã¥¯ID¤ò¼èÆÀ
+if (isset($_POST['bloc_id'])) {
+	$bloc_id = $_POST['bloc_id'];
+}else if ($_GET['bloc_id']){
+	$bloc_id = $_GET['bloc_id'];
+}else{
+	$bloc_id = '';
+}
+$objPage->bloc_id = $bloc_id;
+
+// bloc_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤Î¼èÆÀ
+if ($bloc_id != '') {
+	$arrBlocData = lfgetBlocData(" bloc_id = ? " , array($bloc_id));
+	$arrBlocData[0]['tpl_path'] = ROOT_DIR . $arrBlocData[0]['tpl_path'];
+
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$arrBlocData[0]['tpl_data'] = file_get_contents($arrBlocData[0]['tpl_path']);
+	$objPage->arrBlocData = $arrBlocData[0];
+}
+
+// ¥Ç¡¼¥¿ÅÐÏ¿½èÍý
+if ($_POST['mode'] == 'confirm') {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($_POST);
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¹¹¿·½èÍý¤ò¹Ô¤¦	
+	if (count($objPage->arrErr) == 0) {
+	
+		
+		// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+		lfEntryBlocData($_POST);
+		
+		// ¥Õ¥¡¥¤¥ë¤Îºï½ü
+		$del_file=ROOT_DIR . BLOC_DIR . $arrBlocData[0]['filename']. '.tpl';
+		if (file_exists($del_file)) {
+			unlink($del_file);
+		}
+		
+		// ¥Õ¥¡¥¤¥ëºîÀ®
+		$fp = fopen(ROOT_DIR . BLOC_DIR . $_POST['filename'] . '.tpl',"w");
+		fwrite($fp, $_POST['bloc_html']);
+		fclose($fp);
+		
+		$arrBlocData = lfgetBlocData(" filename = ? " , array($_POST['filename']));
+			
+		$bloc_id = $arrBlocData[0]['bloc_id'];	
+		header("location: ./bloc.php?bloc_id=$bloc_id");
+	}else{
+		// ¥¨¥é¡¼¤¬¤¢¤ì¤ÐÆþÎÏ»þ¤Î¥Ç¡¼¥¿¤òÉ½¼¨¤¹¤ë
+		$objPage->arrBlocData = $_POST;
+	}
+}
+
+// ¥Ç¡¼¥¿ºï½ü½èÍý
+if ($_POST['mode'] == 'delete') {
+	
+	// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrDelData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	
+	// ¹¹¿·¥Ç¡¼¥¿À¸À®
+	$arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
+	
+	// bloc_id ¤¬¶õ¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ïdelete¤ò¼Â¹Ô
+	if ($_POST['bloc_id'] !== '') {
+		// SQLÀ¸À®
+		$sql = " DELETE FROM dtb_bloc WHERE bloc_id = ?";
+		// SQL¼Â¹Ô
+		$ret = $objDBConn->query($sql,array($_POST['bloc_id']));
+		
+		// ¥Ú¡¼¥¸¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¥Ç¡¼¥¿¤âºï½ü¤¹¤ë
+		$sql = "DELETE FROM dtb_blocposition WHERE bloc_id = ?";
+		// SQL¼Â¹Ô
+		$ret = $objDBConn->query($sql,array($_POST['bloc_id']));
+	
+		// ¥Õ¥¡¥¤¥ë¤Îºï½ü
+		$del_file = ROOT_DIR . BLOC_DIR . $arrBlocData[0]['filename']. '.tpl';
+		if(file_exists($del_file)){
+			unlink($del_file);
+		}
+	}
+
+	header("location: ./bloc.php");
+}
+
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$where  ¥¥¥ Where¶çÊ¸
+ * °ú¿ô2	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+ * Ìá¤êÃÍ	¡§¥Ö¥í¥Ã¥¯¾ðÊó
+ **************************************************************************************************************/
+function lfgetBlocData($where = '', $arrVal = ''){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// SQLÀ¸À®
+	$sql = " SELECT ";
+	$sql .= "	bloc_id";
+	$sql .= "	,bloc_name";
+	$sql .= "	,tpl_path";
+	$sql .= "	,filename";
+	$sql .= " 	,create_date";
+	$sql .= " 	,update_date";
+	$sql .= " 	,php_path";
+	$sql .= " FROM ";
+	$sql .= " 	dtb_bloc";
+
+	// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($where != '') {
+		$sql .= " WHERE " . $where;
+	}
+	
+	$sql .= " ORDER BY 	bloc_id";
+	
+	$arrRet = $objDBConn->getAll($sql, $arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfEntryBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿··ë²Ì
+ **************************************************************************************************************/
+function lfEntryBlocData($arrData){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrUpdData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	$arrChk = array();				// ÇÓÂ¾¥Á¥§¥Ã¥¯ÍÑ
+	
+	// ¹¹¿·¥Ç¡¼¥¿À¸À®
+	$arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
+	
+	// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+	if($arrData['bloc_id'] !== ''){
+		$arrChk = lfgetBlocData("bloc_id = ?", array($arrData['bloc_id']));
+	}
+	
+	// bloc_id ¤¬¶õ ¼ã¤·¤¯¤Ï ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤ÏINSERT¤ò¹Ô¤¦
+	if ($arrData['bloc_id'] === '' or !isset($arrChk[0])) {
+		// SQLÀ¸À®
+		$sql = " INSERT INTO dtb_bloc";
+		$sql .= " ( ";
+		$sql .= "     bloc_name ";		// ¥Ö¥í¥Ã¥¯Ì¾¾Î
+		$sql .= "     ,tpl_path ";		// ¥Æ¥ó¥×¥ì¡¼¥ÈÊÝÂ¸Àè
+		$sql .= "     ,filename ";		// ¥Õ¥¡¥¤¥ëÌ¾¾Î
+		$sql .= " ) VALUES ( ?,?,? )";
+		$sql .= " ";
+	}else{
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤ë¾ì¹ç¤Ë¤Ï¥¢¥Ã¥×¥Ç¡¼¥È¤ò¹Ô¤¦
+		// SQLÀ¸À®
+		$sql = " UPDATE dtb_bloc";
+		$sql .= " SET";
+		$sql .= "     bloc_name = ? ";	// ¥Ö¥í¥Ã¥¯Ì¾¾Î
+		$sql .= "     ,tpl_path = ? ";	// ¥Æ¥ó¥×¥ì¡¼¥ÈÊÝÂ¸Àè
+		$sql .= "     ,filename = ? ";	// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÌ¾
+		$sql .= "     ,update_date = now()";
+		$sql .= " WHERE bloc_id = ?";
+		$sql .= " ";
+		
+		// ¹¹¿·¥Ç¡¼¥¿¤Ë¥Ö¥í¥Ã¥¯ID¤òÄÉ²Ã
+		array_push($arrUpdData, $arrData['bloc_id']);
+	}
+	
+	// SQL¼Â¹Ô
+	$ret = $objDBConn->query($sql,$arrUpdData);
+	
+	return $ret;
+
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfErrorCheck
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ÆþÎÏ¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¥¨¥é¡¼¾ðÊó
+ **************************************************************************************************************/
+function lfErrorCheck($array) {
+	global $objPage;
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥Ö¥í¥Ã¥¯Ì¾", "bloc_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥¡¥¤¥ëÌ¾", "filename", STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK"));
+	
+	// Æ±°ì¤Î¥Õ¥¡¥¤¥ëÌ¾¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
+	if(!isset($objErr->arrErr['filename']) and $array['filename'] !== ''){
+		$arrChk = lfgetBlocData("filename = ?", array($array['filename']));
+		
+		if (count($arrChk[0]) >= 1 and $arrChk[0]['bloc_id'] != $array['bloc_id']) {
+			$objErr->arrErr['filename'] = '¢¨ Æ±¤¸¥Õ¥¡¥¤¥ëÌ¾¤Î¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£ÊÌ¤ÎÌ¾¾Î¤òÉÕ¤±¤Æ¤¯¤À¤µ¤¤¡£';
+		}
+	}
+	
+	return $objErr->arrErr;
+}
Index: /temp/trunk/html/admin/order/index_csv.php
===================================================================
--- /temp/trunk/html/admin/order/index_csv.php	(revision 1328)
+++ /temp/trunk/html/admin/order/index_csv.php	(revision 1328)
@@ -0,0 +1,58 @@
+<?php
+require_once(ROOT_DIR."data/include/csv_output.inc");
+/*------  /admin/contents/inpuiry.php ¤«¤é¤â¸Æ¤Ó½Ð¤·¤Þ¤¹¡£(11/18 fukuda) ---*/
+
+// CSV½ÐÎÏ¥Ç¡¼¥¿¤òºîÀ®¤¹¤ë¡£
+function lfGetCSV($from, $where, $option, $arrval, $arrCsvOutputCols = "") {
+	global $arrCVSCOL;
+
+	//$cols = sfGetCommaList($arrCVSCOL);
+	$cols = sfGetCommaList($arrCsvOutputCols);
+	
+	$objQuery = new SC_Query();
+	$objQuery->setoption($option);
+	
+	$list_data = $objQuery->select($cols, $from, $where, $arrval);	
+
+	$max = count($list_data);
+	for($i = 0; $i < $max; $i++) {
+		// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+		$data .= lfMakeCSV($list_data[$i]);
+	}
+	return $data;
+}
+
+// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+function lfMakeCSV($list) {
+	global $arrPref;
+	global $arrJob;
+	global $arrORDERSTATUS;
+	
+	$line = "";
+	
+	foreach($list as $key => $val) {
+		$tmp = "";
+		switch($key) {
+		case 'order_pref':
+			$tmp = $arrPref[$val];
+			break;
+		case 'order_job':
+			$tmp = $arrJob[$val];
+			break;
+		case 'status':
+			$tmp = $arrORDERSTATUS[$val];
+			break;
+		default:
+			$tmp = $val;
+			break;
+		}
+
+		$tmp = ereg_replace("[\",]", " ", $tmp);
+		$line .= "\"".$tmp."\",";
+	}
+	// Ê¸Ëö¤Î","¤òÊÑ´¹
+	$line = ereg_replace(",$", "\n", $line);
+	return $line;
+}
+
+?>
Index: /temp/trunk/html/admin/order/mail.php
===================================================================
--- /temp/trunk/html/admin/order/mail.php	(revision 1328)
+++ /temp/trunk/html/admin/order/mail.php	(revision 1328)
@@ -0,0 +1,110 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/mail.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';		
+		$this->tpl_subno = 'index';
+		$this->tpl_subtitle = '¼õÃí´ÉÍý';
+		global $arrMAILTEMPLATE;
+		$this->arrMAILTEMPLATE = $arrMAILTEMPLATE;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+$objPage->tpl_order_id = $_POST['order_id'];
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+
+switch($_POST['mode']) {
+case 'pre_edit':
+	break;
+case 'return':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($_POST);
+	break;
+case 'send':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($_POST);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = $objFormParam->checkerror();
+	// ¥á¡¼¥ë¤ÎÁ÷¿®
+	if (count($objPage->arrErr) == 0) {
+		// ÃíÊ¸¼õÉÕ¥á¡¼¥ë
+		sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']);
+	}
+	header("Location: " . URL_SEARCH_ORDER);
+	exit;
+	break;	
+case 'confirm':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($_POST);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	// ÆþÎÏÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrHidden = $objFormParam->getHashArray();
+	$objPage->arrErr = $objFormParam->checkerror();
+	// ¥á¡¼¥ë¤ÎÁ÷¿®
+	if (count($objPage->arrErr) == 0) {
+		// ÃíÊ¸¼õÉÕ¥á¡¼¥ë(Á÷¿®¤Ê¤·)
+		$objSendMail = sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false);
+		// ³ÎÇ§¥Ú¡¼¥¸¤ÎÉ½¼¨
+		$objPage->tpl_subject = $objSendMail->subject;
+		$objPage->tpl_body = $objSendMail->body;
+		$objPage->tpl_to = $objSendMail->tpl_to;
+		$objPage->tpl_mainpage = 'order/mail_confirm.tpl';
+		$objView->assignobj($objPage);
+		$objView->display(MAIN_FRAME);
+		exit;	
+	}
+	break;
+case 'change':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setValue('template_id', $_POST['template_id']);
+	if(sfIsInt($_POST['template_id'])) {
+		$objQuery = new SC_Query();
+		$where = "template_id = ?";
+		$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id']));
+		$objFormParam->setParam($arrRet[0]);
+	}
+	break;
+}
+
+$objQuery = new SC_Query();
+$col = "send_date, subject, template_id, send_id";
+$where = "order_id = ?";
+$objQuery->setorder("send_date DESC");
+
+if(sfIsInt($_POST['order_id'])) {
+	$objPage->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¿¥¤¥È¥ë", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
+	$objFormParam->addParam("¥Ø¥Ã¥À¡¼", "header", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
+	$objFormParam->addParam("¥Õ¥Ã¥¿¡¼", "footer", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
+}
Index: /temp/trunk/html/admin/order/status.php
===================================================================
--- /temp/trunk/html/admin/order/status.php	(revision 1328)
+++ /temp/trunk/html/admin/order/status.php	(revision 1328)
@@ -0,0 +1,149 @@
+<?php
+require_once("../require.php");
+require_once("./index_csv.php");
+
+//¥¹¥Æ¡¼¥¿¥¹´ÉÍý-°ì³ç°ÜÆ°µ¡Ç½
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/status.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';
+		$this->tpl_subno = 'status';
+		global $arrORDERSTATUS;
+		global $arrORDERSTATUS_COLOR;
+		$this->arrORDERSTATUS = $arrORDERSTATUS;
+		$this->arrORDERSTATUS_COLOR = $arrORDERSTATUS_COLOR;
+		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//¥¹¥Æ¡¼¥¿¥¹¾ðÊó¡Ê²¾Äê¡Ë
+$objPage->SelectedStatus = $_POST['status'];
+$objPage->arrForm = $_POST;
+					
+//»ÙÊ§ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+
+switch ($_POST['mode']){
+	
+	case 'search':
+	
+		switch($_POST['change_status']){
+				
+				default:
+				break;
+			
+				//¿·µ¬¼õÉÕ
+				case '1':
+					lfStatusMove(1,$_POST['move']);
+				break;
+				
+				//Æþ¶âÂÔ¤Á
+				case '2':
+					lfStatusMove(2,$_POST['move']);
+				break;
+				
+				//¥­¥ã¥ó¥»¥ë
+				case '3':
+					lfStatusMove(3,$_POST['move']);
+				break;
+				
+				//¼è¤ê´ó¤»Ãæ
+				case '4':
+					lfStatusMove(4,$_POST['move']);
+				break;
+				
+				//È¯Á÷ºÑ¤ß
+				case '5':
+					lfStatusMove(5,$_POST['move']);
+				break;
+				
+				//ºï½ü
+				case 'delete':
+					lfStatusMove("delete",$_POST['move']);
+				break;
+			}
+	
+	//¸¡º÷·ë²Ì¤ÎÉ½¼¨
+	lfStatusDisp($_POST['status'],$_POST['search_pageno']);
+	break;
+	
+	default:
+	//¥Ç¥Õ¥©¥ë¥È¤Ç¿·µ¬¼õÉÕ°ìÍ÷É½¼¨
+	lfStatusDisp(1,$_POST['search_pageno']);
+	$objPage->defaultstatus = 1;
+	break;
+	}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+//¥¹¥Æ¡¼¥¿¥¹°ìÍ÷¤ÎÉ½¼¨
+function lfStatusDisp($status,$pageno){
+	global $objPage;
+	global $objQuery;
+	
+	$select ="*";
+	$from = "dtb_order";
+	$where="delete=0 AND status=?";
+	$order = "order_id DESC";
+	
+	$linemax = $objQuery->count("dtb_order", "delete = 0 AND status=?", array($status));
+	$objPage->tpl_linemax = $linemax;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	$page_max = ORDER_STATUS_MAX;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($pageno, $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	$objPage->tpl_pageno = $pageno;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+	
+	//É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	
+	//¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrStatus = $objQuery->select($select, $from, $where, array($status));
+	
+	return $objPage;
+}
+
+//¥¹¥Æ¡¼¥¿¥¹¾ðÊó¤Î¹¹¿·¡Ê°ÜÆ°¡Ë
+function lfStatusMove($status_id,$move){
+	global $objQuery;
+	global $objPage;
+	
+	if ($status_id == 'delete'){
+		$sql="UPDATE dtb_order SET delete=1";
+	}elseif ($status_id == 5){
+		$sql="UPDATE dtb_order SET status=".$status_id.",commit_date=now() ";
+	}else{
+		$sql="UPDATE dtb_order SET status=".$status_id." ";
+	}
+		$sql.="WHERE order_id=?";
+		if (isset($move)){
+			foreach ($move as $val){
+			$objQuery->exec($sql, array($val));
+			$objPage->tpl_onload = "window.alert('ÁªÂò¹àÌÜ¤ò°ÜÆ°¤·¤Þ¤·¤¿¡£');";
+			}
+		}
+}
+
+?>
Index: /temp/trunk/html/admin/order/edit.php
===================================================================
--- /temp/trunk/html/admin/order/edit.php	(revision 1328)
+++ /temp/trunk/html/admin/order/edit.php	(revision 1328)
@@ -0,0 +1,299 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/edit.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';		
+		$this->tpl_subno = 'index';
+		$this->tpl_subtitle = '¼õÃí´ÉÍý';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrORDERSTATUS;
+		$this->arrORDERSTATUS = $arrORDERSTATUS;
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;
+	}
+}
+
+// É½¼¨¥â¡¼¥ÉÈ½Äê
+if(sfIsInt($_GET['order_id'])) {
+	$objPage->disp_mode = true;
+	$order_id = $_GET['order_id'];
+} else {
+	$order_id = $_POST['order_id'];
+}
+$objPage->tpl_order_id = $order_id;
+
+// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
+lfGetOrderData($order_id);
+
+switch($_POST['mode']) {
+case 'pre_edit':
+case 'order_id':
+	break;
+case 'edit':
+	// POST¾ðÊó¤Ç¾å½ñ¤­
+	$objFormParam->setParam($_POST);
+	
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfCheek($arrInfo);
+		if(count($objPage->arrErr) == 0) {
+			lfRegistData($_POST['order_id']);
+			// DB¤«¤é¼õÃí¾ðÊó¤òºÆÆÉ¹þ
+			lfGetOrderData($order_id);
+			$objPage->tpl_onload = "window.alert('¼õÃíÍúÎò¤òÊÔ½¸¤·¤Þ¤·¤¿¡£');";
+		}
+	}
+	break;
+// ºÆ·×»»
+case 'cheek':
+	// POST¾ðÊó¤Ç¾å½ñ¤­
+	$objFormParam->setParam($_POST);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfCheek($arrInfo);
+	}
+	break;
+default:
+	break;
+}
+
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+$arrRet = sfGetDelivTime($objFormParam->getValue('payment_id'));
+$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'time');
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objPage->arrInfo = $arrInfo;
+$objView->assignobj($objPage);
+// É½¼¨¥â¡¼¥ÉÈ½Äê
+if(!$objPage->disp_mode) {
+	$objView->display(MAIN_FRAME);
+} else {
+	$objView->display('order/disp.tpl');
+}
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	// ÇÛÁ÷Àè¾ðÊó
+	$objFormParam->addParam("¤ªÌ¾Á°1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	// ¼õÃí¾¦ÉÊ¾ðÊó
+	$objFormParam->addParam("ÃÍ°ú¤­", "discount", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¼ê¿ôÎÁ", "charge", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¥Ý¥¤¥ó¥È", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤ª»ÙÊ§¤¤ÊýË¡", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÇÛÁ÷»þ´ÖID", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÂÐ±þ¾õ¶·", "status", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÇÛÃ£Æü", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	// ¼õÃí¾ÜºÙ¾ðÊó
+	$objFormParam->addParam("Ã±²Á", "price", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¸Ä¿ô", "quantity", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¾¦ÉÊID", "product_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate");
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code");
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "product_name");
+	$objFormParam->addParam("µ¬³Ê1", "classcategory_id1");
+	$objFormParam->addParam("µ¬³Ê2", "classcategory_id2");
+	$objFormParam->addParam("µ¬³ÊÌ¾1", "classcategory_name1");
+	$objFormParam->addParam("µ¬³ÊÌ¾2", "classcategory_name2");
+	$objFormParam->addParam("¥á¥â", "note", MTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	// DBÆÉ¹þÍÑ
+	$objFormParam->addParam("¾®·×", "subtotal");
+	$objFormParam->addParam("¹ç·×", "total");
+	$objFormParam->addParam("»ÙÊ§¤¤¹ç·×", "payment_total");
+	$objFormParam->addParam("²Ã»»¥Ý¥¤¥ó¥È", "add_point");
+	$objFormParam->addParam("¤ªÃÂÀ¸Æü¥Ý¥¤¥ó¥È", "birth_point");
+	$objFormParam->addParam("¾ÃÈñÀÇ¹ç·×", "tax");
+	$objFormParam->addParam("ºÇ½ªÊÝ»ý¥Ý¥¤¥ó¥È", "total_point");
+	$objFormParam->addParam("¸ÜµÒID", "customer_id");
+	$objFormParam->addParam("¸½ºß¤Î¥Ý¥¤¥ó¥È", "point");
+}
+
+function lfGetOrderData($order_id) {
+	global $objFormParam;
+	global $objPage;
+	if(sfIsInt($order_id)) {
+		// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
+		$objQuery = new SC_Query();
+		$where = "order_id = ?";
+		$arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
+		$objFormParam->setParam($arrRet[0]);
+		list($point, $total_point) = sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
+		$objFormParam->setValue('total_point', $total_point);
+		$objFormParam->setValue('point', $point);
+		$objPage->arrDisp = $arrRet[0];
+		// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+		$arrRet = lfGetOrderDetail($order_id);
+		$arrRet = sfSwapArray($arrRet);
+		$objPage->arrDisp = array_merge($objPage->arrDisp, $arrRet);
+		$objFormParam->setParam($arrRet);
+	}
+}
+
+// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderDetail($order_id) {
+	$objQuery = new SC_Query();
+	$col = "product_id, classcategory_id1, classcategory_id2, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
+	$where = "order_id = ?";
+	$objQuery->setorder("classcategory_id1, classcategory_id2");
+	$arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+	return $arrRet;
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	return $objErr->arrErr;
+}
+
+/* ·×»»½èÍý */
+function lfCheek($arrInfo) {
+	global $objFormParam;
+		
+	$arrVal = $objFormParam->getHashArray();
+			
+	// ¾¦ÉÊ¤Î¼ïÎà¿ô
+	$max = count($arrVal['quantity']);
+	$subtotal = 0;
+	$totalpoint = 0;
+	$totaltax = 0;
+	for($i = 0; $i < $max; $i++) {
+		// ¾®·×¤Î·×»»
+		$subtotal += sfPreTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
+		// ¾®·×¤Î·×»»
+		$totaltax += sfTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
+		// ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»
+		$totalpoint += sfPrePoint($arrVal['price'][$i], $arrVal['point_rate'][$i]) * $arrVal['quantity'][$i];
+	}
+	
+	// ¾ÃÈñÀÇ
+	$arrVal['tax'] = $totaltax;	
+	// ¾®·×
+	$arrVal['subtotal'] = $subtotal;
+	// ¹ç·×
+	$arrVal['total'] = $subtotal - $arrVal['discount'] + $arrVal['deliv_fee'] + $arrVal['charge'];
+	// ¤ª»ÙÊ§¤¤¹ç·×
+	$arrVal['payment_total'] = $arrVal['total'] - ($arrVal['use_point'] * POINT_VALUE);
+	
+	// ²Ã»»¥Ý¥¤¥ó¥È
+	$arrVal['add_point'] = sfGetAddPoint($totalpoint, $arrVal['use_point'], $arrInfo);
+		
+	list($arrVal['point'], $arrVal['total_point']) = sfGetCustomerPoint($_POST['order_id'], $arrVal['use_point'], $arrVal['add_point']);
+		
+	if($arrVal['total'] < 0) {
+		$arrErr['total'] = '¹ç·×³Û¤¬¥Þ¥¤¥Ê¥¹É½¼¨¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤ËÄ´À°¤·¤Æ²¼¤µ¤¤¡£<br />';
+	}
+	
+	if($arrVal['payment_total'] < 0) {
+		$arrErr['payment_total'] = '¤ª»ÙÊ§¤¤¹ç·×³Û¤¬¥Þ¥¤¥Ê¥¹É½¼¨¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤ËÄ´À°¤·¤Æ²¼¤µ¤¤¡£<br />';
+	}
+
+	if($arrVal['total_point'] < 0) {
+		$arrErr['total_point'] = 'ºÇ½ªÊÝ»ý¥Ý¥¤¥ó¥È¤¬¥Þ¥¤¥Ê¥¹É½¼¨¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤ËÄ´À°¤·¤Æ²¼¤µ¤¤¡£<br />';
+	}
+
+	$objFormParam->setParam($arrVal);
+	return $arrErr;
+}
+
+/* DBÅÐÏ¿½èÍý */
+function lfRegistData($order_id) {
+	global $objFormParam;
+	$objQuery = new SC_Query();
+	
+	$objQuery->begin();
+
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	
+	foreach($arrRet as $key => $val) {
+		// ÇÛÎó¤ÏÅÐÏ¿¤·¤Ê¤¤
+		if(!is_array($val)) {
+			$sqlval[$key] = $val;
+		}
+	}
+	
+	unset($sqlval['total_point']);
+	unset($sqlval['point']);
+			
+	$where = "order_id = ?";
+	
+	// ¼õÃí¥¹¥Æ¡¼¥¿¥¹¤ÎÈ½Äê
+	if ($sqlval['status'] == ODERSTATUS_COMMIT) {
+		// ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÈ¯Á÷ºÑ¤ßÆü¤ò¹¹¿·¤¹¤ë
+		$addcol['commit_date'] = "Now()";
+	}
+	
+	// ¼õÃí¥Æ¡¼¥Ö¥ë¤Î¹¹¿·
+	$objQuery->update("dtb_order", $sqlval, $where, array($order_id), $addcol);
+	
+	// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¹¹¿·
+	$arrDetail = $objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
+	$objQuery->delete("dtb_order_detail", $where, array($order_id));
+	
+	$max = count($arrDetail);
+	for($i = 0; $i < $max; $i++) {
+		$sqlval = array();
+		$sqlval['order_id'] = $order_id;
+		$sqlval['product_id']  = $arrDetail[$i]['product_id'];
+		$sqlval['product_code']  = $arrDetail[$i]['product_code'];
+		$sqlval['product_name']  = $arrDetail[$i]['product_name'];
+		$sqlval['price']  = $arrDetail[$i]['price'];
+		$sqlval['quantity']  = $arrDetail[$i]['quantity'];
+		$sqlval['point_rate']  = $arrDetail[$i]['point_rate'];
+		$sqlval['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
+		$sqlval['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
+		$sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1'];
+		$sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2'];		
+		$objQuery->insert("dtb_order_detail", $sqlval);
+	}
+	$objQuery->commit();
+}
+?>
Index: /temp/trunk/html/admin/order/index.php
===================================================================
--- /temp/trunk/html/admin/order/index.php	(revision 1328)
+++ /temp/trunk/html/admin/order/index.php	(revision 1328)
@@ -0,0 +1,327 @@
+<?php
+require_once("../require.php");
+require_once("./index_csv.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/index.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';		
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¼õÃí´ÉÍý';
+		global $arrORDERSTATUS;
+		$this->arrORDERSTATUS = $arrORDERSTATUS;
+		global $arrORDERSTATUS_COLOR;
+		$this->arrORDERSTATUS_COLOR = $arrORDERSTATUS_COLOR;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+		global $arrPageMax;
+		$this->arrPageMax = $arrPageMax;
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$objFormParam->setParam($_POST);
+
+$objFormParam->splitParamCheckBoxes('search_order_sex');
+$objFormParam->splitParamCheckBoxes('search_payment_id');
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		switch($key) {
+			case 'search_order_sex':
+			case 'search_payment_id':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				break;
+			default:
+				$objPage->arrHidden[$key] = $val;
+				break;
+		}		
+	}
+}
+
+// ¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if($_POST['mode'] == 'delete') {
+	if(sfIsInt($_POST['order_id'])) {
+		$objQuery = new SC_Query();
+		$where = "order_id = ?";
+		$sqlval['delete'] = '1';
+		$objQuery->update("dtb_order", $sqlval, $where, array($_POST['order_id']));
+	}	
+}
+
+switch($_POST['mode']) {
+case 'delete':
+case 'csv':
+case 'delete_all':
+case 'search':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	$arrRet = $objFormParam->getHashArray();
+	// ÆþÎÏ¤Ê¤·
+	if (count($objPage->arrErr) == 0) {
+		$where = "delete = 0";
+		foreach ($arrRet as $key => $val) {
+			if($val == "") {
+				continue;
+			}
+			$val = sfManualEscape($val);
+			
+			switch ($key) {
+				case 'search_order_name':
+					$where .= " AND order_name01||order_name02 ILIKE ?";
+					$nonsp_val = ereg_replace("[ ¡¡]+","",$val);
+					$arrval[] = "%$nonsp_val%";
+					break;
+				case 'search_order_kana':
+					$where .= " AND order_kana01||order_kana02 ILIKE ?";
+					$nonsp_val = ereg_replace("[ ¡¡]+","",$val);
+					$arrval[] = "%$nonsp_val%";
+					break;
+				case 'search_order_id1':
+					$where .= " AND order_id >= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_order_id2':
+					$where .= " AND order_id <= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_order_sex':
+					$tmp_where = "";
+					foreach($val as $element) {
+						if($element != "") {
+							if($tmp_where == "") {
+								$tmp_where .= " AND (order_sex = ?";
+							} else {
+								$tmp_where .= " OR order_sex = ?";
+							}
+							$arrval[] = $element;
+						}
+					}
+					
+					if($tmp_where != "") {
+						$tmp_where .= ")";
+						$where .= " $tmp_where ";
+					}					
+					break;
+				case 'search_order_tel':
+					$where .= " AND (order_tel01||order_tel02||order_tel03) ILIKE ?";
+					$nonmark_val = ereg_replace("[()-]+","",$val);
+					$arrval[] = "$nonmark_val%";
+					break;
+				case 'search_order_email':
+					$where .= " AND order_email ILIKE ?";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_payment_id':
+					$tmp_where = "";
+					foreach($val as $element) {
+						if($element != "") {
+							if($tmp_where == "") {
+								$tmp_where .= " AND (payment_id = ?";
+							} else {
+								$tmp_where .= " OR payment_id = ?";
+							}
+							$arrval[] = $element;
+						}
+					}
+					
+					if($tmp_where != "") {
+						$tmp_where .= ")";
+						$where .= " $tmp_where ";
+					}
+					break;
+				case 'search_total1':
+					$where .= " AND total >= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_total2':
+					$where .= " AND total <= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_startyear':
+					$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+					$where.= " AND update_date >= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_endyear':
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday'], true);
+					$where.= " AND update_date <= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_sbirthyear':
+					$date = sfGetTimestamp($_POST['search_sbirthyear'], $_POST['search_sbirthmonth'], $_POST['search_sbirthday']);
+					$where.= " AND order_birth >= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_ebirthyear':
+					$date = sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
+					$where.= " AND order_birth <= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_order_status':
+					$where.= " AND status = ?";
+					$arrval[] = $val;
+					break;
+				default:
+					break;
+			}
+		}
+		
+		$order = "update_date DESC";
+		
+		switch($_POST['mode']) {
+		case 'csv':
+			// ¥ª¥×¥·¥ç¥ó¤Î»ØÄê
+			$option = "ORDER BY $order";
+			
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤ÎºîÀ®
+			$arrCsvOutput = sfSwapArray(sfgetCsvOutput(3, " WHERE csv_id = 3 AND status = 1"));
+			
+			if (count($arrCsvOutput) <= 0) break;
+			
+			$arrCsvOutputCols = $arrCsvOutput['col'];
+			$arrCsvOutputTitle = $arrCsvOutput['disp_name'];
+			$head = sfGetCSVList($arrCsvOutputTitle);
+			$data = lfGetCSV("dtb_order", $where, $option, $arrval, $arrCsvOutputCols);
+			
+			// CSV¤òÁ÷¿®¤¹¤ë¡£
+			sfCSVDownload($head.$data);
+			exit;
+			break;
+		case 'delete_all':
+			// ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
+			$sqlval['delete'] = 1;
+			$objQuery = new SC_Query();
+			$objQuery->update("dtb_order", $sqlval, $where, $arrval);
+			break;
+		default:
+			// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+			$col = "*";
+			$from = "dtb_order";
+			
+			$objQuery = new SC_Query();
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objQuery->count($from, $where, $arrval);
+			$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+			
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+			if(is_numeric($_POST['search_page_max'])) {	
+				$page_max = $_POST['search_page_max'];
+			} else {
+				$page_max = SEARCH_PMAX;
+			}
+			
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+			$startno = $objNavi->start_row;
+			$objPage->arrPagenavi = $objNavi->arrPagenavi;		
+			
+			// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+			$objQuery->setlimitoffset($page_max, $startno);
+			// É½¼¨½ç½ø
+			$objQuery->setorder($order);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage->arrResults = $objQuery->select($col, $from, $where, $arrval);
+		}
+	}
+	break;
+	
+default:
+	break;
+}
+
+$objDate = new SC_Date();
+// ÅÐÏ¿¡¦¹¹¿·Æü¸¡º÷ÍÑ
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrRegistYear = $objDate->getYear();
+// À¸Ç¯·îÆü¸¡º÷ÍÑ
+$objDate->setStartYear(BIRTH_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrBirthYear = $objDate->getYear();
+// ·îÆü¤ÎÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$arrRet = sfGetPayment();
+$objPage->arrPayment = sfArrKeyValue($arrRet, 'payment_id', 'payment_method');
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¼õÃíÈÖ¹æ1", "search_order_id1", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¼õÃíÈÖ¹æ2", "search_order_id2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÂÐ±þ¾õ¶·", "search_order_status", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¸ÜµÒÌ¾", "search_order_name", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸ÜµÒÌ¾(¥«¥Ê)", "search_order_kana", STEXT_LEN, "KVCa", array("KANA_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("À­ÊÌ", "search_order_sex", INT_LEN, "n", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Ç¯Îð1", "search_age1", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("Ç¯Îð2", "search_age2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "search_order_email", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("TEL", "search_order_tel", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»ÙÊ§¤¤ÊýË¡", "search_payment_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþ¶â³Û1", "search_total1", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþ¶â³Û2", "search_total2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("É½¼¨·ï¿ô", "search_page_max", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_startyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_startmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_startday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_endyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_endmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_endday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_sbirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_sbirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_sbirthday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_ebirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_ebirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_ebirthday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÆÃ¼ì¹àÌÜ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("¼õÃíÈÖ¹æ1", "¼õÃíÈÖ¹æ2", "search_order_id1", "search_order_id2"), array("GREATER_CHECK"));
+	$objErr->doFunc(array("Ç¯Îð1", "Ç¯Îð2", "search_age1", "search_age2"), array("GREATER_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ¶â³Û1", "¹ØÆþ¶â³Û2", "search_total1", "search_total2"), array("GREATER_CHECK"));
+	$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("³«»ÏÆü", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_SET_TERM"));
+
+	return $objErr->arrErr;
+}
+
+
+?>
Index: /temp/trunk/html/admin/order/mail_view.php
===================================================================
--- /temp/trunk/html/admin/order/mail_view.php	(revision 1328)
+++ /temp/trunk/html/admin/order/mail_view.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/mail_view.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if(sfIsInt($_GET['send_id'])) {
+	$objQuery = new SC_Query();
+	$col = "subject, mail_body";
+	$where = "send_id = ?";
+	$arrRet = $objQuery->select($col, "dtb_mail_history", $where, array($_GET['send_id']));
+	$objPage->tpl_subject = $arrRet[0]['subject'];
+	$objPage->tpl_body = $arrRet[0]['mail_body'];
+}
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
Index: /temp/trunk/html/admin/home.php
===================================================================
--- /temp/trunk/html/admin/home.php	(revision 1328)
+++ /temp/trunk/html/admin/home.php	(revision 1328)
@@ -0,0 +1,155 @@
+<?php
+
+require_once("./require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'home.tpl';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¸½ºß¤Î²ñ°÷¿ô
+$objPage->customer_cnt = lfGetCustomerCnt($conn);
+
+// ºòÆü¤ÎÇä¾å¹â
+$objPage->order_yesterday_amount = lfGetOrderYesterday($conn, "SUM");
+
+// ºòÆü¤ÎÇä¾å·ï¿ô
+$objPage->order_yesterday_cnt = lfGetOrderYesterday($conn, "COUNT");
+
+// º£·î¤ÎÇä¾å¹â
+$objPage->order_month_amount = lfGetOrderMonth($conn, "SUM");
+
+// º£·î¤ÎÇä¾å·ï¿ô
+$objPage->order_month_cnt = lfGetOrderMonth($conn, "COUNT");
+
+// ¸ÜµÒ¤ÎÎß·×¥Ý¥¤¥ó¥È
+$objPage->customer_point = lfGetTotalCustomerPoint();
+
+//ºòÆü¤Î¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ß¿ô
+$objPage->review_yesterday_cnt = lfGetReviewYesterday($conn);
+
+//¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ßÈóÉ½¼¨¿ô
+$objPage->review_nondisp_cnt = lfGetReviewNonDisp($conn);
+
+// ÉÊÀÚ¤ì¾¦ÉÊ
+$objPage->arrSoldout = lfGetSoldOut();
+
+// ¿·µ¬¼õÉÕ°ìÍ÷
+$objPage->arrNewOrder = lfGetNewOrder();
+
+// ¤ªÃÎ¤é¤»°ìÍ÷¤Î¼èÆÀ
+$objPage->arrInfo = lfGetInfo();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//---------------------------------------------------------
+
+// ²ñ°÷¿ô
+function lfGetCustomerCnt($conn){
+	
+	$sql = "SELECT COUNT(customer_id) FROM dtb_customer WHERE delete = 0 AND status = 2";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+// ºòÆü¤ÎÇä¾å¹â¡¦Çä¾å·ï¿ô
+function lfGetOrderYesterday($conn, $method){
+	if ( $method == 'SUM' or $method == 'COUNT'){
+		$sql = "SELECT ".$method."(total) FROM dtb_order
+				 WHERE delete = 0 AND to_char(create_date,'YYYY/MM/DD') = to_char(now() - interval '1 days','YYYY/MM/DD')";
+		$return = $conn->getOne($sql);
+	}
+	return $return;
+}
+
+function lfGetOrderMonth($conn, $method){
+
+	$month = date("Y/m", mktime());
+	
+	if ( $method == 'SUM' or $method == 'COUNT'){
+		$sql = "SELECT ".$method."(total) FROM dtb_order
+				 WHERE delete = 0 AND to_char(create_date,'YYYY/MM') = ? 
+				 AND to_char(create_date,'YYYY/MM/DD') <> to_char(now(),'YYYY/MM/DD')";
+		$return = $conn->getOne($sql, array($month));
+	}
+	return $return;
+}
+
+function lfGetTotalCustomerPoint() {
+	$objQuery = new SC_Query();
+	$col = "SUM(point)";
+	$where = "delete = 0";
+	$from = "dtb_customer";
+	$ret = $objQuery->get($from, $col, $where);
+	return $ret;	
+}
+
+function lfGetReviewYesterday($conn){
+	$sql = "SELECT COUNT (*) FROM dtb_review 
+			 WHERE delete=0 AND to_char(create_date, 'YYYY/MM/DD') = to_char(now() - interval '1 days','YYYY/MM/DD')
+			 AND to_char(create_date,'YYYY/MM/DD') != to_char(now(),'YYYY/MM/DD')";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+function lfGetReviewNonDisp($conn){
+	$sql = "SELECT COUNT (*) FROM dtb_review WHERE delete=0 AND status=2";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+// ÉÊÀÚ¤ì¾¦ÉÊÈÖ¹æ¤Î¼èÆÀ
+function lfGetSoldOut() {
+	$objQuery = new SC_Query();
+	$where = "product_id IN (SELECT product_id FROM dtb_products_class WHERE stock_unlimited IS NULL AND stock <= 0)";
+	$arrRet = $objQuery->select("product_id, name", "dtb_products", $where);
+	return $arrRet;
+}
+
+// ¿·µ¬¼õÉÕ°ìÍ÷
+function lfGetNewOrder() {
+	$objQuery = new SC_Query();
+	$col = "ord.order_id, customer_id, (ord.order_name01 || ' ' || ord.order_name02) AS name, ord.total, ";
+	$col.= "(SELECT det.product_name FROM dtb_order_detail AS det WHERE ord.order_id = det.order_id LIMIT 1) AS product_name, ";
+	$col.= "(SELECT pay.payment_method FROM dtb_payment AS pay WHERE ord.payment_id = pay.payment_id) AS payment_method, ";	
+	$col.= "to_char(create_date, 'YYYY/MM/DD HH24:MI') AS create_date";
+	$from = "dtb_order AS ord";
+	$where = "delete = 0";
+	$objQuery->setoption("ORDER BY create_date DESC LIMIT 10 OFFSET 0");
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+// ¤ªÃÎ¤é¤»¼èÆÀ
+function lfGetInfo() {
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	$objQuery = new SC_Query();
+	$path = UPDATE_HTTP . "info.txt";
+	$fp = @fopen($path, "rb");
+	
+	$arrRet = array();
+	if(!$fp) {
+		sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+	} else {
+		while (!feof($fp)) {
+			$arrRet[] = $arrCSV = fgetcsv($fp, UPDATE_CSV_LINE_MAX);
+		}
+		fclose($fp);
+	}
+	
+	return $arrRet;
+}
+
+
+
+?>
Index: /temp/trunk/html/admin/error.php
===================================================================
--- /temp/trunk/html/admin/error.php	(revision 1328)
+++ /temp/trunk/html/admin/error.php	(revision 1328)
@@ -0,0 +1,80 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="./css/contents.css" type="text/css" />
+<script type="text/javascript" src="./js/css.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+</head>
+
+<body bgcolor="#f3f3f3" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+<noscript>
+<link rel="stylesheet" href="./css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¢§HEADER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#bfbf9f" height="3" colspan="2"></td></tr>
+	<tr bgcolor="#dedecd">
+		<td height="40" width="365"><a href="./home.php"><img src="./misc/logo.gif" width="365" height="16" alt="EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸" border="0" /></a></td>
+		<td width="415" align="right"><a href="./home.php" onmouseover="chgImg('./misc/home_on.gif','home');" onmouseout="chgImg('./misc/home.gif','home');"><img src="./misc/home.gif" width="70" height="20" alt="HOME" border="0" name="home" id="home" /></a><img src="./misc/_.gif" width="3" height="1" alt="" />
+		<a href="#" onmouseover="chgImg('./misc/hp_on.gif','hp');" onmouseout="chgImg('./misc/hp.gif','hp');" target="_blank"><img src="./misc/hp.gif" width="70" height="20" alt="HP¤ò¸«¤ë" border="0" name="hp" id="hp" /></a><img src="./misc/_.gif" width="3" height="1" alt="" />
+		<a href="./index.html" onmouseover="chgImg('./misc/logout_on.gif','logout');" onmouseout="chgImg('./misc/logout.gif','logout');"><img src="./misc/logout.gif" width="70" height="20" alt="¥í¥°¥¢¥¦¥È" border="0" name="logout" id="logout" /></a><img src="./misc/_.gif" width="20" height="1" alt="" /></td>
+	</tr>
+	<tr><td bgcolor="#ffffff" height="1" colspan="3"></td></tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§MAIN NAVI-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td><a href="./basis/index.php" onmouseover="chgImg('./misc/basis_on.gif','basis');" onmouseout="chgImg('./misc/basis.gif','basis');"><img src="./misc/basis.gif" width="108" height="26" alt="´ðËÜ¾ðÊó" border="0" name="basis" id="basis" /></a></td>
+		<td><a href="./product/index.php" onmouseover="chgImg('./misc/product_on.gif','product');" onmouseout="chgImg('./misc/product.gif','product');"><img src="./misc/product.gif" width="108" height="26" alt="¾¦ÉÊ´ÉÍý" border="0" name="product" id="product" /></a></td>
+		<td><a href="./customer/index.php" onmouseover="chgImg('./misc/customer_on.gif','customer');" onmouseout="chgImg('./misc/customer.gif','customer');"><img src="./misc/customer.gif" width="108" height="26" alt="¸ÜµÒ´ÉÍý" border="0" name="customer" id="customer" /></a></td>
+		<td><a href="./order/index.php" onmouseover="chgImg('./misc/order_on.gif','order');" onmouseout="chgImg('./misc/order.gif','order');"><img src="./misc/order.gif" width="108" height="26" alt="¼õÃí´ÉÍý" border="0" name="order" id="order" /></a></td>
+		<td><a href="./sales/index.php" onmouseover="chgImg('./misc/sales_on.gif','sales');" onmouseout="chgImg('./misc/sales.gif','sales');"><img src="./misc/sales.gif" width="108" height="26" alt="Çä¾å´ÉÍý" border="0" name="sales" id="sales" /></a></td>
+		<td><a href="./mail/index.php" onmouseover="chgImg('./misc/mail_on.gif','mail');" onmouseout="chgImg('./misc/mail.gif','mail');"><img src="./misc/mail.gif" width="108" height="26" alt="¥á¡¼¥ëÇÛ¿®" border="0" name="mail" id="mail" /></a></td>
+		<td><a href="./contents/index.php" onmouseover="chgImg('./misc/contents_on.gif','contents');" onmouseout="chgImg('./misc/contents.gif','contents');"><img src="./misc/contents.gif" width="132" height="26" alt="¥³¥ó¥Æ¥ó¥Ä´ÉÍý" border="0" name="contents" id="contents" /></a></td>
+	</tr>
+	<tr><td colspan="7" height="1" bgcolor="#dedecd"></td></tr>
+	<tr><td colspan="7" bgcolor="#ffffff" height="15"></td></tr>
+</table>
+<!--¢¥MAIN NAVI-->
+
+<!--¢§CONTENTS-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td height="350" bgcolor="#ffffff" align="center" valign="top">
+		<form name="form1" id="form1" method="post" action="">
+		<table width="600" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td height="30"></td></tr>
+			<tr>
+				<td height="20" class="fs12n"><span class="red">¤ª¼ê¿ô¤Ç¤¹¤¬¡¢²¼µ­¹àÌÜ¤òµ­Æþ¤Þ¤¿¤Ï½¤Àµ¤·¤Æ¤¯¤À¤µ¤¤¡£</span></td>
+			</tr>
+			<tr><td height="15"></td></tr>
+			<tr>
+				<td height="20" class="fs12">¤ªÌ¾Á°¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />
+				ÅÅÏÃÈÖ¹æ¤ÏÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£</td>
+			</tr>
+		</table>
+		<br />
+		<input type="button" name="subm" value="Ìá¤ë" onclick="#" />
+		</form>
+		</td>
+	</tr>
+</table>
+
+<!--¢§FOOTER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#ffffff" height="60"></td></tr>
+	<tr><td bgcolor="#e5e5df" height="5"></td></tr>
+</table>
+<!--¢¥FOOTER-->
+</div>
+</body>
+</html>
Index: /temp/trunk/html/admin/batch/daily.php
===================================================================
--- /temp/trunk/html/admin/batch/daily.php	(revision 1328)
+++ /temp/trunk/html/admin/batch/daily.php	(revision 1328)
@@ -0,0 +1,235 @@
+<?php
+
+$daily_php_dir = realpath(dirname( __FILE__));
+require_once($daily_php_dir . "/../require.php");
+
+$term = 0;
+$start = 1;	// ½¸·×´ü´Ö¤Ï¡¢$start¢·$term¤Î´Ö¤È¤Ê¤ë¡£ÄÌ¾ïÁ°ÆüÊ¬¤«¤é¡£
+$command = false;
+
+// ½¸·×ÂÐ¾Ý´ü´Ö¤Î¼èÆÀ¡Ê»ØÄêÆüÊ¬¤µ¤«¤Î¤Ü¤ë)
+if (sfIsInt($argv[1]) && $argv[1] <= 365) {
+	$term = $argv[1];
+	$command = true;
+}
+
+// ½¸·×³«»ÏÆü
+if (sfIsInt($argv[2]) && $argv[2] <= 365) {
+	$start = $argv[2];
+	$command = true;
+}
+
+if($term > 0) {
+	// ½¸·×¤Î³«»Ï
+	lfStartDailyTotal($term, $start, $command);
+}
+
+// ½¸·×¤Î³«»Ï
+function lfStartDailyTotal($term, $start, $command = false) {
+	$now_time = time();
+	
+	// ¥°¥é¥Õ²èÁü¤Îºï½ü
+	$path = GRAPH_DIR . "*.png";
+	system ("rm -rf $path");
+	
+	// ºï½ü¤µ¤ì¤¿¼õÃí¥Ç¡¼¥¿¤Î¼õÃí¾ÜºÙ¾ðÊó¤Îºï½ü
+	$objQuery = new SC_Query();
+	$where = "order_id IN (SELECT order_id FROM dtb_order WHERE delete = 1)";
+	$objQuery->delete("dtb_order_detail", $where);
+
+	// ½¸·×
+	for ($i = $start; $i < $term; $i++) {
+		// ´ðËÜ»þ´Ö¤«¤é1ÆüÊ¬¤µ¤«¤Î¤Ü¤ë
+		$tmp_time = $now_time - ($i * 24 * 3600);
+				
+		$batch_date = date("Y/m/d", $tmp_time);
+		
+		// ºÇ¸å¤Î¥Ð¥Ã¥Á¼Â¹Ô¤«¤éLOAD_BATCH_PASSÉÃ·Ð²á¤·¤Æ¤¤¤Ê¤¤¤È¼Â¹Ô¤·¤Ê¤¤¡£
+		$batch_pass = date("Y/m/d H:m:s", $tmp_time - LOAD_BATCH_PASS);
+		$objQuery = new SC_Query();
+		$count = $objQuery->count("dtb_bat_order_daily", "create_date > ?", $batch_pass);
+		
+		if($count > 0 && !$command) {
+			gfPrintLog("EXIT BATCH $batch_date");
+			return;
+		}
+		
+		gfPrintLog("LOADING BATCH $batch_date");
+					
+		lfBatOrderDaily($tmp_time);
+		lfBatOrderDailyHour($tmp_time);
+		lfBatOrderAge($tmp_time);
+	}
+}
+
+// ¥Ð¥Ã¥Á½¸·×ÍÑ¤ÎSQLÊ¸¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetOrderDailySQL() {
+	$sql = "SELECT ";
+	$sql.= "COUNT(*) AS total_order, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE customer_id = 0)) AS nonmember, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE customer_id <> 0 GROUP BY customer_id)) AS member, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 1)) AS men, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 2)) AS women, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 1 AND customer_id <> 0)) AS men_member, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 1 AND customer_id = 0)) AS men_nonmember, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 2 AND customer_id <> 0)) AS women_member, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 2 AND customer_id = 0)) AS women_nonmember, ";
+	$sql.= "SUM(total) AS total, ";
+	$sql.= "int4(AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_order AS T1 LEFT JOIN dtb_customer AS T2 USING ( customer_id ) ";
+	$sql.= "WHERE T1.delete = 0 AND T1.create_date BETWEEN ? AND ?";		// ¼õÃíºîÀ®Æü¤Ç¸¡º÷¤¹¤ë
+	return $sql;
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(ÆüÊÌ)
+function lfBatOrderDaily($time) {
+	global $arrWDAY;
+	
+	$sql = lfGetOrderDailySQL();
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	
+	$start = $date . " 00:00:00";
+	$end = $date . " 23:59:59";
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->getall($sql, array($start, $end));	
+		
+	$sqlval = $arrRet[0];
+	
+	// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+	foreach($sqlval as $key => $val) {
+		if ($val == "") {
+			$sqlval[$key] = "0";
+		}
+	}
+	
+	$sqlval['order_date'] = $start;
+	$sqlval['year'] = date("Y", $time);
+	$sqlval['month'] = date("m", $time);
+	$sqlval['day'] = date("d", $time);
+	$sqlval['wday'] = date("w", $time);
+	$sqlval['key_day'] = sprintf("%02d/%02d/%02d", substr($sqlval['year'],2), $sqlval['month'], $sqlval['day']);
+	$sqlval['key_month'] = sprintf("%02d/%02d", substr($sqlval['year'],2), $sqlval['month']);
+	$sqlval['key_year'] = sprintf("%d", $sqlval['year']);
+	$sqlval['key_wday'] = sprintf("%s", $arrWDAY[$sqlval['wday']]);
+	
+	$objQuery->delete("dtb_bat_order_daily", "order_date = ?", array($start));
+	$objQuery->insert("dtb_bat_order_daily", $sqlval);
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(»þ´ÖÊÌ) 
+function lfBatOrderDailyHour($time) {
+	
+	$sql = lfGetOrderDailySQL();
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	$objQuery = new SC_Query();
+	
+	$start = $date . " 00:00:00";
+	$objQuery->delete("dtb_bat_order_daily_hour", "order_date = ?", array($start));
+	
+	// 1»þ´ÖËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i < 24; $i++) {
+		$sdate = sprintf("%s %02d:00:00", $date, $i);
+		$edate = sprintf("%s %02d:59:59", $date, $i);
+		$arrRet = $objQuery->getall($sql, array($sdate, $edate));
+		$sqlval = $arrRet[0];
+		// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+		foreach($sqlval as $key => $val) {
+			if ($val == "") {
+				$sqlval[$key] = "0";
+			}
+		}
+		$sqlval['order_date'] = $start;
+		$sqlval['hour'] = "$i";
+		$objQuery->insert("dtb_bat_order_daily_hour", $sqlval);
+	}	
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(Ç¯ÎðÊÌ) 
+function lfBatOrderAge($time) {
+	
+	$age_loop = intval(BAT_ORDER_AGE / 10);
+	
+	// Ç¯Îð¤ÎÈÏ°Ï¤ò»ØÄê¤·¤Æ¥Ç¡¼¥¿Ãê½Ð
+	$sql.= "SELECT COUNT(*) AS order_count, SUM(total) AS total, int4(AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_order ";
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	
+	$start = $date . " 00:00:00";
+	$end = $date . " 23:59:59";
+	
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_bat_order_daily_age", "order_date = ?", array($start));
+	
+	/* ²ñ°÷½¸·× */
+	
+	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id <> 0 AND delete = 0 ";
+	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
+	
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$start_age = $i * 10;
+		$end_age = $start_age + 9;
+		if($i >= $age_loop) {
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 1);
+	}
+	
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$where = $base_where . " AND order_birth IS NULL ";
+	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 1);
+	
+	/* Èó²ñ°÷½¸·× */
+	
+	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id = 0 AND delete = 0";
+	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
+	
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$start_age = $i * 10;
+		$end_age = $start_age + 9;
+		if($i >= $age_loop) {
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 0);
+	}
+	
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$where = $base_where . " AND order_birth IS NULL AND delete = 0";
+	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 0);	
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(Ç¯ÎðÊÌ) ÅÐÏ¿ÉôÊ¬
+function lfBatOrderAgeSub($sql, $start, $end, $start_age, $end_age, $member) {
+	$objQuery = new SC_Query();
+	
+	if($start_age != NULL || $end_age != NULL) {
+		$arrRet = $objQuery->getall($sql, array($start, $end, $start_age, $end_age));
+	} else {
+		$arrRet = $objQuery->getall($sql, array($start, $end));
+	}
+	$sqlval = $arrRet[0];
+	
+	// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+	foreach($sqlval as $key => $val) {
+		if ($val == "") {
+			$sqlval[$key] = "0";
+		}
+	}
+		
+	$sqlval['order_date'] = $start;
+	$sqlval['start_age'] = "$start_age";
+	$sqlval['end_age'] = "$end_age";
+	$sqlval['member'] = "$member";
+
+	$objQuery->insert("dtb_bat_order_daily_age", $sqlval);
+}
+
+?>
Index: /temp/trunk/html/admin/info.php
===================================================================
--- /temp/trunk/html/admin/info.php	(revision 1328)
+++ /temp/trunk/html/admin/info.php	(revision 1328)
@@ -0,0 +1,12 @@
+<?php
+print($_SERVER['HTTPS']);	
+
+$val = "Now()";
+
+if(eregi("now\(\)", $val)) {
+	print("onaji");
+}
+
+phpinfo();
+	
+?>
Index: /temp/trunk/html/admin/mail/htmlmail_select.php
===================================================================
--- /temp/trunk/html/admin/mail/htmlmail_select.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/htmlmail_select.php	(revision 1328)
@@ -0,0 +1,131 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $arrForm;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/htmlmail_select.tpl';
+		$this->tpl_mainno = 'mail';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if ($_POST['mode'] == "search") {
+	
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	
+	// ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤¡£¸ø³«¾¦ÉÊ¤Ç¤¢¤ë¡£
+	$where = "delete = 0 AND status = 1";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	foreach ($objPage->arrForm as $key => $val) {
+		if($val == "") {
+			continue;
+		}
+		
+		switch ($key) {
+			case 'search_name':
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+				$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
+				$tmp_where = "";
+				foreach ($arrRet as $val) {
+					if($tmp_where == "") {
+						$tmp_where.= " AND ( category_id = ?";
+					} else {
+						$tmp_where.= " OR category_id = ?";
+					}
+					$arrval[] = $val;
+				}
+				$where.= $tmp_where . " )";
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$where .= " OR product_code ILIKE ?";
+				$arrval[] = "%$val%";
+				$arrval[] = "%$val%";
+				break;
+			default:
+				break;
+		}
+	}
+	
+	$order = "update_date DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+		
+}
+
+$objPage->arrCatList = sfGetCategoryList();
+$objPage->name = $_GET['name'];
+
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+?>
Index: /temp/trunk/html/admin/mail/htmlmail.php
===================================================================
--- /temp/trunk/html/admin/mail/htmlmail.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/htmlmail.php	(revision 1328)
@@ -0,0 +1,365 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $arrForm;
+	
+	var $arrTempProduct;
+	var $subProductNum;
+	var $arrFileName;
+	
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/htmlmail.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "template";
+	}
+}
+
+
+class LC_Products{
+	
+	var $conn;
+	var $arrProduct;
+	var $arrProductKey;
+	
+	function LC_Products ($conn=""){
+		
+		$DB_class_name = "SC_DbConn";
+		if ( is_object($conn)){
+			if ( is_a($conn, $DB_class_name)){
+				// $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë
+				$this->conn = $conn;
+			}
+		} else {
+			if (class_exists($DB_class_name)){
+				//$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë
+				$this->conn = new SC_DbConn();			
+			}
+		}
+	}
+	
+	function setProduct($keyname, $id) {
+		
+		if ( sfCheckNumLength($id) ){
+			$result = $this->getProductData($id);
+		}
+		
+		if ( $result && (in_array($keyname, $this->arrProductKey) ) ){
+	
+			$this->arrProduct["${keyname}"] = $result;
+		}
+	}	
+	
+	function getProductData($id){
+		$conn = $this->conn;
+		// ¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+		$sql = "SELECT * FROM dtb_products WHERE product_id = ?";
+		$result = $conn->getAll($sql, array($id));
+		if ( is_array($result) ){
+			$return = $result[0];
+		}
+		return $return;	
+	}
+
+	function getProductImageData($id){
+		$conn = $this->conn;
+		// ¾¦ÉÊ²èÁü¾ðÊó¤ò¼èÆÀ¤¹¤ë
+		$sql = "SELECT main_image FROM dtb_products WHERE product_id = ?";
+		$result = $conn->getAll($sql, array($id));
+		if ( is_array($result) ){
+			$return = $result[0]["main_image"];
+		}
+		return $return;	
+	}
+	function setHiddenList($arrPOST) {
+		foreach($this->arrProductKey as $val) {
+			$key = "temp_" . $val;
+			if($arrPOST[$key] != "") {
+				$this->setProduct($val, $arrPOST[$key]);
+			}
+		}
+	}
+}
+
+// ÅÐÏ¿¥«¥é¥à
+$arrRegist = array(
+					  "subject", "charge_image", "mail_method", "header", "main_title", "main_comment", "main_product_id", "sub_title", "sub_comment"
+					, "sub_product_id01", "sub_product_id02", "sub_product_id03", "sub_product_id04", "sub_product_id05", "sub_product_id06", "sub_product_id07"
+					, "sub_product_id08", "sub_product_id09", "sub_product_id10", "sub_product_id11", "sub_product_id12"
+					);
+					
+// ´ûÂ¸¤ÎÅÐÏ¿ºÑ¤ß¾¦ÉÊ¤«¤é²èÁüÉ½¼¨¤òÉ¬Í×¤È¤¹¤ë¹àÌÜ¥ê¥¹¥È					
+$arrFileList = array(
+						"main_product_id", "sub_product_id01", "sub_product_id02", "sub_product_id03", "sub_product_id04", "sub_product_id05"
+						, "sub_product_id06", "sub_product_id07", "sub_product_id08", "sub_product_id09", "sub_product_id10", "sub_product_id11", "sub_product_id12"
+					);
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+// ²èÁü½èÍý¥¯¥é¥¹ÀßÄê
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+$objUpFile->addFile("¥á¡¼¥ëÃ´Åö¼Ì¿¿", 'charge_image', array('jpg'),IMAGE_SIZE, true, HTMLMAIL_IMAGE_WIDTH, HTMLMAIL_IMAGE_HEIGHT);
+
+// POSTÃÍ¤Î°ú·Ñ¤®&ÆþÎÏÃÍ¤ÎÊÑ´¹
+$objPage->arrForm = lfConvData($_POST);
+
+// Hidden¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setHiddenFileList($_POST);
+
+switch ($_POST['mode']){
+	
+	//²èÁü¥¢¥Ã¥×¥í¡¼¥É
+	case 'upload_image':
+	// ²èÁüÊÝÂ¸½èÍý
+	$objPage->arrErr[$_POST['image_key']] = $objUpFile->makeTempFile($_POST['image_key']);
+	break;
+	
+	//³ÎÇ§
+	case 'confirm':
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	//¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge((array)$objPage->arrErr, (array)$objUpFile->checkEXISTS());
+		
+	//¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç¡¢³ÎÇ§¥Ú¡¼¥¸¤Ø
+	 if (!$objPage->arrErr){
+		// 	¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÅÏ¤¹¡£
+		$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+		//ºï½üÍ×µá¤Î¤¢¤Ã¤¿²èÁü¤òÉ½¼¨¤·¤Ê¤¤
+		for($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++) {
+			if($_POST['delete_sub'.$i] == "1") {
+				$arrSub['delete'][$i] = "on";
+			}else{
+				$arrSub['delete'][$i] = "";
+			}
+		}
+		$objPage->arrSub = $arrSub;
+		$objPage->tpl_mainpage = 'mail/htmlmail_confirm.tpl';
+	 }
+	break;
+	
+	// ³ÎÇ§¥Ú¡¼¥¸¤«¤é¤ÎÌá¤ê
+	case 'return':
+	break;
+	
+	//¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÅÐÏ¿
+	case 'complete':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvData($_POST);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);	// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+	// ¥¢¥Ã¥×¥í¡¼¥É²èÁü¤ò¥»¡¼¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Ü¹Ô
+	$objUpFile->moveTempFile();
+
+	// DBÅÐÏ¿
+	if (is_numeric($objPage->arrForm["template_id"])) {	//¡¡ÊÔ½¸»þ
+		lfUpdateData($arrRegist);
+	} else {
+		ifRegistData($arrRegist);
+	}
+	$objPage->tpl_mainpage = 'mail/htmlmail_complete.tpl';
+	break;
+}
+
+// ¸¡º÷·ë²Ì¤«¤é¤ÎÊÔ½¸»þ
+if ($_GET["mode"] == "edit" && is_numeric($_GET["template_id"])) {
+	$objPage->edit_mode = "on";
+	//¥Æ¥ó¥×¥ì¡¼¥È¾ðÊóÆÉ¤ß¹þ¤ß
+	lfSetRegistData($_GET["template_id"]);
+	// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+	$objUpFile->setDBFileList($objPage->arrForm);
+
+}
+
+if ($_GET['mode'] != 'edit'){
+//ÅÐÏ¿¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+$objPage->arrFileName = lfGetProducts();
+}
+
+// HIDDENÍÑ¤ËÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrHidden = array_merge((array)$objPage->arrHidden, (array)$objUpFile->getHiddenFileList());
+// ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------------------
+
+/* ¾¦ÉÊ²èÁü¤ÎÆÉ¤ß¹þ¤ß */
+function lfGetProducts() {
+	global $objQuery;
+	
+	if ($_POST['main_product_id'] != ""){
+	$MainFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id=?", array($_POST['main_product_id']));
+	$arrFileName[0] = $MainFile[0];
+	}
+	for($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++) {
+		$sub_keyname = "sub_product_id" . sprintf("%02d", $i);
+		if($_POST[$sub_keyname] != "") {
+			$arrSubFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id = ?", array($_POST[$sub_keyname]));
+			$arrFileName[$i] = $arrSubFile[0];
+		}
+	}
+	return $arrFileName;
+}
+
+/* ÅÐÏ¿ºÑ¤ß¥Ç¡¼¥¿ÆÉ¤ß¹þ¤ß */
+function lfSetRegistData($template_id) {
+	global $objQuery;
+	global $objPage;
+	$arrRet = $objQuery->select("*", "dtb_mailmaga_template", "template_id=?", array($template_id));
+	$arrProductid = $arrRet[0];
+	//²èÁü°Ê³°¤Î¾ðÊó¼èÆÀ
+	$objPage->arrForm = $arrRet[0];
+		if ($arrProductid['main_product_id'] != ""){
+			$MainFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id=?", array($arrProductid['main_product_id']));
+			$arrFileName[0] = $MainFile[0];
+		}
+	for ($i=1; $i<=HTML_TEMPLATE_SUB_MAX; $i++){
+		if ($arrProductid['sub_product_id'.sprintf("%02d", $i)] != ""){
+			$arrSubFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id=?", array($arrProductid['sub_product_id'.sprintf("%02d", $i)]));
+			$arrFileName[$i] = $arrSubFile[0];
+		}
+	}
+	//²èÁü¤Î¾ðÊó¼èÆÀ
+	$objPage->arrFileName = $arrFileName;
+	
+	return $objPage;
+}
+
+// ÊÔ½¸¥Ç¡¼¥¿¼èÆÀ
+function lfGetEditData($id, $arrIdData) {
+	global $conn;
+
+	// DBÅÐÏ¿¾ðÊó
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND delete = 0";
+	$result = $conn->getAll($sql, array($id));
+
+	//¡¡²èÁü¥Õ¥¡¥¤¥ëÌ¾
+	for ($i = 0; $i < count($arrIdData); $i ++) {
+		$data = "";
+		if (is_numeric($result[0][ $arrIdData[$i] ]) ) {
+			$sql = "SELECT name,product_id,main_image FROM dtb_products WHERE product_id = ?";
+			$data = $conn->getAll($sql, array($result[0][ $arrIdData[$i] ]));
+		}
+		$arrFileName[] = $data[0];
+	}
+ 	
+	return array($result[0], $arrFileName);
+}
+
+// ³ÎÇ§¥Ç¡¼¥¿¼èÆÀ
+function lfGetConfirmData($arrPOST, $arrIdData) {
+	global $conn;
+	//¡¡²èÁü¥Õ¥¡¥¤¥ëÌ¾
+	for ($i = 0; $i < count($arrIdData); $i ++) {
+		$data = "";
+		if (is_numeric($arrPOST[ $arrIdData[$i] ]) ) {
+			$sql = "SELECT name,product_id,main_image FROM dtb_products WHERE product_id = ?";
+			$data = $conn->getAll($sql, array($arrPOST[ $arrIdData[$i] ]));
+		}
+		$arrFileName[] = $data[0];
+	}
+ 	return array($arrPOST, $arrFileName);
+}
+
+// ¥Ç¡¼¥¿¥Ù¡¼¥¹ÅÐÏ¿
+function ifRegistData($arrRegist) {
+	global $conn;
+	global $objUpFile;
+
+	foreach ($arrRegist as $data) {
+		if (strlen($_POST[$data]) > 0) {
+			$arrRegistValue[$data] = $_POST[$data];
+		}
+	}
+	$arrRegistValue["creator_id"] = $_SESSION["member_id"];		// ÅÐÏ¿¼ÔID¡Ê´ÉÍý²èÌÌ¡Ë
+	$uploadfile = $objUpFile->getDBFileList();
+	//ºï½üÍ×µá¤Î¤¢¤Ã¤¿¾¦ÉÊ¤òºï½ü¤¹¤ë
+	for ($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++){
+		if ($_POST['delete_sub'.$i] == '1'){
+			$arrRegistValue['sub_product_id'.sprintf("%02d", $i)] = NULL;
+		}
+	}
+	$arrRegistValue = array_merge($arrRegistValue, $uploadfile);
+	$conn->autoExecute("dtb_mailmaga_template", $arrRegistValue);
+}
+
+// ¥Ç¡¼¥¿¹¹¿·
+function lfUpdateData($arrRegist) {
+	global $conn;
+	global $objUpFile;
+
+	foreach ($arrRegist as $data) {
+		if (strlen($_POST[$data]) > 0) {
+			$arrRegistValue[$data] = $_POST[$data];
+		}
+	}
+	$arrRegistValue["creator_id"] = $_SESSION["member_id"];	
+	$arrRegistValue["update_date"] = "NOW()";
+	$uploadfile = $objUpFile->getDBFileList();
+	//ºï½üÍ×µá¤Î¤¢¤Ã¤¿¾¦ÉÊ¤òºï½ü¤¹¤ë
+	for ($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++){
+		if ($_POST['delete_sub'.$i] == '1'){
+			$arrRegistValue['sub_product_id'.sprintf("%02d", $i)] = NULL;
+		}
+	}
+	$arrRegistValue = array_merge($arrRegistValue, $uploadfile);
+	
+	$conn->autoExecute("dtb_mailmaga_template", $arrRegistValue, "template_id = ". addslashes($_POST["template_id"]));
+}
+
+// ÆþÎÏÃÍÊÑ´¹
+function lfConvData( $data ){
+	
+	 // Ê¸»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë							
+	$arrFlag = array(
+					  "header" => "aKV"
+					 ,"subject" => "aKV"
+					 ,"main_title" => "aKV"
+ 					 ,"main_comment" => "aKV"
+ 					 ,"main_product_id" => "aKV"
+ 					 ,"sub_title" => "aKV"
+					 ,"sub_comment" => "aKV"
+				);
+		
+	if ( is_array($data) ){
+		foreach ($arrFlag as $key=>$line) {
+			$data[$key] = mb_convert_kana($data[$key], $line);
+		}
+	}
+
+	return $data;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥á¡¼¥ë·Á¼°", "mail_method"), array("EXIST_CHECK", "ALNUM_CHECK"));
+	$objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Ø¥Ã¥À¡¼¥Æ¥­¥¹¥È", 'header', LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK") );
+	$objErr->doFunc(array("¥á¥¤¥ó¾¦ÉÊ¥¿¥¤¥È¥ë", 'main_title', STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK") );
+	$objErr->doFunc(array("¥á¥¤¥ó¾¦ÉÊ¥³¥á¥ó¥È", 'main_comment', LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥¤¥ó¾¦ÉÊ²èÁü", "main_product_id"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¥µ¥Ö¾¦ÉÊ·²¥¿¥¤¥È¥ë", "sub_title", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥µ¥Ö¾¦ÉÊ·²¥³¥á¥ó¥È", "sub_comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/trunk/html/admin/mail/inc_mailmagazine.php
===================================================================
--- /temp/trunk/html/admin/mail/inc_mailmagazine.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/inc_mailmagazine.php	(revision 1328)
@@ -0,0 +1,261 @@
+<?php
+/**
+ * CSVÇÛ¿®µ¡Ç½¼ÂÁõ¤Î¤¿¤á¡¢¶¦ÄÌÉôÊ¬¤ò³°Éô¥Õ¥¡¥¤¥ë²½¤·¤Þ¤·¤¿¡£<br>
+ * @author hirokazu_fukuda
+ * @version 2005/12/27
+ */
+
+
+//---- ¸¡º÷ÍÑ¹àÌÜÇÛÎó
+$objPage->arrHtmlmail = array( "" => "Î¾Êý",  1 => "HTML", 2 => "TEXT" );
+
+
+//---- ÇÛÎóÆâÍÆÀìÍÑ¹àÌÜ¤ÎÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "template_id",		"convert" => "n" )
+							,array(  "column" => "mail_method",		"convert" => "n" )
+							,array(  "column" => "send_year",		"convert" => "n" )
+							,array(  "column" => "send_month", 		"convert" => "n" )
+							,array(  "column" => "send_day",		"convert" => "n" )
+							,array(  "column" => "send_hour",		"convert" => "n" )
+							,array(  "column" => "send_minutes",	"convert" => "n" )
+							,array(  "column" => "subject",			"convert" => "aKV" )
+							,array(  "column" => "body",			"convert" => "aKV" )
+						);
+
+//---- ¥á¥ë¥Þ¥¬²ñ°÷¼ïÊÌ
+$arrCustomerType = array(
+						1 => "²ñ°÷",
+						2 => "¥á¥ë¥Þ¥¬ÅÐÏ¿",
+						//3 => "CSVÅÐÏ¿"
+						);
+
+//---- ¸¡º÷¹àÌÜ
+$arrSearchColumn = array(
+							array(  "column" => "name",				"convert" => "aKV"),
+							array(  "column" => "pref",				"convert" => "n" ),
+							array(  "column" => "kana",				"convert" => "CKV"),
+							array(  "column" => "sex",				"convert" => "" ),
+							array(  "column" => "tel",				"convert" => "n" ),
+							array(  "column" => "job",				"convert" => "" ),
+							array(  "column" => "email",			"convert" => "a" ),
+							array(  "column" => "htmlmail",			"convert" => "n" ),
+							array(  "column" => "customer",			"convert" => "" ),
+							array(  "column" => "buy_total_from",	"convert" => "n" ),
+							array(  "column" => "buy_total_to",		"convert" => "n" ),
+							array(  "column" => "buy_times_from",	"convert" => "n" ),
+							array(  "column" => "buy_times_to",		"convert" => "n" ),
+							array(  "column" => "birth_month",		"convert" => "n" ),
+							array(  "column" => "b_start_year",		"convert" => "n" ),
+							array(  "column" => "b_start_month",	"convert" => "n" ),
+							array(  "column" => "b_start_day",		"convert" => "n" ),
+							array(  "column" => "b_end_year",		"convert" => "n" ),
+							array(  "column" => "b_end_month",		"convert" => "n" ),
+							array(  "column" => "b_end_day",		"convert" => "n" ),
+							array(  "column" => "start_year",		"convert" => "n" ),
+							array(  "column" => "start_month",		"convert" => "n" ),
+							array(  "column" => "start_day",		"convert" => "n" ),
+							array(  "column" => "end_year",			"convert" => "n" ),
+							array(  "column" => "end_month",		"convert" => "n" ),
+							array(  "column" => "end_day",			"convert" => "n" ),
+							array(  "column" => "buy_start_year",	"convert" => "n" ),
+							array(  "column" => "buy_start_month",	"convert" => "n" ),
+							array(  "column" => "buy_start_day",	"convert" => "n" ),
+							array(  "column" => "buy_end_year",		"convert" => "n" ),
+							array(  "column" => "buy_end_month",	"convert" => "n" ),
+							array(  "column" => "buy_end_day",		"convert" => "n" ),
+							array(  "column" => "buy_product_code",	"convert" => "aKV" )
+							,array(  "column" => "buy_product_name",	"convert" => "aKV" )
+							,array(  "column" => "category_id",	"convert" => "" )			
+							,array(  "column" => "buy_total_from",	"convert" => "n" )		
+							,array(  "column" => "buy_total_to",	"convert" => "n" )		
+						 );
+
+//--------------------------------------------------------------------------------------------------------------------------------------
+
+//---- HTML¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤¹¤ë¾ì¹ç¡¢¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë¡£	
+function lfGetHtmlTemplateData($id) {
+	
+	global $conn;
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
+	$result = $conn->getAll($sql, array($id));
+	$list_data = $result[0];
+
+	// ¥á¥¤¥ó¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$main = $conn->getAll($sql, array($list_data["main_product_id"]));
+	$list_data["main"] = $main[0];
+
+	// ¥µ¥Ö¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$k = 0;
+	$l = 0;
+	for ($i = 1; $i <= 12; $i ++) {
+		if ($l == 4) {
+			$l = 0;
+			$k ++;
+		}
+		$result = "";
+		$j = sprintf("%02d", $i);
+		if ($i > 0 && $i < 5 ) $k = 0;
+		if ($i > 4 && $i < 9 ) $k = 1;
+		if ($i > 8 && $i < 13 ) $k = 2;	
+		
+		if (is_numeric($list_data["sub_product_id" .$j])) {
+			$result = $conn->getAll($sql, array($list_data["sub_product_id" .$j]));
+			$list_data["sub"][$k][$l] = $result[0];
+			$list_data["sub"][$k]["data_exists"] = "OK";	//Åö³ºÃÊ¤Ë¥Ç¡¼¥¿¤¬£±¤Ä°Ê¾åÂ¸ºß¤¹¤ë¥Õ¥é¥°
+		}
+		$l ++;
+	}
+	return $list_data;
+}
+
+//---   ¥Æ¥ó¥×¥ì¡¼¥È¤Î¼ïÎà¤òÊÖ¤¹
+function lfGetTemplateMethod($conn, $templata_id){
+	
+	if ( sfCheckNumLength($template_id) ){
+		$sql = "SELECT mail_method FROM dtb_mailmaga_template WEHRE template_id = ?";
+	}	
+}
+
+//---   hiddenÍ×ÁÇ½ÐÎÏÍÑÇÛÎó¤ÎºîÀ®
+function lfGetHidden( $array ){
+	if ( is_array($array) ){
+		foreach( $array as $key => $val ){
+			if ( is_array( $val )){
+				for ( $i=0; $i<count($val); $i++){
+					$return[ $key.'['.$i.']'] = $val[$i];
+				}				
+			} else {
+				$return[$key] = $val;			
+			}
+		}
+	}
+	return $return;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrSearchColumn) {
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrSearchColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+
+	$new_array = array();
+	foreach ($arrConvList as $key => $val) {
+		if ( strlen($array[$key]) > 0 ){						// ¥Ç¡¼¥¿¤Î¤¢¤ë¤â¤Î¤À¤±ÊÖ¤¹
+			$new_array[$key] = $array[$key];
+			if( strlen($val) > 0) {
+				$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
+			}
+		}
+	}
+	return $new_array;
+	
+}
+
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array, $flag = '') {
+
+	// flag ¤ÏÅÐÏ¿»þÍÑ
+	
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¸ÜµÒ¥³¡¼¥É", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾(¥«¥Ê)", "kana", STEXT_LEN), array("KANA_CHECK", "MAX_LENGTH_CHECK"));
+
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+		
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(³«»Ï)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(½ªÎ»)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	if ((is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && ($array["buy_times_from"] > $array["buy_times_to"]) ) $objErr->arrErr["buy_times_from"] .= "¢¨ ¹ØÆþ²ó¿ô¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	
+	$objErr->doFunc(array("ÃÂÀ¸·î", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)", "b_start_year", "b_start_month", "b_start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(½ªÎ»Æü)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)","ÃÂÀ¸Æü(½ªÎ»Æü)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþ(½ªÎ»Æü)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊ¥³¡¼¥É", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊÌ¾", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(³«»Ï)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(½ªÎ»)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
+	
+	//¹ØÆþ¶â³Û(from) ¡ä ¹ØÆþ¶â³Û(to) ¤Î¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë
+	if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && 
+		 ($array["buy_total_from"] > $array["buy_total_to"]) ) {
+		 $objErr->arrErr["buy_total_from"] .= "¢¨ ¹ØÆþ¶â³Û¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	 }
+
+	if ( $flag ){
+		$objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥ÈID", "template_id"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("¥á¡¼¥ëÁ÷¿®Ë¡Ë¡", "mail_method"), array("EXIST_CHECK", "NUM_CHECK"));
+		/* ¼«Æ°ÇÛ¿®µ¡Ç½¤Ï¥µ¡¼¥Ð¡¼¤ÎÀßÄê¤¬É¬Í×¤Ê¤¿¤á¡¢ºï½ü
+		
+		$objErr->doFunc(array("ÇÛ¿®Æü¡ÊÇ¯¡Ë","send_year"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡Ê·î¡Ë","send_month"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡ÊÆü¡Ë","send_day"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡Ê»þ¡Ë","send_hour"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡ÊÊ¬¡Ë","send_minutes"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü", "send_year", "send_month", "send_day"), array("CHECK_DATE"));
+		$objErr->doFunc(array("ÇÛ¿®Æü", "send_year", "send_month", "send_day","send_hour", "send_minutes"), array("ALL_EXIST_CHECK"));
+		*/
+		$objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("ËÜÊ¸", 'body', LLTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));	// HTML¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤·¤Ê¤¤¾ì¹ç
+	}
+	
+	return $objErr->arrErr;
+}
+
+/* ¥Æ¥ó¥×¥ì¡¼¥ÈID¤Èsubject¤ÎÇÛÎó¤òÊÖ¤¹ */ 
+function getTemplateList($conn){
+	global $arrMagazineTypeAll;
+	
+	$sql = "SELECT template_id, subject, mail_method FROM dtb_mailmaga_template WHERE delete = 0 ";
+	if ($_POST["htmlmail"] == 2) {
+		$sql .= " AND mail_method = 2 ";	//TEXT´õË¾¼Ô¤Ø¤ÎTEST¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¥ê¥¹¥È
+	}
+	$sql .= " ORDER BY template_id DESC";
+	$result = $conn->getAll($sql);
+	
+	if ( is_array($result) ){ 
+		foreach( $result as $line ){
+			$return[$line['template_id']] = "¡Ú" . $arrMagazineTypeAll[$line['mail_method']] . "¡Û" . $line['subject'];  
+		}
+	}
+	
+	return $return;
+}
+
+/* ¥Æ¥ó¥×¥ì¡¼¥ÈID¤«¤é¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤ò¼èÆÀ */ 
+function getTemplateData($conn, $id){
+	
+	if ( sfCheckNumLength($id) ){
+		$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? ORDER BY template_id DESC";
+		$result = $conn->getAll( $sql, array($id) );
+		if ( is_array($result) ) {
+			$return = $result[0];
+		}
+	}
+	return $return;
+}
+
+
+
+?>
Index: /temp/trunk/html/admin/mail/index.php
===================================================================
--- /temp/trunk/html/admin/mail/index.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/index.php	(revision 1328)
@@ -0,0 +1,361 @@
+<?php
+
+require_once("../require.php");
+require_once("./inc_mailmagazine.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrHtmlmail;
+	var $arrNowDate;
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/index.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "index";
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = 'ÇÛ¿®ÆâÍÆÀßÄê';
+		
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrJob;
+		$arrJob["ÉÔÌÀ"] = "ÉÔÌÀ";
+		$this->arrJob = $arrJob;
+		global $arrSex;		
+		$this->arrSex = $arrSex;
+		global $arrPageRows;
+		$this->arrPageRows = $arrPageRows;
+		// ¥Ú¡¼¥¸¥Ê¥ÓÍÑ
+		$this->tpl_pageno = $_POST['pageno'];
+		global $arrMAILMAGATYPE;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		$this->arrHtmlmail[''] = "¤¹¤Ù¤Æ";
+		$this->arrHtmlmail[1] = $arrMAILMAGATYPE[1];
+		$this->arrHtmlmail[2] = $arrMAILMAGATYPE[2];
+		global $arrCustomerType;
+		$this->arrCustomerType = $arrCustomerType;
+	}
+}
+
+class LC_HTMLtemplate {
+	var $list_data;
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date();
+$objPage->objDate = $objDate;
+$objPage->arrTemplate = getTemplateList($conn);
+
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+/*
+	query:ÇÛ¿®ÍúÎò¡Ö³ÎÇ§¡×
+*/
+if ($_GET["mode"] == "query" && sfCheckNumLength($_GET["send_id"])) {
+	// Á÷¿®ÍúÎò¤è¤ê¡¢Á÷¿®¾ò·ï³ÎÇ§²èÌÌ
+	$sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?";
+	$result = $conn->getOne($sql, array($_GET["send_id"]));
+	$tpl_path = "mail/query.tpl";
+		
+	$objPage->list_data = unserialize($result);
+	
+	$objView->assignobj($objPage);
+	$objView->display($tpl_path);
+	exit;
+}
+
+if($_POST['mode'] == 'delete') {
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_customer_mail", "email = ?", array($_POST['result_email']));
+}
+
+switch($_POST['mode']) {
+/*
+	search:¡Ö¸¡º÷¡×¥Ü¥¿¥ó
+	back:¸¡º÷·ë²Ì²èÌÌ¡ÖÌá¤ë¡×¥Ü¥¿¥ó
+*/
+case 'delete':
+case 'search':
+case 'back':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$objPage->list_data = lfConvertParam($_POST, $arrSearchColumn);
+
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data);
+
+	//-- ¸¡º÷³«»Ï
+	if (!is_array($objPage->arrErr)) {
+		$objPage->list_data['name'] = sfManualEscape($objPage->list_data['name']);
+		// hiddenÍ×ÁÇºîÀ®
+		$objPage->arrHidden = lfGetHidden($objPage->list_data);
+
+		//-- ¸¡º÷¥Ç¡¼¥¿¼èÆÀ	
+		$objSelect = new SC_CustomerList($objPage->list_data, "magazine");
+
+		// À¸À®¤µ¤ì¤¿WHEREÊ¸¤ò¼èÆÀ¤¹¤ë		
+		list($where, $arrval) = $objSelect->getWhere();
+		// ¡ÖWHERE¡×ÉôÊ¬¤òºï½ü¤¹¤ë¡£
+		$where = ereg_replace("^WHERE", "", $where);
+
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$objQuery = new SC_Query();
+		$from = "dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";
+
+		// ¹Ô¿ô¤Î¼èÆÀ
+		$linemax = $objQuery->count($from, $where, $arrval);
+		$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+
+		// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+		$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, SEARCH_PMAX, "fnResultPageNavi", NAVI_PMAX);
+		$objPage->arrPagenavi = $objNavi->arrPagenavi;	
+		$startno = $objNavi->start_row;
+
+		// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+		$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+		// É½¼¨½ç½ø
+		$objQuery->setorder("customer_id DESC");
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$col = "customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,mail_flag";
+		$objPage->arrResults = $objQuery->select($col, $from, $where, $arrval);
+
+		//¸½ºß»þ¹ï¤Î¼èÆÀ
+		$objPage->arrNowDate = lfGetNowDate();
+	}
+	break;
+/*
+	input:¸¡º÷·ë²Ì²èÌÌ¡ÖÇÛ¿®ÆâÍÆÀßÄê¡×¥Ü¥¿¥ó
+*/
+case 'input':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$objPage->list_data = lfConvertParam($_POST, $arrSearchColumn);
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data);
+	//-- ¥¨¥é¡¼¤Ê¤·
+	if (!is_array($objPage->arrErr)) {
+		//-- ¸½ºß»þ¹ï¤Î¼èÆÀ
+		$objPage->arrNowDate = lfGetNowDate();
+		$objPage->arrHidden = lfGetHidden($objPage->list_data); // hiddenÍ×ÁÇºîÀ®
+		$objPage->tpl_mainpage = 'mail/input.tpl';
+	}
+	break;
+/*
+	template:¥Æ¥ó¥×¥ì¡¼¥ÈÁªÂò
+*/
+case 'template':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$objPage->list_data = lfConvertParam($_POST, $arrSearchColumn);
+	
+	//-- »þ¹ïÀßÄê¤Î¼èÆÀ
+	$objPage->arrNowDate['year'] = $_POST['send_year'];
+	$objPage->arrNowDate['month'] = $_POST['send_month'];
+	$objPage->arrNowDate['day'] = $_POST['send_day'];
+	$objPage->arrNowDate['hour'] = $_POST['send_hour'];
+	$objPage->arrNowDate['minutes'] = $_POST['send_minutes'];
+	
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data);
+
+	//-- ¸¡º÷³«»Ï
+	if ( ! is_array($objPage->arrErr)) {
+		$objPage->list_data['name'] = sfManualEscape($objPage->list_data['name']);
+		$objPage->arrHidden = lfGetHidden($objPage->list_data); // hiddenÍ×ÁÇºîÀ®
+	
+		$objPage->tpl_mainpage = 'mail/input.tpl';
+		$template_data = getTemplateData($conn, $_POST['template_id']);
+		if ( $template_data ){
+			foreach( $template_data as $key=>$val ){
+				$objPage->list_data[$key] = $val;
+			}
+		}
+
+		//-- HTML¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤¹¤ë¾ì¹ç¤Ï¡¢HTML¥½¡¼¥¹¤òÀ¸À®¤·¤ÆBODY¤ØÁÞÆþ
+		if ( $objPage->list_data["mail_method"] == 3) {
+			$objTemplate = new LC_HTMLtemplate;
+			$objTemplate->list_data = lfGetHtmlTemplateData($_POST['template_id']);
+			$objSiteInfo = new SC_SiteInfo();
+			$objTemplate->arrInfo = $objSiteInfo->data;
+			//¥á¡¼¥ëÃ´Åö¼Ì¿¿¤ÎÉ½¼¨
+			$objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+			$objUpFile->addFile("¥á¡¼¥ëÃ´Åö¼Ì¿¿", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+			$objUpFile->setDBFileList($objTemplate->list_data);
+			$objTemplate->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+			$objMakeTemplate = new SC_AdminView();
+			$objMakeTemplate->assignobj($objTemplate);		
+			$objPage->list_data["body"] = $objMakeTemplate->fetch("mail/html_template.tpl");
+		}
+	}
+	break;
+/*
+	regist_confirm:¡ÖÆþÎÏÆâÍÆ¤ò³ÎÇ§¡×
+	regist_back:¡Ö¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê²èÌÌ¤ØÌá¤ë¡×
+	regist_complete:¡ÖÅÐÏ¿¡×
+*/	
+case 'regist_confirm':
+case 'regist_back':
+case 'regist_complete':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$arrCheckColumn = array_merge( $arrSearchColumn, $arrRegistColumn );
+	$objPage->list_data = lfConvertParam($_POST, $arrCheckColumn);
+	
+	//¸½ºß»þ¹ï¤Î¼èÆÀ
+	$objPage->arrNowDate = lfGetNowDate();
+
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data, 1);
+	$objPage->tpl_mainpage = 'mail/input.tpl';
+	$objPage->arrHidden = lfGetHidden($objPage->list_data); // hiddenÍ×ÁÇºîÀ®
+	
+	//-- ¸¡º÷³«»Ï
+	if ( ! is_array($objPage->arrErr)) {
+			$objPage->list_data['name'] = sfManualEscape($objPage->list_data['name']);
+		if ( $_POST['mode'] == 'regist_confirm'){
+			$objPage->tpl_mainpage = 'mail/input_confirm.tpl';
+		} else if( $_POST['mode'] == 'regist_complete' ){
+			lfRegistData($objPage->list_data);
+			header("Location: /admin/mail/history.php");
+			exit;			
+		}
+	}
+	break;
+default:
+	break;
+}
+
+// ÇÛ¿®»þ´Ö¤ÎÇ¯¤ò¡¢¡Ö¸½ºßÇ¯¢·¸½ºßÇ¯¡Ü£±¡×¤ÎÈÏ°Ï¤ËÀßÄê
+for ($year=date("Y"); $year<=date("Y") + 1;$year++){
+	$arrYear[$year] = $year;
+}
+$objPage->arrYear = $arrYear;
+
+$objPage->arrCustomerOrderId = lfGetCustomerOrderId($_POST['buy_product_code']);
+
+$objPage->arrCatList = sfGetCategoryList();
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+// ¾¦ÉÊ¥³¡¼¥É¤Ç¸¡º÷¤µ¤ì¤¿¾ì¹ç¤Ë¥Ò¥Ã¥È¤·¤¿¼õÃíÈÖ¹æ¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetCustomerOrderId($keyword) {
+	if($keyword != "") {
+		$col = "customer_id, order_id";
+		$from = "dtb_order LEFT JOIN dtb_order_detail USING(order_id)";
+		$where = "product_code LIKE ? AND delete = 0";
+		$val = sfManualEscape($keyword);
+		$arrVal[] = "%$val%";
+		$objQuery = new SC_Query();
+		$objQuery->setgroupby("customer_id, order_id");
+		$arrRet = $objQuery->select($col, $from, $where, $arrVal);
+		$arrCustomerOrderId = sfArrKeyValues($arrRet, "customer_id", "order_id");
+	}
+	return $arrCustomerOrderId;	
+}
+
+function lfMakeCsvData( $send_id ){
+		
+	global $conn;
+
+	$arrTitle  = array(	 'name01','email');
+				
+	$sql = "SELECT name01,email FROM dtb_send_customer WHERE send_id = ? ORDER BY email";
+	$result = $conn->getAll($sql, array($send_id) );
+	
+	if ( $result ){
+		$return = lfGetCSVData( $result, $arrTitle);
+	}
+	return $return;	
+}
+
+//---- CSV½ÐÎÏÍÑ¥Ç¡¼¥¿¼èÆÀ
+function lfGetCSVData( $array, $arrayIndex){	
+	
+	for ($i=0; $i<count($array); $i++){
+		
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	return $return;
+}
+
+//¸½ºß»þ¹ï¤Î¼èÆÀ¡ÊÇÛ¿®»þ´Ö¥Ç¥Õ¥©¥ë¥ÈÃÍ¡Ë
+function lfGetNowDate(){
+	$nowdate = date("Y/n/j/G/i");
+	list($year, $month, $day, $hour, $minute) = split("[/]", $nowdate);
+	$arrNowDate = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minutes' => $minute);
+	foreach ($arrNowDate as $key => $val){
+		switch ($key){
+			case 'minutes':
+			$val = ereg_replace('^[0]','', $val);
+			if ($val < 30){
+			$list_date[$key] = '30';
+			}else{
+			$list_date[$key] = '00';
+			}
+			break;
+			case 'year':
+			case 'month':
+			case 'day':
+			$list_date[$key] = $val;
+			break;
+		}
+	}
+		if ($arrNowDate['minutes'] < 30){
+			$list_date['hour'] = $hour;
+		}else{
+			$list_date['hour'] = $hour + 1;
+		}
+	return $list_date;
+}
+
+// ÇÛ¿®ÆâÍÆ¤ÈÇÛ¿®¥ê¥¹¥È¤ò½ñ¤­¹þ¤à
+function lfRegistData($arrData){
+	
+	global $conn;
+	global $arrSearchColumn;
+		
+	$objSelect = new SC_CustomerList( lfConvertParam($arrData, $arrSearchColumn), "magazine" );
+	$search_data = $conn->getAll($objSelect->getListMailMagazine(), $objSelect->arrVal);
+	$dataCnt = count($search_data);
+
+	$dtb_send_history = array();
+	$dtb_send_history["send_id"] = $conn->getOne("SELECT NEXTVAL('dtb_send_history_send_id_seq')");
+	$dtb_send_history["mail_method"] = $arrData['mail_method'];
+	$dtb_send_history["subject"] = $arrData['subject'];
+	$dtb_send_history["body"] = $arrData['body'];
+	$dtb_send_history["start_date"] = $arrData['send_year'] ."/".$arrData['send_month']."/".$arrData['send_day']." ".$arrData['send_hour'].":".$arrData['send_minutes'];
+	$dtb_send_history["creator_id"] = $_SESSION['member_id'];
+	$dtb_send_history["send_count"] = $dataCnt;
+	$arrData['body'] = "";
+	$dtb_send_history["search_data"] = serialize($arrData);
+	$conn->autoExecute("dtb_send_history", $dtb_send_history );		
+	
+	if ( is_array( $search_data ) ){
+		foreach( $search_data as $line ){
+			$dtb_send_customer = array();
+			$dtb_send_customer["customer_id"] = $line["customer_id"];
+			$dtb_send_customer["send_id"] = $dtb_send_history["send_id"];
+			$dtb_send_customer["email"] = $line["email"];
+			
+			$dtb_send_customer["name"] = $line["name01"] . " " . $line["name02"];
+				
+			$conn->autoExecute("dtb_send_customer", $dtb_send_customer );					
+		}	
+	}	
+}
+
+?>
Index: /temp/trunk/html/admin/mail/template_input.php
===================================================================
--- /temp/trunk/html/admin/mail/template_input.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/template_input.php	(revision 1328)
@@ -0,0 +1,127 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $arrSession;
+	var $site_info;
+	var $objDate;
+	var $arrForm;
+	var $mode;
+	var $arrMagazineType;
+	var $title;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/template_input.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "template";
+		$this->tpl_subtitle = '¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objPage->arrMagazineType = $arrMagazineType;
+$objPage->mode = "regist";
+
+// id¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¤È¤­¤Ï¡ÖÊÔ½¸¡×É½¼¨
+if ( $_REQUEST['template_id'] ){
+	$objPage->title = "ÊÔ½¸";
+} else {
+	$objPage->title = "¿·µ¬ÅÐÏ¿";
+}
+
+// ¥â¡¼¥É¤Ë¤è¤ë½èÍýÊ¬´ô
+if ( $_GET['mode'] == 'edit' && sfCheckNumLength($_GET['template_id'])===true ){
+	
+	// ÊÔ½¸
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND delete = 0";
+	$result = $conn->getAll($sql, array($_GET['template_id']));
+	$objPage->arrForm = $result[0];
+	
+		
+} elseif ( $_POST['mode'] == 'regist' ) {
+	
+	// ¿·µ¬ÅÐÏ¿
+	$objPage->arrForm = lfConvData( $_POST );
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	
+	if ( ! $objPage->arrErr ){
+		// ¥¨¥é¡¼¤¬Ìµ¤¤¤È¤­¤ÏÅÐÏ¿¡¦ÊÔ½¸
+		lfRegistData( $objPage->arrForm, $_POST['template_id']);	
+		sfReload("mode=complete");	// ¼«Ê¬¤òºÆÆÉ¹þ¤·¤Æ¡¢´°Î»²èÌÌ¤ØÁ«°Ü
+	}
+	
+} elseif ( $_GET['mode'] == 'complete' ) {		
+	
+	// ´°Î»²èÌÌÉ½¼¨
+	$objPage->tpl_mainpage = 'mail/template_complete.tpl';
+	
+} 
+
+
+
+
+
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+function lfRegistData( $arrVal, $id = null ){
+	
+	$query = new SC_Query();
+	
+	$sqlval['subject'] = $arrVal['subject'];
+	$sqlval['mail_method'] = $arrVal['mail_method'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['body'] = $arrVal['body'];
+	
+	if ( $id ){
+		$query->update("dtb_mailmaga_template", $sqlval, "template_id=".$id );
+	} else {
+		$query->insert("dtb_mailmaga_template", $sqlval);
+	}
+}
+
+
+
+function lfConvData( $data ){
+	
+	 // Ê¸»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë							
+	$arrFlag = array(
+					  "subject" => "aKV"
+					 ,"body" => "aKV"
+					);
+		
+	if ( is_array($data) ){
+		foreach ($arrFlag as $key=>$line) {
+			$data[$key] = mb_convert_kana($data[$key], $line);
+		}
+	}
+
+	return $data;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	
+	$objErr->doFunc(array("¥á¡¼¥ë·Á¼°", "mail_method"), array("EXIST_CHECK", "ALNUM_CHECK"));
+	$objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ËÜÊ¸", 'body', LLTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+
+
+?>
Index: /temp/trunk/html/admin/mail/template.php
===================================================================
--- /temp/trunk/html/admin/mail/template.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/template.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $list_data;
+	var $arrMagazineType;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/template.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "template";
+		$this->tpl_subtitle = '¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if ( $_GET['mode'] == "delete" && sfCheckNumLength($_GET['id'])===true ){
+
+	// ¥á¡¼¥ëÃ´Åö¤Î²èÁü¤¬¤¢¤ì¤Ðºï½ü¤·¤Æ¤ª¤¯
+	$sql = "SELECT charge_image FROM dtb_mailmaga_template WHERE template_id = ?";
+	$result = $conn->getOne($sql, array($_GET["id"]));
+	if (strlen($result) > 0) {
+		@unlink(IMAGE_SAVE_DIR. $result);
+	}
+	
+	// ÅÐÏ¿ºï½ü
+	$sql = "UPDATE dtb_mailmaga_template SET delete = 1 WHERE template_id = ?";
+	$conn->query($sql, array($_GET['id']));
+	sfReload();
+}
+
+
+$sql = "SELECT *, to_char(create_date, 'YYYY/MM/DD HH24:MI') as disp_date FROM dtb_mailmaga_template WHERE delete = 0 ORDER BY create_date DESC";
+$objPage->list_data = $list_data = $conn->getAll($sql);
+$objPage->arrMagazineType = $arrMagazineTypeAll;
+
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+?>
Index: /temp/trunk/html/admin/mail/sendmail.php
===================================================================
--- /temp/trunk/html/admin/mail/sendmail.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/sendmail.php	(revision 1328)
@@ -0,0 +1,158 @@
+<?php
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir."/../require.php");
+$conn = new SC_DbConn();
+$objSite = new SC_SiteInfo($conn);
+
+if($_GET['mode'] == 'now') {
+	//----¡¡Ì¤Á÷¿®¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+	$time_data = $conn->getAll( "SELECT send_id FROM dtb_send_history  WHERE complete_count = 0 AND delete = 0 ORDER BY send_id ASC, start_date ASC" );
+} else {
+	$sql = "SELECT send_id FROM dtb_send_history  ";
+	$sql.= "WHERE start_date  BETWEEN current_timestamp + '- 5 minutes' AND current_timestamp + '5 minutes' AND delete = 0 ORDER BY send_id ASC, start_date ASC";
+	//----¡¡30Ê¬Ëè¤ËCron¤¬Á÷¿®»þ´Ö¥Ç¡¼¥¿³ÎÇ§
+	$time_data = $conn->getAll($sql);
+}
+
+$count = count($time_data);
+
+if( $count > 0 ){
+	print("start sending <br />\n");
+} else {
+	print("not found <br />\n");
+	exit;
+}
+
+//---- ¥á¡¼¥ëÁ÷¿®
+for( $i = 0; $i < count( $time_data ); $i++ ) {
+
+	$sql = "SELECT * FROM dtb_send_customer WHERE send_id = ? AND (send_flag = 2 OR send_flag IS NULL)";
+	$list_data[] = $conn->getAll( $sql, array( $time_data[$i]["send_id"] ) );
+	
+	$sql = "SELECT * FROM dtb_send_history WHERE send_id = ?";
+	$mail_data[] = $conn->getAll( $sql, array(  $time_data[$i]["send_id"] ) );
+
+}
+
+//---- Á÷¿®·ë²Ì¥Õ¥é¥°ÍÑSQL
+$sql_flag ="UPDATE dtb_send_customer SET send_flag = ? WHERE send_id = ? AND customer_id = ?";
+$objMail = new GC_SendMail();
+
+//----¡¡¥á¡¼¥ëÀ¸À®¤ÈÁ÷¿®
+for( $i = 0; $i < count( $time_data ); $i++ ) {
+
+	for( $j = 0; $j < count( $list_data[$i] ); $j ++ ) {
+
+		$customerName = "";
+		$mailBody = "";
+		$sendFlag = "";
+
+		//-- ¸ÜµÒÌ¾¤ÎÊÑ´¹
+		$name = trim($list_data[$i][$j]["name"]);
+		
+		if ($name == "") {
+			$name = "¤ªµÒ";
+		}
+		
+		$customerName = htmlspecialchars($name);
+		$subjectBody = ereg_replace( "{name}", $customerName , $mail_data[$i][0]["subject"] );
+		$mailBody = ereg_replace( "{name}", $customerName ,  $mail_data[$i][0]["body"] );
+
+		//-- ¥Æ¥­¥¹¥È¥á¡¼¥ëÇÛ¿®¤Î¾ì¹ç	
+		if( $mail_data[$i][0]["mail_method"] == 2 ) {
+
+			$sendResut = MAIL_SENDING(
+										 $list_data[$i][$j]["email"]				//¡¡¸ÜµÒ°¸Àè
+										,$subjectBody								//¡¡Subject
+										,$mailBody									//¡¡¥á¡¼¥ëËÜÊ¸
+										,$objSite->data["email03"]					//¡¡Á÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹
+										,$objSite->data["company_name"]				//¡¡Á÷¿®¸µÌ¾
+										,$objSite->data["email03"]					//¡¡reply_to
+										,$objSite->data["email04"]					//¡¡return_path
+										,$objSite->data["email04"]					//¡¡errors_to
+																			 );
+
+		//--  HTML¥á¡¼¥ëÇÛ¿®¤Î¾ì¹ç	
+		} elseif( $mail_data[$i][0]["mail_method"] == 1 || $mail_data[$i][0]["mail_method"] == 3) {
+			
+			$sendResut = HTML_MAIL_SENDING(
+											 $list_data[$i][$j]["email"]
+											,$subjectBody
+											,$mailBody
+											,$objSite->data["email03"]					//¡¡Á÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹
+											,$objSite->data["company_name"]				//¡¡Á÷¿®¸µÌ¾
+											,$objSite->data["email03"]					//¡¡reply_to
+											,$objSite->data["email04"]					//¡¡return_path
+											,$objSite->data["email04"]					//¡¡errors_to
+																	 );
+		}
+
+	
+		//-- Á÷¿®´°Î»¤Ê¤é1¡¢¼ºÇÔ¤Ê¤é0¤ò¥á¡¼¥ëÁ÷¿®·ë²Ì¥Õ¥é¥°¤È¤·¤ÆDB¤ËÁÞÆþ
+		if( ! $sendResut ){
+			 $sendFlag = "-1";
+		} else {
+			$sendFlag = "1";
+			
+			// ´°Î»¤ò1¤³Áý¤ä¤¹
+			$sql = "UPDATE dtb_send_history SET complete_count = complete_count + 1 WHERE send_id = ?";
+			$conn->query( $sql, array($mail_data[$i][0]["send_id"]) );
+		}
+
+		$conn->query( $sql_flag, array( $sendFlag, $mail_data[$i][0]["send_id"], $list_data[$i][$j]["customer_id"] ) );
+		
+		
+
+	}
+
+	//--- ¥á¡¼¥ëÁ´·ïÁ÷¿®´°Î»¸å¤Î½èÍý
+	$completeSql = "UPDATE dtb_send_history SET end_date = now() WHERE send_id = ?";
+	$conn->query( $completeSql, array( $time_data[$i]["send_id"] ) );
+
+	//---¡¡Á÷¿®´°Î»¡¡Êó¹ð¥á¡¼¥ë
+	$compData =  date("YÇ¯m·îdÆüH»þiÊ¬" . "  ²¼µ­¥á¡¼¥ë¤ÎÇÛ¿®¤¬´°Î»¤·¤Þ¤·¤¿¡£" );
+	MAIL_SENDING(
+					 $objSite->data["email03"]	
+					,$compData
+					,$mail_data[$i][0]["body"]
+					,$objSite->data["email03"]					//¡¡Á÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹
+					,$objSite->data["company_name"]				//¡¡Á÷¿®¸µÌ¾
+					,$objSite->data["email03"]					//¡¡reply_to
+					,$objSite->data["email04"]					//¡¡return_path
+					,$objSite->data["email04"]					//¡¡errors_to
+				 );
+				 
+	echo "complete\n";
+
+}
+
+
+//--- ¥Æ¥­¥¹¥È¥á¡¼¥ëÇÛ¿®
+function MAIL_SENDING( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+
+
+	$mail_obj = new GC_SendMail();	
+	$mail_obj->setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc );
+		
+	if( $mail_obj->sendMail() ) {
+		return true;
+	}
+	
+}
+
+//--- HTML¥á¡¼¥ëÇÛ¿®
+function HTML_MAIL_SENDING( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+
+
+	$html_mail_obj = new GC_SendMail();
+	$html_mail_obj->setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc );
+
+			
+	if( $html_mail_obj->sendHtmlMail() ) {
+		return true;	
+	}
+	
+}
+
+
+?>
Index: /temp/trunk/html/admin/mail/history.php
===================================================================
--- /temp/trunk/html/admin/mail/history.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/history.php	(revision 1328)
@@ -0,0 +1,62 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/history.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "history";
+		$this->tpl_subtitle = 'ÇÛ¿®ÍúÎò';
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ºï½ü»þ
+if ( sfCheckNumLength($_GET['send_id']) && ($_GET['mode']=='delete') ){
+	
+	$sql = "UPDATE dtb_send_history SET delete = 1 WHERE send_id = ?";
+	$conn->query($sql, array($_GET['send_id']) );
+	sfReload();
+
+}	
+	$col = "*";
+	$from = "dtb_send_history";
+	
+	$where .= " delete = ?";
+	$arrval[] = 0;
+	
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+	
+	// É½¼¨½ç½ø
+	$order = "start_date DESC, send_id DESC";
+	$objQuery->setorder($order);
+	
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrDataList = $objQuery->select($col, $from, $where, $arrval);
+	
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
Index: /temp/trunk/html/admin/mail/preview.php
===================================================================
--- /temp/trunk/html/admin/mail/preview.php	(revision 1328)
+++ /temp/trunk/html/admin/mail/preview.php	(revision 1328)
@@ -0,0 +1,96 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $body;
+	var $list_data;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/preview.tpl';
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+if ( $_POST['body'] ){
+	$objPage->body = $_POST['body'];
+
+// HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¤Î¥×¥ì¥Ó¥å¡¼
+} elseif ($_REQUEST["method"] == "template" && sfCheckNumLength($_REQUEST['id'])) {
+
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
+	$result = $conn->getAll($sql, array($_REQUEST["id"]));
+	$objPage->list_data = $result[0];
+	
+	//¥á¡¼¥ëÃ´Åö¼Ì¿¿¤ÎÉ½¼¨
+	$objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+	$objUpFile->addFile("¥á¡¼¥ëÃ´Åö¼Ì¿¿", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+	$objUpFile->setDBFileList($objPage->list_data);
+	// FormÍÑÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+	
+	// ¥á¥¤¥ó¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$main = $conn->getAll($sql, array($objPage->list_data["main_product_id"]));
+	$objPage->list_data["main"] = $main[0];
+
+	// ¥µ¥Ö¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$k = 0;
+	$l = 0;
+	for ($i = 1; $i <= 12; $i ++) {
+		if ($l == 4) {
+			$l = 0;
+			$k ++;
+		}
+		$result = "";
+		$j = sprintf("%02d", $i);
+		if ($i > 0 && $i < 5 ) $k = 0;
+		if ($i > 4 && $i < 9 ) $k = 1;
+		if ($i > 8 && $i < 13 ) $k = 2;	
+		
+		if (is_numeric($objPage->list_data["sub_product_id" .$j])) {
+			$result = $conn->getAll($sql, array($objPage->list_data["sub_product_id" .$j]));
+			$objPage->list_data["sub"][$k][$l] = $result[0];
+			$objPage->list_data["sub"][$k]["data_exists"] = "OK";	//Åö³ºÃÊ¤Ë¥Ç¡¼¥¿¤¬£±¤Ä°Ê¾åÂ¸ºß¤¹¤ë¥Õ¥é¥°
+		}
+		$l ++;
+	}
+	$objPage->tpl_mainpage = 'mail/html_template.tpl';
+
+} elseif ( sfCheckNumLength($_GET['send_id']) || sfCheckNumLength($_GET['id'])){
+	if (is_numeric($_GET["send_id"])) {
+		$id = $_GET["send_id"];
+		$sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?";
+	} else {
+		$sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?";
+		$id = $_GET['id'];
+	}
+	$result = $conn->getAll($sql, array($id));
+	
+	
+	if ( $result ){
+		if ( $result[0]["mail_method"] == 2 ){
+			// ¥Æ¥­¥¹¥È·Á¼°¤Î»þ¤Ï¥¿¥°Ê¸»ú¤ò¥¨¥¹¥±¡¼¥×
+			$objPage->escape_flag = 1;
+		}
+		$objPage->body = $result[0]["body"];
+	}
+
+}
+	
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+?>
Index: /temp/trunk/html/cart/index.php
===================================================================
--- /temp/trunk/html/cart/index.php	(revision 1328)
+++ /temp/trunk/html/cart/index.php	(revision 1328)
@@ -0,0 +1,107 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrProductsClass;
+	var $tpl_total_pretax;
+	var $tpl_total_tax;
+	var $tpl_total_point;
+	var $tpl_message;
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/cartin/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'cart/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = "¥«¥´¤ÎÃæ¤ò¸«¤ë";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCartSess = new SC_CartSession();
+$objSiteSess = new SC_SiteSession();
+$objSiteInfo = new SC_SiteInfo();
+$objCustomer = new SC_Customer();
+// ´ðËÜ¾ðÊó¤Î¼èÆÀ
+$arrInfo = $objSiteInfo->data;
+
+// ¾¦ÉÊ¹ØÆþÃæ¤Ë¥«¡¼¥ÈÆâÍÆ¤¬ÊÑ¹¹¤µ¤ì¤¿¡£
+if($objCartSess->getCancelPurchase()) {
+	$objPage->tpl_message = "¾¦ÉÊ¹ØÆþÃæ¤Ë¥«¡¼¥ÈÆâÍÆ¤¬ÊÑ¹¹¤µ¤ì¤Þ¤·¤¿¤Î¤Ç¡¢¤ª¼ê¿ô¤Ç¤¹¤¬¹ØÆþ¼êÂ³¤­¤ò¤ä¤êÄ¾¤·¤Æ²¼¤µ¤¤¡£";
+}
+
+switch($_POST['mode']) {
+case 'up':
+	$objCartSess->upQuantity($_POST['cart_no']);
+	sfReload();
+	break;
+case 'down':
+	$objCartSess->downQuantity($_POST['cart_no']);
+	sfReload();
+	break;
+case 'delete':
+	$objCartSess->delProduct($_POST['cart_no']);
+	sfReload();
+	break;
+case 'confirm':
+	// ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
+	$arrRet = $objCartSess->getCartList();
+	$max = count($arrRet);
+	$cnt = 0;
+	for ($i = 0; $i < $max; $i++) {
+		// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+		$arrData = sfGetProductsClass($arrRet[$i]['id']);
+		// DB¤ËÂ¸ºß¤¹¤ë¾¦ÉÊ
+		if($arrData != "") {
+			$cnt++;
+		}
+	}
+	// ¥«¡¼¥È¾¦ÉÊ¤¬1·ï°Ê¾åÂ¸ºß¤¹¤ë¾ì¹ç
+	if($cnt > 0) {
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		$pre_uniqid = $objSiteSess->getUniqId();
+		// ÃíÊ¸°ì»þID¤ÎÈ¯¹Ô
+		$objSiteSess->setUniqId();
+		$uniqid = $objSiteSess->getUniqId();
+		// ¥¨¥é¡¼¥ê¥È¥é¥¤¤Ê¤É¤Ç´û¤Ëuniqid¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¡¢ÀßÄê¤ò°ú¤­·Ñ¤°
+		if($pre_uniqid != "") {
+			$sqlval['order_temp_id'] = $uniqid;
+			$where = "order_temp_id = ?";
+			$objQuery = new SC_Query();
+			$objQuery->update("dtb_order_temp", $sqlval, $where, array($pre_uniqid));
+		}
+		// ¥«¡¼¥È¤ò¹ØÆþ¥â¡¼¥É¤ËÀßÄê
+		$objCartSess->saveCurrentCart($uniqid);
+		// ¹ØÆþ¥Ú¡¼¥¸¤Ø
+		header("Location: " . sfTrimURL(SSL_URL) . URL_SHOP_TOP);		
+	}
+	break;
+default:
+	break;
+}
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = true;
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+	$objPage->tpl_name = $objCustomer->getValue('name01');
+} 
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $objSiteInfo->data;
+
+// Á÷ÎÁÌµÎÁ¤Þ¤Ç¤Î¶â³Û¤ò·×»»
+$tpl_deliv_free = $objPage->arrInfo['free_rule'] - $objPage->tpl_total_pretax;
+$objPage->tpl_deliv_free = $tpl_deliv_free;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/contact/index.php
===================================================================
--- /temp/trunk/html/contact/index.php	(revision 1328)
+++ /temp/trunk/html/contact/index.php	(revision 1328)
@@ -0,0 +1,204 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'contact/index.tpl';
+		$this->tpl_title = '¤ªÌä¤¤¹ç¤ï¤»(ÆþÎÏ¥Ú¡¼¥¸)';
+		$this->tpl_page_category = 'contact';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$CONF = sf_getBasisData();			// Å¹ÊÞ´ðËÜ¾ðÊó
+sfDomainSessionStart();	 
+
+$objCustomer = new SC_Customer();
+
+if ($objCustomer->isloginSuccess()){
+	$objPage->arrData = $_SESSION['customer'];
+}
+
+//SSLURLÈ½Äê
+if (SSLURL_CHECK == 1){
+	$ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
+	if (!ereg("^https://", $non_ssl_url)){
+		sfDispSiteError(URL_ERROR);
+	}
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+//¥Õ¥©¡¼¥àÃÍÊÑ´¹ÍÑ¥«¥é¥à
+$arrConvertColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "email",		"convert" => "a" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+							 array(  "column" => "contents",   "convert" => "aKV")
+					      );
+
+switch ($_POST['mode']){
+	case 'confirm':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm['email'] = strtolower($_POST['email']);
+	$objPage->arrForm = lfConvertParam($objPage->arrForm,$arrConvertColumn);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	if ( ! $objPage->arrErr ){
+		// ¥¨¥é¡¼Ìµ¤·¤Ç´°Î»²èÌÌ
+		$objPage->tpl_mainpage = 'contact/confirm.tpl';
+		$objPage->tpl_title = '¤ªÌä¤¤¹ç¤ï¤»(³ÎÇ§¥Ú¡¼¥¸)';
+	} else {
+		foreach ($objPage->arrForm as $key => $val){
+		$objPage->$key = $val;
+		}
+	}
+	break;
+	
+	case 'return':
+	foreach ($_POST as $key => $val){
+		$objPage->$key = $val;
+		}
+	break;
+	
+	case 'complete':
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm['email'] = strtolower($_POST['email']);
+	$objPage->arrForm = lfConvertParam($objPage->arrForm,$arrConvertColumn);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	if(!$objPage->arrErr) {
+		lfSendMail($CONF, $objPage);
+		//´°Î»¥Ú¡¼¥¸¤Ø°ÜÆ°¤¹¤ë
+		header("location: ./complete.php");
+		exit;
+	} else {
+		sfDispSiteError(CUSTOMER_ERROR);
+	}
+	break;
+	
+	default:
+	break;
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//------------------------------------------------------------------------------------------------------------------------------------------
+
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô
+function lfErrorCheck($array) {
+
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(array("¤ªÌ¾Á°(À«)", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°(Ì¾)", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥»¥¤)", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥á¥¤)", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌä¤¤¹ç¤ï¤»ÆâÍÆ", "contents", MLTEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	
+
+	return $objErr->arrErr;
+
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrConvertColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrConvertColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ------------  ¥á¡¼¥ëÁ÷¿® ------------ 
+
+function lfSendMail($CONF, $objPage){
+	//¡¡¥Ñ¥¹¥ï¡¼¥ÉÊÑ¹¹¤ªÃÎ¤é¤»¥á¡¼¥ëÁ÷¿®
+	
+	$objMailText = new SC_SiteView();
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	$objPage->tpl_shopname=$arrInfo['shop_name'];
+	$objPage->tpl_infoemail = $arrInfo['email02'];
+	$objMailText->assignobj($objPage);
+	$toCustomerMail = $objMailText->fetch("mail_templates/contact_mail.tpl");
+	$objMail = new GC_SendMail();
+	
+	if ( $objPage->arrForm['email'] ) {
+		$fromMail_name = $objPage->arrForm['name01'] ." ÍÍ";
+		$fromMail_address = $objPage->arrForm['email'];
+	} else {
+		$fromMail_name = $CONF["shop_name"];
+		$fromMail_address = $CONF["email02"];
+	}
+	$subject = sfMakeSubject("¤ªÌä¤¤¹ç¤ï¤»¤¬¤¢¤ê¤Þ¤·¤¿¡£");
+	$objMail->setItem(
+						  $CONF["email02"]					//¡¡°¸Àè
+						, $subject							//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $fromMail_address					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $fromMail_name					//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $fromMail_address					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+														);
+	$objMail->sendMail();
+	
+	$subject = sfMakeSubject("¤ªÌä¤¤¹ç¤ï¤»¤ò¼õ¤±ÉÕ¤±¤Þ¤·¤¿¡£");
+	$objMail->setItem(
+						  ''								//¡¡°¸Àè
+						, $subject							//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $CONF["email02"]					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+														);
+	$objMail->setTo($objPage->arrForm['email'], $objPage->arrForm['name01'] ." ÍÍ");
+	$objMail->sendMail();	
+}
+?>
Index: /temp/trunk/html/contact/complete.php
===================================================================
--- /temp/trunk/html/contact/complete.php	(revision 1328)
+++ /temp/trunk/html/contact/complete.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css[1] = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'contact/complete.tpl';
+		$this->tpl_title .= '¤ªÌä¤¤¹ç¤ï¤»(´°Î»¥Ú¡¼¥¸)';
+		$this->tpl_mainno = 'contact';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = new SC_SiteInfo();
+$objPage->arrInfo = $objSiteInfo->data;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/regist/index.php
===================================================================
--- /temp/trunk/html/regist/index.php	(revision 1328)
+++ /temp/trunk/html/regist/index.php	(revision 1328)
@@ -0,0 +1,193 @@
+<?php
+
+require_once("../require.php");
+
+//---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹
+class LC_Page {
+	
+	var $arrSession;
+	var $tpl_mainpage;
+	var $arrPref;
+
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/regist/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+	}
+}
+
+$objConn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = new SC_SiteInfo();
+$objCustomer = new SC_Customer();
+$CONF = sf_getBasisData();
+$arrInfo = $objSiteInfo->data;
+
+//--¡¡ËÜÅÐÏ¿´°Î»¤Î¤¿¤á¤Ë¥á¡¼¥ë¤«¤éÀÜÂ³¤·¤¿¾ì¹ç
+if ($_GET["mode"] == "regist") {
+	
+	//-- ÆþÎÏ¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($_GET);
+	if ($objPage->arrErr) {
+		$objPage->tpl_mainpage = 'regist/error.tpl';
+		$objPage->tpl_css = "/css/layout/regist/error.css";
+		$objPage->tpl_title = '¥¨¥é¡¼';
+
+	} else {
+		//$objPage->tpl_mainpage = 'regist/complete.tpl';
+		//$objPage->tpl_title = ' ²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+		$registSecretKey = lfRegistData($_GET);			//ËÜ²ñ°÷ÅÐÏ¿¡Ê¥Õ¥é¥°ÊÑ¹¹¡Ë
+		lfSendRegistMail($registSecretKey);				//ËÜ²ñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+
+		// ¥í¥°¥¤¥óºÑ¤ß¤Î¾õÂÖ¤Ë¤¹¤ë¡£
+		$objQuery = new SC_Query();
+		$email = $objQuery->get("dtb_customer", "email", "secret_key = ?", array($registSecretKey));
+		$objCustomer->setLogin($email);
+		header("Location: ./complete.php");
+		exit;
+	}
+
+//--¡¡¤½¤ì°Ê³°¤Î¥¢¥¯¥»¥¹¤ÏÌµ¸ú¤È¤¹¤ë
+} else {
+	$objPage->arrErr["id"] = "Ìµ¸ú¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
+	$objPage->tpl_mainpage = 'regist/error.tpl';
+	$objPage->tpl_css = "/css/layout/regist/error.css";
+	$objPage->tpl_title = '¥¨¥é¡¼';
+
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//---- ÅÐÏ¿
+function lfRegistData($array) {
+	global $objConn;
+	global $arrInfo;
+	
+	do {
+		$secret = sfGetUniqRandomId("r");
+	} while( ($result = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret)) ) != 0);
+
+	$sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1";
+	$email = $objConn->getOne($sql, array($array["id"]));
+
+	$objConn->query("BEGIN");
+	$arrRegist["secret_key"] = $secret;	//¡¡ËÜÅÐÏ¿IDÈ¯¹Ô
+	$arrRegist["status"] = 2;
+	$arrRegist["update_date"] = "NOW()";
+	
+	$objQuery = new SC_Query();
+	$where = "secret_key = ? AND status = 1";
+	
+	$arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
+	// ²ñ°÷ÅÐÏ¿»þ¤Î²Ã»»¥Ý¥¤¥ó¥È(¹ØÆþ»þ²ñ°÷ÅÐÏ¿¤Î¾ì¹ç¤Ï¡¢¥Ý¥¤¥ó¥È²Ã»»¡Ë
+	$arrRegist['point'] = $arrRet[0]['point'] + addslashes($arrInfo['welcome_point']);
+	
+	$objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
+	
+	$ret = $objQuery->getLastQuery(false);
+	
+	/* ¹ØÆþ»þÅÐÏ¿¤Î¾ì¹ç¡¢¤½¤Î²ó¤Î¹ØÆþ¤ò²ñ°÷¹ØÆþ¤È¤ß¤Ê¤¹¡£ */
+	// ²ñ°÷¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+	$where1 = "secret_key = ? AND status = 2";
+	$customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
+	// ½é²ó¹ØÆþ¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+//	$where2 = "member_check = 1 AND order_email = ? AND password = ?";
+//	$order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id", $where2, array($customer[0]['email'], $customer[0]['password']));
+	$order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id");
+	// ¹ØÆþ¾ðÊó¤Î¹¹¿·
+	if ($order_temp_id != null) {
+		$arrCustomer['customer_id'] = $customer[0]['customer_id'];
+		$where3 = "order_temp_id = ?";
+		$objQuery->update("dtb_order_temp", $arrCustomer, $where3, array($order_temp_id));
+		$objQuery->update("dtb_order", $arrCustomer, $where3, array($order_temp_id));
+	}
+
+	$sql = "SELECT mail_flag FROM dtb_customer_mail WHERE email = ?";
+	$result = $objConn->getOne($sql, array($email));
+	
+	switch($result) {
+	// ²¾HTML
+	case '4':
+		$arrRegistMail["mail_flag"] = 1;
+		break;
+	// ²¾TEXT
+	case '5':
+		$arrRegistMail["mail_flag"] = 2;
+		break;
+	// ²¾¤Ê¤·
+	case '6':
+		$arrRegistMail["mail_flag"] = 3;
+		break;
+	default:
+		$arrRegistMail["mail_flag"] = $result;
+		break;
+	}
+
+	$objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($email). "'");
+	$objConn->query("COMMIT");
+		
+	return $secret;		// ËÜÅÐÏ¿ID¤òÊÖ¤¹
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+
+	$objErr->doFunc(array("²¾ÅÐÏ¿ID", 'id'), array("EXIST_CHECK"));
+	if (! EregI("^[[:alnum:]]+$",$array["id"] )) {
+		$objErr->arrErr["id"] = "Ìµ¸ú¤ÊURL¤Ç¤¹¡£¥á¡¼¥ë¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ëËÜ²ñ°÷ÅÐÏ¿ÍÑURL¤òºÆÅÙ¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+	}
+	if (! $objErr->arrErr["id"]) {
+
+		$sql = "SELECT customer_id FROM dtb_customer WHERE secret_key = ? AND status = 1 AND delete = 0";
+		$result = $objConn->getOne($sql, array($array["id"]));
+
+		if (! is_numeric($result)) {
+			$objErr->arrErr["id"] .= "¢¨ ´û¤Ë²ñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Æ¤¤¤ë¤«¡¢Ìµ¸ú¤ÊURL¤Ç¤¹¡£<br>";
+			return $objErr->arrErr;
+
+		}
+	}
+
+	return $objErr->arrErr;
+}
+
+//---- Àµ²ñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+function lfSendRegistMail($registSecretKey) {
+	global $objConn;
+	global $CONF;
+
+	//-- À«Ì¾¤ò¼èÆÀ
+	$sql = "SELECT email, name01, name02 FROM dtb_customer WHERE secret_key = ?";
+	$result = $objConn->getAll($sql, array($registSecretKey));
+	$data = $result[0];
+	
+	//--¡¡¥á¡¼¥ëÁ÷¿®
+	$objMailText = new SC_SiteView();
+	$objMailText->assign("CONF", $CONF);
+	$objMailText->assign("name01", $data["name01"]);
+	$objMailText->assign("name02", $data["name02"]);
+	$toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
+	$subject = sfMakeSubject('ËÜ²ñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+	$objMail = new GC_SendMail();
+
+	$objMail->setItem(
+						  ''								//¡¡°¸Àè
+						, $subject//"¡Ú" .$CONF["shop_name"]. "¡Û".ENTRY_CUSTOMER_REGIST_SUBJECT 		//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $CONF["email03"]					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+					);
+	// °¸Àè¤ÎÀßÄê
+	$name = $data["name01"] . $data["name02"] ." ÍÍ";
+	$objMail->setTo($data["email"], $name);
+	$objMail->sendMail();
+}
+
+?>
Index: /temp/trunk/html/regist/complete.php
===================================================================
--- /temp/trunk/html/regist/complete.php	(revision 1328)
+++ /temp/trunk/html/regist/complete.php	(revision 1328)
@@ -0,0 +1,24 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'regist/complete.tpl';
+		$this->tpl_css = '/css/layout/regist/complete.css';
+		$this->tpl_title = '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = new SC_SiteInfo();
+$objPage->arrInfo = $objSiteInfo->data;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/trunk/html/abouts/index.php
===================================================================
--- /temp/trunk/html/abouts/index.php	(revision 1328)
+++ /temp/trunk/html/abouts/index.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/abouts/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'abouts/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'abouts';	
+		$this->tpl_title = 'Åö¥µ¥¤¥È¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+// ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ÅÔÆ»ÉÜ¸©Ì¾¤òÊÑ´¹
+global $arrPref;
+$arrInfo['pref'] = $arrPref[$arrInfo['pref']];
+
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/index.php
===================================================================
--- /temp/trunk/html/index.php	(revision 1328)
+++ /temp/trunk/html/index.php	(revision 1328)
@@ -0,0 +1,27 @@
+<?php
+
+require_once("./require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = '/css/layout/index.css';						// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . 'html/user_data/templates/top.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$conn = new SC_DBConn();
+$objSiteInfo = new SC_SiteInfo();
+
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "index.php");
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/trunk/html/inquiry/index.php
===================================================================
--- /temp/trunk/html/inquiry/index.php	(revision 1328)
+++ /temp/trunk/html/inquiry/index.php	(revision 1328)
@@ -0,0 +1,237 @@
+<?php
+require_once("../admin/require.php");
+
+class LC_Page {
+	var $errmsg;
+	var $arrPref;
+	
+	var $QUESTION;
+	var $question_id;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'inquiry/index.tpl';
+		$this->tpl_mainno = 'contents';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+
+
+// ÅÔÆ»ÉÜ¸©¥×¥ë¥À¥¦¥óÍÑÇÛÎó
+$objPage->arrPref = $arrPref;	
+
+// CSVÊÝÂ¸¹àÌÜ
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó ¥ª¥×¥·¥ç¥ó°Ê³°
+$arrRegistColumn = array(
+							 array(  "column" => "name01", "convert" => "aKV" ),
+							 array(  "column" => "name02", "convert" => "aKV" ),
+							 array(  "column" => "kana01", "convert" => "CKV" ),
+							 array(  "column" => "kana02", "convert" => "CKV" ),
+							 array(  "column" => "zip01", "convert" => "n" ),
+							 array(  "column" => "zip02", "convert" => "n" ),
+							 array(  "column" => "pref", "convert" => "n" ),
+							 array(  "column" => "addr01", "convert" => "aKV" ),
+							 array(  "column" => "addr02", "convert" => "aKV" ),
+							 array(  "column" => "email", "convert" => "a" ),
+							 array(  "column" => "email02", "convert" => "a" ),
+							 array(  "column" => "tel01", "convert" => "n" ),
+							 array(  "column" => "tel02", "convert" => "n" ),
+							 array(  "column" => "tel03", "convert" => "n" ),
+					);
+
+		
+		
+if ( ( ! $_POST['mode'] == 'confirm' ) && ( ! is_numeric($_REQUEST['question_id']) ) ){
+	echo "ÉÔÀµ¥¢¥¯¥»¥¹";
+	exit;
+}
+
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÅÐÏ¿¹àÌÜ¼èÆÀ
+$sql = "SELECT question_id, question FROM dtb_question WHERE question_id = ?";
+$result = $conn->getAll( $sql, array($_REQUEST['question_id']) );
+$objPage->QUESTION = lfGetArrInput( unserialize( $result[0]['question'] ) );
+
+$objPage->question_id = $_REQUEST['question_id'];
+
+$objPage->arrHidden = sfMakeHiddenArray($_POST);
+unset($objPage->arrHidden['mode']);
+
+if ( (int)$objPage->QUESTION["delete"] !== 0 ){
+
+	$objPage->tpl_mainpage = "inquiry/closed.tpl";
+	
+} elseif( $_POST['mode'] == "confirm" ) {
+	
+	//--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrForm = $_POST;	
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);	
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	$objPage->arrErr = lfGetArrInput($objPage->arrErr);
+		
+	if( ! $objPage->arrErr ) {
+		$objPage->tpl_mainpage = "inquiry/confirm.tpl";
+	}
+	
+
+}elseif( $_POST['mode'] == "return"){
+	$objPage->arrForm = $_POST;
+
+}elseif( $_POST['mode'] == "regist" )  {
+
+	//--¡¡ÆþÎÏÊ¸»ú¡¦ÊÑ´¹¡õ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	$objPage->arrErr = lfGetArrInput($objPage->arrErr);
+
+	
+	if( ! $objPage->arrErr ) {
+	
+		//´°Î»²èÌÌ
+		$objPage->tpl_mainpage = "inquiry/complete.tpl";
+
+		
+		//--------- ¢§ SQL ---------//
+			
+			// ¥Æ¡¼¥Ö¥ë¤ËÆþ¤ì¤ë¤è¤¦¤ËÀ°·Á¤¹¤ë
+			$arrOption = $objPage->arrForm['option'];
+			unset ($objPage->arrForm['email02']);
+			$objPage->arrForm['mail01'] = $objPage->arrForm['email'];
+			unset ($objPage->arrForm['email']);
+			unset ($objPage->arrForm['option']);
+			$objPage->arrForm['question_id'] = $objPage->question_id;
+			$objPage->arrForm['question_name'] = $objPage->QUESTION['title'];
+			for ( $i=0; $i<(count($arrOption)); $i++ ){
+				$tmp = "";
+				if ( is_array($arrOption[$i]) ){
+					for( $j=0; $j<count($arrOption[$i]); $j++){
+						if ( $j>0 ) $tmp .= ",";
+						$tmp .= $arrOption[$i][$j];
+					}
+					$objPage->arrForm['question0'.($i+1)] = $tmp; 
+				} else {
+					$objPage->arrForm['question0'.($i+1)] = $arrOption[$i]; 
+				}
+			}
+			
+			// £Ä£ÂÅÐÏ¿
+			$conn->autoExecute("dtb_question_result", $objPage->arrForm );
+			
+		//--------- ¢¥ SQL ---------//
+
+	}
+}
+
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->_smarty->register_function("lfArray_Search_key_Smarty","lfArray_Search_key_Smarty");
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+function lfErrorCheck($array) {
+
+	$objErr = new SC_CheckError($array);
+
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥»¥¤¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+	
+	$objErr->arrErr["option"] =  array_map( "lfCheckNull", (array)$_POST['option'] );
+	
+	return $objErr->arrErr;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	$new_array = array();
+	foreach ($arrConvList as $key => $val) {
+		$new_array[$key] = $array[$key];
+		if( strlen($val) > 0) {
+			$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
+		}
+	}
+	
+	// ¥ª¥×¥·¥ç¥óÇÛÎóÍÑ
+	for ($i=0; $i<count($array['option']); $i++){
+		if ( is_array($array['option'][$i]) ){
+			$new_array['option'][$i] = $array['option'][$i];
+		} else {
+			$new_array['option'][$i] = mb_convert_kana($array['option'][$i] ,"aKV");
+		}
+	}
+	
+
+	return $new_array;
+	
+}
+
+function lfGetArrInput( $arr ){
+	// ÃÍ¤¬ÆþÎÏ¤µ¤ì¤¿ÇÛÎó¤Î¤ß¤òÊÖ¤¹
+	
+	if ( is_array($arr)	){
+		foreach ( $arr as $key=>$val ) {
+			if ( is_string($val) && strlen($val) > 0 ){
+				$return[$key] = $val;
+			} elseif ( is_array( $val ) ) {
+				$data = lfGetArrInput ( $val );
+				if ( $data ){
+					$return[$key] = $data;
+				}
+			}
+		}
+	}
+	return $return;
+}
+
+function lfArray_Search_key_Smarty ( $palams ){
+
+	$val = $palams['val'];
+	$arr = $palams['arr']; 
+	
+	$revers_arr = array_flip($arr);
+	return array_search( $val ,$revers_arr );
+
+	
+}
+
+function lfCheckNull ( $val ){
+	
+
+	if ( ( ! is_array( $val ) ) && ( strlen( $val ) < 1 ) ){
+		$return = "1";
+	} elseif ( is_array( $val ) ) {
+		foreach ($val as $line) {
+			$return = lfCheckNull( $line );
+		}
+	}
+	return $return;
+}
+
+?>
Index: /temp/trunk/html/entry/index.php
===================================================================
--- /temp/trunk/html/entry/index.php	(revision 1328)
+++ /temp/trunk/html/entry/index.php	(revision 1328)
@@ -0,0 +1,322 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/entry/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'entry/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= '²ñ°÷ÅÐÏ¿(ÆþÎÏ¥Ú¡¼¥¸)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$CONF = sf_getBasisData();					// Å¹ÊÞ´ðËÜ¾ðÊó
+$objConn = new SC_DbConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
+$objPage->arrPref = $arrPref;
+$objPage->arrJob = $arrJob;
+$objPage->arrReminder = $arrReminder;
+$objPage->arrYear = $objDate->getYear('', 1950);	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+//SSLURLÈ½Äê
+if (SSLURL_CHECK == 1){
+	$ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
+	if (!ereg("^https://", $non_ssl_url)){
+		sfDispSiteError(URL_ERROR);
+	}
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01", "convert" => "aKV" ),
+							 array(  "column" => "name02", "convert" => "aKV" ),
+							 array(  "column" => "kana01", "convert" => "CKV" ),
+							 array(  "column" => "kana02", "convert" => "CKV" ),
+							 array(  "column" => "zip01", "convert" => "n" ),
+							 array(  "column" => "zip02", "convert" => "n" ),
+							 array(  "column" => "pref", "convert" => "n" ),
+							 array(  "column" => "addr01", "convert" => "aKV" ),
+							 array(  "column" => "addr02", "convert" => "aKV" ),
+							 array(  "column" => "email", "convert" => "a" ),
+							 array(  "column" => "email2", "convert" => "a" ),
+							 array(  "column" => "email_mobile", "convert" => "a" ),
+							 array(  "column" => "email_mobile2", "convert" => "a" ),
+							 array(  "column" => "tel01", "convert" => "n" ),
+							 array(  "column" => "tel02", "convert" => "n" ),
+							 array(  "column" => "tel03", "convert" => "n" ),
+							 array(  "column" => "fax01", "convert" => "n" ),
+							 array(  "column" => "fax02", "convert" => "n" ),
+							 array(  "column" => "fax03", "convert" => "n" ),
+							 array(  "column" => "sex", "convert" => "n" ),
+							 array(  "column" => "job", "convert" => "n" ),
+							 array(  "column" => "birth", "convert" => "n" ),
+							 array(  "column" => "reminder", "convert" => "n" ),
+							 array(  "column" => "reminder_answer", "convert" => "aKV"),
+							 array(  "column" => "password", "convert" => "a" ),
+							 array(  "column" => "password02", "convert" => "a" )
+						 );
+
+//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
+$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
+
+
+
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
+	//-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	
+	if($objPage->arrForm['year'] == '----') {
+		$objPage->arrForm['year'] = '';
+	}
+	
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	$objPage->arrForm['email02'] = strtolower($objPage->arrForm['email02']);	// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+		
+	//--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+
+	if ($objPage->arrErr || $_POST["mode"] == "return") {		// ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+		foreach($objPage->arrForm as $key => $val) {
+			$objPage->$key = $val;
+		}
+
+	} else {
+
+		//--¡¡³ÎÇ§
+		if ($_POST["mode"] == "confirm") {
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm") $objPage->list_data[ $key ] = $val;
+			}
+			//¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+			
+			$objPage->tpl_css = '/css/layout/entry/confirm.css';
+			$objPage->tpl_mainpage = 'entry/confirm.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(³ÎÇ§¥Ú¡¼¥¸)';
+
+		}
+
+		//--¡¡²¾ÅÐÏ¿¤È´°Î»²èÌÌ
+		if ($_POST["mode"] == "complete") {
+			$objPage->uniqid = lfRegistData ($objPage->arrForm, $arrRegistColumn, $arrRejectRegistColumn);
+			
+			$objPage->tpl_css = '/css/layout/entry/complete.css';
+			$objPage->tpl_mainpage = 'entry/complete.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+			
+			//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+			$objPage->CONF = $CONF;
+			$objPage->to_name01 = $_POST['name01'];
+			$objPage->to_name02 = $_POST['name02'];
+			$objMailText = new SC_SiteView();
+			$objMailText->assignobj($objPage);
+			$subject = sfMakesubject('²ñ°÷ÅÐÏ¿¤Î¤´³ÎÇ§');
+			$toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
+			$objMail = new GC_SendMail();
+			$objMail->setItem(
+								''									//¡¡°¸Àè
+								, $subject							//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+								, $toCustomerMail					//¡¡ËÜÊ¸
+								, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+								, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+								, $CONF["email03"]					//¡¡reply_to
+								, $CONF["email04"]					//¡¡return_path
+								, $CONF["email04"]					//  Errors_to
+								, $CONF["email01"]					//  Bcc
+																);
+			// °¸Àè¤ÎÀßÄê
+			$name = $_POST["name01"] . $_POST["name02"] ." ÍÍ";
+			$objMail->setTo($_POST["email"], $name);			
+			$objMail->sendMail();
+			
+			// ´°Î»¥Ú¡¼¥¸¤Ë°ÜÆ°¤µ¤»¤ë¡£
+			header("Location: ./complete.php");
+			exit;
+		}
+	}
+}
+
+if($objPage->year == '') {
+	$objPage->year = '----';
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//----------------------------------------------------------------------------------------------------------------------
+
+//---- function·²
+function lfRegistData ($array, $arrRegistColumn, $arrRejectRegistColumn) {
+	global $objConn;
+
+	// ²¾ÅÐÏ¿
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+	}
+		
+	// ÃÂÀ¸Æü¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if (strlen($array["year"]) > 0 ) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½
+	$arrRegist["password"] = crypt($arrRegist["password"]);
+	
+	$count = 1;
+	while ($count != 0) {
+		$uniqid = sfGetUniqRandomId("t");
+		$count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
+	}
+	
+	$arrRegist["secret_key"] = $uniqid;	//¡¡²¾ÅÐÏ¿IDÈ¯¹Ô
+	
+	//-- ²¾ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	$objConn->autoExecute("dtb_customer", $arrRegist);
+	
+	//--¡¡Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¤«¤ÎÈ½Äê
+	$sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
+	$mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
+
+	//--¡¡¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¼Â¹Ô
+	$arrRegistMail["email"] = $arrRegist["email"];	
+	if ($array["mail_flag"] == 1) {
+		$arrRegistMail["mail_flag"] = 4; 
+	} elseif ($array["mail_flag"] == 2) {
+		$arrRegistMail["mail_flag"] = 5; 
+	} else {
+		$arrRegistMail["mail_flag"] = 6; 
+	}
+	
+	// Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç
+	if ($mailResult == 1) {		
+		$objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");			
+	} else {				//¡¡¿·µ¬ÅÐÏ¿¤Î¾ì¹ç
+		$objConn->autoExecute("dtb_customer_mail", $arrRegistMail);		
+	}
+
+	$objConn->query("COMMIT");
+
+	return $uniqid;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+
+	//¸½²ñ°÷¤ÎÈ½Äê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇÆ±¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
+	if (strlen($array["email"]) > 0) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("email, update_date, delete", "dtb_customer","email ILIKE ? ORDER BY delete", array($array["email"]));
+				
+		if(count($arrRet) > 0) {
+			if($arrRet[0]['delete'] != '1') {
+				// ²ñ°÷¤Ç¤¢¤ë¾ì¹ç
+				$objErr->arrErr["email"] .= "¢¨ ¤¹¤Ç¤Ë²ñ°÷ÅÐÏ¿¤Ç»ÈÍÑ¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£<br />";
+			} else {
+				// Âà²ñ¤·¤¿²ñ°÷¤Ç¤¢¤ë¾ì¹ç
+				$leave_time = sfDBDatetoTime($arrRet[0]['update_date']);
+				$now_time = time();
+				$pass_time = $now_time - $leave_time;
+				// Âà²ñ¤«¤é²¿»þ´Ö-·Ð²á¤·¤Æ¤¤¤ë¤«È½Äê¤¹¤ë¡£
+				$limit_time = ENTRY_LIMIT_HOUR * 3600;						
+				if($pass_time < $limit_time) {
+					$objErr->arrErr["email"] .= "¢¨ Âà²ñ¤«¤é°ìÄê´ü´Ö¤Î´Ö¤Ï¡¢Æ±¤¸¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò»ÈÍÑ¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br />";
+				}
+			}
+		}
+	}
+
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ1", 'fax01'), array("SPTAB_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ2", 'fax02'), array("SPTAB_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ3", 'fax03'), array("SPTAB_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_ITEM_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array('¥Ñ¥¹¥ï¡¼¥É', '¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)', "password", "password02") ,array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È ¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È Åú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag") ,array("SELECT_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("Ç¯", "year"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("·î", "month"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("Æü", "day"), array("EXIST_CHECK"));
+	
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", 'mail_flag'), array("SELECT_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/entry/complete.php
===================================================================
--- /temp/trunk/html/entry/complete.php	(revision 1328)
+++ /temp/trunk/html/entry/complete.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/entry/complete.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'entry/complete.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+$objPage->arrInfo = $arrInfo;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//----------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/entry/kiyaku.php
===================================================================
--- /temp/trunk/html/entry/kiyaku.php	(revision 1328)
+++ /temp/trunk/html/entry/kiyaku.php	(revision 1328)
@@ -0,0 +1,34 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'entry/kiyaku.tpl';
+		$this->tpl_title="¤´ÍøÍÑµ¬Ìó";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+// µ¬ÌóÆâÍÆ¤Î¼èÆÀ
+$objQuery = new SC_Query();
+$objQuery->setorder("rank DESC");
+$arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "delete <> 1");
+
+$max = count($arrRet);
+$objPage->tpl_kiyaku_text = "";
+for ($i = 0; $i < $max; $i++) {
+	$objPage->tpl_kiyaku_text.=$arrRet[$i]['kiyaku_title'] . "\n\n"; 
+	$objPage->tpl_kiyaku_text.=$arrRet[$i]['kiyaku_text'] . "\n\n"; 
+}
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/require.php
===================================================================
--- /temp/trunk/html/require.php	(revision 1328)
+++ /temp/trunk/html/require.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir . "/../data/conf/conf.php");	
+require_once($include_dir . "/../data/lib/glib.php");
+require_once($include_dir . "/../data/lib/slib.php");
+require_once($include_dir . "/../data/class/SC_View.php");
+require_once($include_dir . "/../data/class/SC_DbConn.php");
+require_once($include_dir . "/../data/class/SC_Session.php");
+require_once($include_dir . "/../data/class/SC_Query.php");
+require_once($include_dir . "/../data/class/SC_SelectSql.php");
+require_once($include_dir . "/../data/class/SC_CheckError.php");
+require_once($include_dir . "/../data/class/SC_PageNavi.php");
+require_once($include_dir . "/../data/class/SC_Date.php");
+require_once($include_dir . "/../data/class/SC_Image.php");
+require_once($include_dir . "/../data/class/SC_UploadFile.php");
+require_once($include_dir . "/../data/class/SC_JpGraph.php");
+require_once($include_dir . "/../data/class/SC_SiteInfo.php");
+require_once($include_dir . "/../data/class/GC_SendMail.php");
+require_once($include_dir . "/../data/class/SC_FormParam.php");
+require_once($include_dir . "/../data/class/SC_CartSession.php");
+require_once($include_dir . "/../data/class/SC_SiteSession.php");
+require_once($include_dir . "/../data/class/SC_Customer.php");
+require_once($include_dir . "/../data/class/SC_Cookie.php");
+require_once($include_dir . "/../data/class/SC_Page.php");
+require_once($include_dir . "/../data/class/SC_Pdf.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+?>
Index: /temp/trunk/html/frontparts/login_check.php
===================================================================
--- /temp/trunk/html/frontparts/login_check.php	(revision 1328)
+++ /temp/trunk/html/frontparts/login_check.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+
+require_once("../require.php");
+
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'login':
+	$objFormParam->toLower('login_email');
+	$arrErr = $objFormParam->checkError();
+	$arrForm =  $objFormParam->getHashArray();
+	
+	// ¥¯¥Ã¥­¡¼ÊÝÂ¸È½Äê
+	if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
+		$objCookie->setCookie('login_email', $_POST['login_email']);
+	} else {
+		$objCookie->setCookie('login_email', '');
+	}
+	
+	if(count($arrErr) == 0) {
+		if($objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
+			header("Location: " . $_POST['url']);
+			exit;
+		} else {
+			$objQuery = new SC_Query;
+			$where = "email ILIKE ? AND status = 1 AND delete = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		}
+	} else {
+		// ÆþÎÏ¥¨¥é¡¼¤Î¾ì¹ç¡¢¸µ¤Î¥¢¥É¥ì¥¹¤ËÌá¤¹¡£
+		header("Location: " . $_POST['url']);
+		exit;
+	}
+	break;
+case 'logout':
+	// ¥í¥°¥¤¥ó¾ðÊó¤Î²òÊü
+	$objCustomer->EndSession();
+	$mypage_url_search = strpos('.'.$_POST['url'], "mypage");
+	//¥Þ¥¤¥Ú¡¼¥¸¥í¥°¥¤¥óÃæ¤Ï¥í¥°¥¤¥ó²èÌÌ¤Ø°Ü¹Ô
+	if ($mypage_url_search == 2){
+	header("Location: /mypage/login.php");
+	}else{
+	header("Location: " . $_POST['url']);	
+	}
+	exit;
+	break;
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("µ­²±¤¹¤ë", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN, "", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+?>
Index: /temp/trunk/html/frontparts/login.php
===================================================================
--- /temp/trunk/html/frontparts/login.php	(revision 1328)
+++ /temp/trunk/html/frontparts/login.php	(revision 1328)
@@ -0,0 +1,53 @@
+<?php
+class LC_LoginPage {
+	var $tpl_login_email;
+	function LC_LoginPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/login.tpl';	// ¥á¥¤¥ó
+		$this->tpl_login = false;
+		$this->tpl_disable_logout = false;
+	}
+}
+
+$objSubPage = new LC_LoginPage();
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	$objSubPage->tpl_login = true;
+	$objSubPage->tpl_user_point = $objCustomer->getValue('point');
+	$objSubPage->tpl_name1 = $objCustomer->getValue('name01');
+	$objSubPage->tpl_name2 = $objCustomer->getValue('name02');
+} else {
+	// ¥¯¥Ã¥­¡¼È½Äê
+	$objSubPage->tpl_login_email = $objCookie->getCookie('login_email');
+	if($objSubPage->tpl_login_email != "") {
+		$objSubPage->tpl_login_memory = "1";
+	}
+	
+	// POST¤µ¤ì¤Æ¤­¤¿ID¤¬¤¢¤ë¾ì¹ç¤ÏÍ¥Àè¤¹¤ë¡£
+	if($_POST['login_email'] != "") {
+		$objSubPage->tpl_login_email = $_POST['login_email'];
+	}
+}
+
+$objSubPage->tpl_disable_logout = lfCheckDisableLogout();
+$objSubView = new SC_SiteView();
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+function lfCheckDisableLogout() {
+	global $arrDISABLE_LOGOUT;
+	
+	$nowpage = $_SERVER['PHP_SELF'];
+	
+	foreach($arrDISABLE_LOGOUT as $val) {
+		if($nowpage == $val) {
+			return true;
+		}
+ 	}
+	return false;
+}
+?>
Index: /temp/trunk/html/frontparts/search_products.php
===================================================================
--- /temp/trunk/html/frontparts/search_products.php	(revision 1328)
+++ /temp/trunk/html/frontparts/search_products.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+
+class LC_SearchProductsPage {
+	function LC_SearchProductsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/search_products.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_SearchProductsPage();
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$objSubPage->category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+$arrRet = sfGetCategoryList('', true);
+
+if(is_array($arrRet)) {
+	// Ê¸»ú¥µ¥¤¥º¤òÀ©¸Â¤¹¤ë
+	foreach($arrRet as $key => $val) {
+		$arrRet[$key] = sfCutString($val, SEARCH_CATEGORY_LEN);
+	}
+}
+$objSubPage->arrCatList = $arrRet;
+
+$objSubView = new SC_SiteView();
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/frontparts/bloc/login.php
===================================================================
--- /temp/trunk/html/frontparts/bloc/login.php	(revision 1328)
+++ /temp/trunk/html/frontparts/bloc/login.php	(revision 1328)
@@ -0,0 +1,53 @@
+<?php
+class LC_LoginPage {
+	var $tpl_login_email;
+	function LC_LoginPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'login.tpl';	// ¥á¥¤¥ó
+		$this->tpl_login = false;
+		$this->tpl_disable_logout = false;
+	}
+}
+
+$objSubPage = new LC_LoginPage();
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	$objSubPage->tpl_login = true;
+	$objSubPage->tpl_user_point = $objCustomer->getValue('point');
+	$objSubPage->tpl_name1 = $objCustomer->getValue('name01');
+	$objSubPage->tpl_name2 = $objCustomer->getValue('name02');
+} else {
+	// ¥¯¥Ã¥­¡¼È½Äê
+	$objSubPage->tpl_login_email = $objCookie->getCookie('login_email');
+	if($objSubPage->tpl_login_email != "") {
+		$objSubPage->tpl_login_memory = "1";
+	}
+	
+	// POST¤µ¤ì¤Æ¤­¤¿ID¤¬¤¢¤ë¾ì¹ç¤ÏÍ¥Àè¤¹¤ë¡£
+	if($_POST['login_email'] != "") {
+		$objSubPage->tpl_login_email = $_POST['login_email'];
+	}
+}
+
+$objSubPage->tpl_disable_logout = lfCheckDisableLogout();
+$objSubView = new SC_SiteView();
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+function lfCheckDisableLogout() {
+	global $arrDISABLE_LOGOUT;
+	
+	$nowpage = $_SERVER['PHP_SELF'];
+	
+	foreach($arrDISABLE_LOGOUT as $val) {
+		if($nowpage == $val) {
+			return true;
+		}
+ 	}
+	return false;
+}
+?>
Index: /temp/trunk/html/frontparts/bloc/search_products.php
===================================================================
--- /temp/trunk/html/frontparts/bloc/search_products.php	(revision 1328)
+++ /temp/trunk/html/frontparts/bloc/search_products.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+
+class LC_SearchProductsPage {
+	function LC_SearchProductsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'search_products.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_SearchProductsPage();
+$arrSearch = array();	// ¸¡º÷¹àÌÜÉ½¼¨ÍÑ
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$objSubPage->category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+$arrRet = sfGetCategoryList('', true);
+
+if(is_array($arrRet)) {
+	// Ê¸»ú¥µ¥¤¥º¤òÀ©¸Â¤¹¤ë
+	foreach($arrRet as $key => $val) {
+		$arrRet[$key] = sfCutString($val, SEARCH_CATEGORY_LEN);
+	}
+}
+$objSubPage->arrCatList = $arrRet;
+
+$objSubView = new SC_SiteView();
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/trunk/html/frontparts/bloc/cart.php
===================================================================
--- /temp/trunk/html/frontparts/bloc/cart.php	(revision 1328)
+++ /temp/trunk/html/frontparts/bloc/cart.php	(revision 1328)
@@ -0,0 +1,63 @@
+<?php
+
+class LC_CartPage {
+	function LC_CartPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'cart.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CartPage();
+$objSubView = new SC_SiteView();
+$objCart = new SC_CartSession();
+$objSiteInfo = new SC_SiteInfo();
+
+if (count($_SESSION[$objCart->key]) > 0){
+	// ¥«¡¼¥È¾ðÊó¤ò¼èÆÀ
+	$arrCartList = $objCart->getCartList();
+	
+	// ¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ£É£Ä°ìÍ÷¤ò¼èÆÀ
+	$arrAllProductID = $objCart->getAllProductID();
+	// ¾¦ÉÊ¤¬1¤Ä°Ê¾åÆþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¾¦ÉÊÌ¾¾Î¤ò¼èÆÀ
+	if (count($arrAllProductID) > 0){
+		$objQuery = new SC_Query();
+		$arrVal = array();
+		$sql = "";
+		$sql = "SELECT name FROM dtb_products WHERE product_id IN ( ?";
+		$arrVal = array($arrAllProductID[0]);
+		for($i = 1 ; $i < count($arrAllProductID) ; $i++){
+			$sql.= " ,? ";
+			array_push($arrVal, $arrAllProductID[$i]);
+		}
+		$sql.= " )";
+		
+		$arrProduct_name = $objQuery->getAll($sql, $arrVal);
+		
+		foreach($arrProduct_name as $key => $val){
+			$arrCartList[$key]['product_name'] = $val['name'];
+		}
+	}
+	// Å¹ÊÞ¾ðÊó¤Î¼èÆÀ
+	$arrInfo = $objSiteInfo->data;
+	// ¹ØÆþ¶â³Û¹ç·×
+	$ProductsTotal = $objCart->getAllProductsTotal($arrInfo);
+	
+	// ¹ç·×¸Ä¿ô
+	$TotalQuantity = $objCart->getTotalQuantity();
+	
+	// Á÷ÎÁÌµÎÁ¤Þ¤Ç¤Î¶â³Û
+	$deliv_free = $arrInfo['free_rule'] - $ProductsTotal;
+
+	$arrCartList[0]['ProductsTotal'] = $ProductsTotal;
+	$arrCartList[0]['TotalQuantity'] = $TotalQuantity;
+	$arrCartList[0]['deliv_free'] = $deliv_free;
+	
+	
+	$objSubPage->arrCartList = $arrCartList;
+}
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/trunk/html/frontparts/bloc/news.php
===================================================================
--- /temp/trunk/html/frontparts/bloc/news.php	(revision 1328)
+++ /temp/trunk/html/frontparts/bloc/news.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+class LC_NewsPage {
+	function LC_NewsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'news.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_NewsPage();
+$objSubView = new SC_SiteView();
+
+//¿·Ãå¾ðÊó¼èÆÀ
+$objSubPage->arrNews = lfGetNews();
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+function lfGetNews(){
+	$conn = new SC_DBConn();
+	$sql = "SELECT *, to_char(news_date, 'YYYY/MM/DD') as news_date_disp FROM dtb_news WHERE delete = '0' ORDER BY rank DESC";
+	$list_data = $conn->getAll($sql);
+	return $list_data;	
+}
+?>
Index: /temp/trunk/html/frontparts/bloc/category.php
===================================================================
--- /temp/trunk/html/frontparts/bloc/category.php	(revision 1328)
+++ /temp/trunk/html/frontparts/bloc/category.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+
+class LC_CatPage {
+	function LC_CatPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/category.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CatPage();
+$objSubView = new SC_SiteView();
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID
+$objSubPage->tpl_category_id = $category_id;
+$objSubPage = lfGetCatTree($category_id, true, $objSubPage);
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ
+function lfGetCatTree($parent_category_id, $count_check = false, $objSubPage) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$from = "dtb_category left join dtb_category_total_count using (category_id)";
+	// ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
+	if($count_check) {
+		$where = "delete = 0 AND product_count > 0";
+	} else {
+		$where = "delete = 0";
+	}
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, $from, $where);
+	
+	$arrParentID = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
+	$arrBrothersID = sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID);
+	$arrChildrenID = sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $parent_category_id);
+	
+	$objSubPage->root_parent_id = $arrParentID[0];
+	
+	$arrDispID = array_merge($arrBrothersID, $arrChildrenID);
+	
+	foreach($arrRet as $key => $array) {
+		foreach($arrDispID as $val) {
+			if($array['category_id'] == $val) {
+				$arrRet[$key]['display'] = 1;
+				break;
+			}
+		}
+	}
+	
+	$objSubPage->arrTree = $arrRet;
+	return $objSubPage;
+}
+?>
Index: /temp/trunk/html/frontparts/bloc/best5.php
===================================================================
--- /temp/trunk/html/frontparts/bloc/best5.php	(revision 1328)
+++ /temp/trunk/html/frontparts/bloc/best5.php	(revision 1328)
@@ -0,0 +1,36 @@
+<?php
+
+class LC_Best5Page {
+	function LC_Best5Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'best5.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_Best5Page();
+$objSubView = new SC_SiteView();
+$objSiteInfo = new SC_SiteInfo();
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objSubPage->arrInfo = $objSiteInfo->data;
+
+//¤ª¤¹¤¹¤á¾¦ÉÊÉ½¼¨
+$objSubPage->arrBestProducts = lfGetRanking();
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+//¤ª¤¹¤¹¤á¾¦ÉÊ¸¡º÷
+function lfGetRanking(){
+	$objQuery = new SC_Query();
+	
+	$col = "A.*, B.name, B.price02_min, B.price01_min, B.main_list_image ";
+	$from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS B ON A.product_id = B.product_id";
+	$where = "status = 1";
+	$order = "rank";
+	$objQuery->setorder($order);
+	$arrBestProducts = $objQuery->select($col, $from, $where);
+	return $arrBestProducts;
+}
+
+?>
Index: /temp/trunk/html/frontparts/Copy of category.php
===================================================================
--- /temp/trunk/html/frontparts/Copy of category.php	(revision 1328)
+++ /temp/trunk/html/frontparts/Copy of category.php	(revision 1328)
@@ -0,0 +1,90 @@
+<?php
+
+class LC_CatPage {
+	function LC_CatPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/category.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CatPage();
+$objSubView = new SC_SiteView();
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+
+if($category_id != "") {
+	// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤Î¿Æ¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë¡£
+	$objQuery = new SC_Query();
+	$parent_category_id = $objQuery->get("dtb_category", "parent_category_id", "category_id = ?", array($category_id));
+}
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤Î³¬ÁØ¤òÈ½Äê¤¹¤ë
+$level = lfGetCategoryLevel($category_id);
+
+// ¥«¥Æ¥´¥ê°ìÍ÷¤Î¼èÆÀ
+$objSubPage->arrCategory = lfGetCategoryList($category_id, $level);
+
+$objSubPage->tpl_category_id = $category_id;
+$objSubPage->tpl_parent_category_id = $parent_category_id;
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤Î¥ì¥Ù¥ë¤ò¼èÆÀ¤¹¤ë */
+function lfGetCategoryLevel($category_id) {
+	$objQuery = new SC_Query();
+	$where = "category_id = ?";
+	$ret = $objQuery->get("dtb_category", "level", $where, array($category_id));
+	return $ret;
+}
+
+/* ¥«¥Æ¥´¥ê¤Î°ìÍ÷¤ò¼èÆÀ¤¹¤ë */
+function lfGetCategoryList($category_id, $level) {
+	$objQuery = new SC_Query();
+
+	switch($level) {
+	case '':
+		break;
+	case '1':
+		$objQuery->setorder("rank DESC");
+		$where = "parent_category_id = ? AND product_count > 0";
+		$arrRet = $objQuery->select("*", "vw_category_count", $where, array($category_id));
+		break;
+	default:
+		$arrRet = lfGetCatParentsList($category_id);
+		break;
+	}
+	return $arrRet;
+}
+
+/* ½Ä·ÏÎó¤Î¿Æ¥«¥Æ¥´¥ê°ìÍ÷¤ò¼èÆÀ */
+function lfGetCatParentsList($category_id) {
+	$objQuery = new SC_Query();
+	// ¾¦ÉÊ¤¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
+	$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
+	// ½êÂ°¤¹¤ë¿Æ¥«¥Æ¥´¥ê°ìÍ÷
+	$count = count($arrCatID);
+	if ($count > 0) {
+		for($cnt = 0; $cnt < $count; $cnt++) {
+			if ($where == "") {
+				$where = "(parent_category_id = ?";
+			} else {
+				$where.= " OR parent_category_id = ?";
+			}
+			$arrVal[] = $arrCatID[$cnt];
+		}
+		$where.= ")";
+	}
+	
+	if($where != "") {
+		$where.= " AND product_count > 0 AND level >= 2";
+	} else {
+		$where = "product_count > 0 AND level >= 2";
+	}
+	
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select("*", "vw_category_count", $where, $arrVal);
+	return $arrRet;
+}
+?>
Index: /temp/trunk/html/frontparts/category.php
===================================================================
--- /temp/trunk/html/frontparts/category.php	(revision 1328)
+++ /temp/trunk/html/frontparts/category.php	(revision 1328)
@@ -0,0 +1,95 @@
+<?php
+
+class LC_CatPage {
+	function LC_CatPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/category.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CatPage();
+$objSubView = new SC_SiteView();
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+
+/*
+if($category_id != "") {
+	// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤Î¿Æ¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë¡£
+	$objQuery = new SC_Query();
+	$parent_category_id = $objQuery->get("dtb_category", "parent_category_id", "category_id = ?", array($category_id));
+}
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤Î³¬ÁØ¤òÈ½Äê¤¹¤ë
+$level = lfGetCategoryLevel($category_id);
+
+// ¥«¥Æ¥´¥ê°ìÍ÷¤Î¼èÆÀ
+$objSubPage->arrCategory = lfGetCategoryList($category_id, $level);
+
+$objSubPage->tpl_category_id = $category_id;
+$objSubPage->tpl_parent_category_id = $parent_category_id;
+*/
+
+$objSubPage->arrTree = sfGetCatTree($category_id);
+
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤Î¥ì¥Ù¥ë¤ò¼èÆÀ¤¹¤ë */
+function lfGetCategoryLevel($category_id) {
+	$objQuery = new SC_Query();
+	$where = "category_id = ?";
+	$ret = $objQuery->get("dtb_category", "level", $where, array($category_id));
+	return $ret;
+}
+
+/* ¥«¥Æ¥´¥ê¤Î°ìÍ÷¤ò¼èÆÀ¤¹¤ë */
+function lfGetCategoryList($category_id, $level) {
+	$objQuery = new SC_Query();
+
+	switch($level) {
+	case '':
+		break;
+	case '1':
+		$objQuery->setorder("rank DESC");
+		$where = "parent_category_id = ? AND product_count > 0";
+		$arrRet = $objQuery->select("*", "vw_category_count", $where, array($category_id));
+		break;
+	default:
+		$arrRet = lfGetCatParentsList($category_id);
+		break;
+	}
+	return $arrRet;
+}
+
+/* ½Ä·ÏÎó¤Î¿Æ¥«¥Æ¥´¥ê°ìÍ÷¤ò¼èÆÀ */
+function lfGetCatParentsList($category_id) {
+	$objQuery = new SC_Query();
+	// ¾¦ÉÊ¤¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
+	$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
+	// ½êÂ°¤¹¤ë¿Æ¥«¥Æ¥´¥ê°ìÍ÷
+	$count = count($arrCatID);
+	if ($count > 0) {
+		for($cnt = 0; $cnt < $count; $cnt++) {
+			if ($where == "") {
+				$where = "(parent_category_id = ?";
+			} else {
+				$where.= " OR parent_category_id = ?";
+			}
+			$arrVal[] = $arrCatID[$cnt];
+		}
+		$where.= ")";
+	}
+	
+	if($where != "") {
+		$where.= " AND product_count > 0 AND level >= 2";
+	} else {
+		$where = "product_count > 0 AND level >= 2";
+	}
+	
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select("*", "vw_category_count", $where, $arrVal);
+	return $arrRet;
+}
+?>
Index: /temp/trunk/html/frontparts/pankuzu.php
===================================================================
--- /temp/trunk/html/frontparts/pankuzu.php	(revision 1328)
+++ /temp/trunk/html/frontparts/pankuzu.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+
+class LC_PankuzuPage {
+	function LC_PankuzuPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/pankuzu.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_PankuzuPage();
+$objSubView = new SC_SiteView();
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+// ¥Ñ¥ó¥¯¥º¥«¥Æ¥´¥êÌ¾¤Î¼èÆÀ
+list($objSubPage->arrCatID, $objSubPage->arrCatName) = lfGetCatName($category_id);
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ½Ä·ÏÎó¤Î¿Æ¥«¥Æ¥´¥ê¤ò¼èÆÀ */
+function lfGetCatName($category_id) {
+	if($category_id != 0) {
+		$objQuery = new SC_Query();
+		$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
+		// ½Ä·ÏÎó¤Î¿Æ¥«¥Æ¥´¥êÌ¾¤ò¼èÆÀ
+		$arrList = sfGetParentsCol($objQuery, "dtb_category", "category_id", "category_name", $arrCatID);
+		$count = count($arrList);
+		for($cnt = 0; $cnt < $count; $cnt++) {
+			$arrCatName[] = $arrList[$cnt]['category_name'];
+		}
+	}
+	return array($arrCatID, $arrCatName);
+}
+?>
Index: /temp/trunk/data/smarty_extends/function.html_checkboxes_ex.php
===================================================================
--- /temp/trunk/data/smarty_extends/function.html_checkboxes_ex.php	(revision 1328)
+++ /temp/trunk/data/smarty_extends/function.html_checkboxes_ex.php	(revision 1328)
@@ -0,0 +1,169 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_checkboxes} function plugin
+ *
+ * File:       function.html_checkboxes.php<br>
+ * Type:       function<br>
+ * Name:       html_checkboxes<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of checkbox input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "checkbox"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each checkbox
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_checkboxes values=$ids output=$names}
+ * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
+ * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_checkboxes_ex($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+
+    $name = 'checkbox';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+	$label_ids = true;
+    $output = null;
+
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+			case 'tags':
+				$$_key = split("\|", $_val);
+				break;
+            case 'name':
+            case 'separator':
+                $$_key = $_val;
+                break;
+
+            case 'labels':
+			case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'checked':
+            case 'selected':
+                $selected = array_map('strval', array_values((array)$_val));
+                break;
+
+            case 'checkboxes':
+                $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    settype($selected, 'array');
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_checkboxes_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+
+
+    } else {
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_checkboxes_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+}
+
+function smarty_function_html_checkboxes_output_ex($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $tags) {
+	$_output = '';
+		
+    $_output .= '<input type="checkbox" name="'
+        . smarty_function_escape_special_chars($name) . '[]" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+	
+	if ($labels && $label_ids) {
+		$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+		$_output .= ' id="' . $_id . '"';
+	}
+	
+    if (in_array((string)$value, $selected)) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />';
+	
+	$_output .= $tags[0];
+	
+	if ($labels) {
+		if($label_ids) {
+			$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+			$_output .= '<label for="' . $_id . '">';
+		} else {
+			$_output .= '<label>';			
+		}
+	}
+	
+	// ÃÍ¤òÁÞÆþ
+	$_output .= $output;
+	
+	$_output .= $tags[1];
+	
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/trunk/data/smarty_extends/function.html_radios_ex.php
===================================================================
--- /temp/trunk/data/smarty_extends/function.html_radios_ex.php	(revision 1328)
+++ /temp/trunk/data/smarty_extends/function.html_radios_ex.php	(revision 1328)
@@ -0,0 +1,171 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_radios} function plugin
+ *
+ * File:       function.html_radios.php<br>
+ * Type:       function<br>
+ * Name:       html_radios<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of radio input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "radio"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each radio button
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_radios values=$ids output=$names}
+ * {html_radios values=$ids name='box' separator='<br>' output=$names}
+ * {html_radios values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_radios_ex($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+   
+    $name = 'radio';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $label_ids = true;
+    $output = null;
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+			case 'tags':
+				$$_key = split("\|", $_val);
+				break;
+            case 'name':
+            case 'separator':
+                $$_key = (string)$_val;
+                break;
+
+            case 'checked':
+            case 'selected':
+                if(is_array($_val)) {
+                    $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
+                } else {
+                    $selected = (string)$_val;
+                }
+                break;
+
+            case 'labels':
+            case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'radios':
+                $smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+			
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_radios_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+
+    } else {
+
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_radios_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_radios_output_ex($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $tags) {
+   $_output = '';
+  
+   $_output .= '<input type="radio" name="'
+        . smarty_function_escape_special_chars($name) . '" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+  	
+   if ($labels && $label_ids) {
+	   $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+	   $_output .= ' id="' . $_id . '"';
+   }
+    if ((string)$value == $selected) {
+        $_output .= ' checked="checked"';
+    }
+	
+	$_output .= $extra . ' />';
+    
+	$_output .= $tags[0];
+		
+	if ($labels) {
+      if($label_ids) {
+		  $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+          $_output .= '<label for="' . $_id . '">';
+      } else {
+          $_output .= '<label>';           
+      }
+    }
+	
+	// ÃÍ¤òÁÞÆþ
+	$_output .= $output;
+	
+	$_output .= $tags[1];
+	
+	if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/trunk/data/class/SC_Cookie.php
===================================================================
--- /temp/trunk/data/class/SC_Cookie.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Cookie.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+/*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */
+class SC_Cookie {
+	
+	var $expire;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_Cookie($day = 365) {
+		// Í­¸ú´ü¸Â
+		$this->expire = time() + ($day * 24 * 3600);
+	}
+	
+	// ¥¯¥Ã¥­¡¼½ñ¤­¹þ¤ß
+	function setCookie($key, $val) {
+		setcookie($key, $val, $this->expire, "/", DOMAIN_NAME);
+	}
+	
+	// ¥¯¥Ã¥­¡¼¼èÆÀ
+	function getCookie($key) {
+		return $_COOKIE[$key];
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_Pdf.php
===================================================================
--- /temp/trunk/data/class/SC_Pdf.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Pdf.php	(revision 1328)
@@ -0,0 +1,529 @@
+<?php
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] GC_Pdf
+ * [³µÍ×] Pdf¥Õ¥¡¥¤¥ë¤òÉ½¼¨¤¹¤ë¡£(PDFLibÉ¬¿Ü)
+ *----------------------------------------------------------------------
+ */
+
+// ¥°¥ê¥Ã¥É¤ÈÊ¸»ú¤Î´Ö³Ö 
+define("GRID_SPACE", 4);
+
+class SC_Pdf {
+	var $arrText;
+	var $arrImage;
+	var $license_key;
+	var $block_option;
+	var $src_code;
+	var $dst_code;
+	var $pdiwarning;
+	var $pdfpath;
+	var $page_close;
+			
+	function SC_Pdf($width = 595, $height = 842, $fontsize = 10) {
+		$this->license_key = "B600602-010400-714251-5851C1";
+		$this->src_code = "EUC-JP";
+		// UTF-8¤Ç¤Ê¤¤¤È¥Ö¥í¥Ã¥¯Æâ¤Ç²þ¹Ô¤Ç¤­¤Ê¤¤¡£
+		$this->dst_code = "UTF-8";
+		// PDF BLOCK¤Î¥×¥í¥Ñ¥Æ¥£
+		$this->block_option = "encoding=UniJIS-UCS2-H textformat=utf8 fontname=HeiseiMin-W3 textflow=true";
+		// ·Ù¹ðÉ½¼¨
+		$this->pdiwarning = "true";	
+		// ¥Ú¡¼¥¸¥µ¥¤¥ºÀßÄê
+		$this->width = $width;
+		$this->height = $height;
+		// PDF½é´ü²½
+		$this->pdf = PDF_new();
+		PDF_set_parameter($this->pdf, "license", $this->license_key);
+		PDF_set_parameter($this->pdf, "pdiwarning", $this->pdiwarning);
+		// ¥É¥­¥å¥á¥ó¥È³«»Ï
+		PDF_begin_document($this->pdf, NULL, NULL);
+		// ¥Ú¡¼¥¸¤Î¾õÂÖ
+		$this->page_open = false;
+		// ¥Æ¡¼¥Ö¥ë¤Î¿§ÀßÄê
+		$this->setTableColor();
+		// ¥Õ¥©¥ó¥È¥µ¥¤¥º¤ÎÀßÄê
+		$this->fontsize = $fontsize;
+		// ¥°¥ê¥Ã¥ÉÉÁ²è¤ÎÆÃ¼ì»ØÄê
+		$this->arrLines = array();
+		// ¥Æ¡¼¥Ö¥ë¥¿¥¤¥È¥ë¤Î¥¹¥¿¥¤¥ë
+		$this->arrHeaderColSize = array();
+		$this->arrHeaderAlign = array();
+		// ¥Æ¡¼¥Ö¥ëÊäÀµÃÍ
+		$this->table_left = 0;
+		// ¥¿¥¤¥È¥ë¹Ô¤Î½ÐÎÏ
+		$this->title_enable = true;
+		// ¥°¥ê¥Ã¥É¤Î½ÐÎÏ
+		$this->grid_enable = true;
+	}
+	
+	// ¥¿¥¤¥È¥ë¤ò½ÐÎÏ¤¹¤ë¤«ÈÝ¤«
+	function setTitleEnable($flag) {
+		$this->title_enable = $flag;
+	}
+	
+	// ¥°¥ê¥Ã¥É¤ò½ÐÎÏ¤¹¤ë¤«ÈÝ¤«
+	function setGridEnable($flag) {
+		$this->grid_enable = $flag;
+	}
+		
+		
+	// ¥­¡¼¡§¥Ö¥í¥Ã¥¯Ì¾¡¢ÃÍ¡§É½¼¨¥Æ¥­¥¹¥È¤Î¥Ï¥Ã¥·¥åÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£
+	function setTextBlock($list) {
+		unset($this->arrText);
+		$this->arrText[] = $list;
+	}
+	
+	// ¥­¡¼¡§¥Ö¥í¥Ã¥¯Ì¾¡¢ÃÍ¡§¥Õ¥¡¥¤¥ë¥Ñ¥¹¤Î¥Ï¥Ã¥·¥åÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£
+	// ¢¨¥Ñ¥¹¤Ï¥É¥­¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼
+	function setImageBlock($list) {
+		unset($this->arrImage);
+		$this->arrImage[] = $list;
+	}
+	
+	// É½¼¨ÇØ·Ê¤È¤Ê¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¥Ñ¥¹
+	// ¢¨¥Ñ¥¹¤Ï¥É¥­¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼
+	function setTemplate($pdfpath) {
+		if(file_exists($pdfpath)) {
+			$this->pdfpath = $pdfpath;
+		} else {
+			print("»ØÄê¤·¤¿PDF¥Æ¥ó¥×¥ì¡¼¥È¤ÏÂ¸ºß¤·¤Þ¤»¤ó¡§".$pdfpath);
+			exit;
+		}
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë°ÌÃÖÊäÀµÃÍ
+	function setTableLeft($table_left) {
+		$this->table_left = $table_left;
+	}
+	
+	// ¥°¥ê¥Ã¥ÉÉÁ²è¤ÎÆÃ¼ì»ØÄê
+	function setGridLines($list) {
+		$this->arrLines = $list;
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¥¿¥¤¥È¥ë¤Î¥¹¥¿¥¤¥ëÀßÄê
+	function setTableHeaderStyle($arrColSize, $arrAlign) {
+		$this->arrHeaderColSize = $arrColSize;
+		$this->arrHeaderAlign = $arrAlign;
+	}
+	
+	// ¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß(close¤¹¤ë¤È¼¡²ó¿·µ¬¥Ú¡¼¥¸)
+	function writeBlock() {
+		// ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤¹¤ë
+		if(!file_exists($this->pdfpath)) {
+			return;
+		}
+		// ´ûÂ¸PDF¤Î¥É¥­¥å¥á¥ó¥È¤ò¼èÆÀ
+		$doc = pdf_open_pdi($this->pdf, $this->pdfpath, NULL, 0 );
+		// ´ûÂ¸PDF¤Î¥É¥­¥å¥á¥ó¥È¤«¤é»ØÄê¥Ú¡¼¥¸¤ò¼èÆÀ
+		$page = pdf_open_pdi_page($this->pdf, $doc, 1, NULL );
+		// ¥Ú¡¼¥¸¤ò³«¤¯
+		$this->openPage();
+		
+		// ´ûÂ¸PDF¤Î¥Ú¡¼¥¸¤ò³ä¤êÅö¤Æ¤ë
+		PDF_fit_pdi_page($this->pdf, $page, 0, 0, "adjustpage");
+		
+		// ¥Æ¥­¥¹¥È¥Ö¥í¥Ã¥¯¤Î½ñ¤­¹þ¤ß
+		$max = count($this->arrText);
+		for($i = 0;$i < $max; $i++) {
+			foreach($this->arrText[$i] as $key => $val) {
+				if($val != "") {
+					// Ê¸»ú¥³¡¼¥É¤ÎÊÑ´¹
+					mb_convert_variables($this->dst_code, $this->src_code, $val);
+					// ½ñ¤­¹þ¤ß
+					$ret = PDF_fill_textblock($this->pdf, $page, $key, $val, $this->block_option);
+				}
+			}
+		}
+		
+		// ¥¤¥á¡¼¥¸¥Ö¥í¥Ã¥¯¤Î½ñ¤­¹þ¤ß
+		$max = count($this->arrImage);
+		for($i = 0;$i < $max; $i++) {
+			foreach($this->arrImage[$i] as $key => $val) {
+				if($val != "") {
+					$img = PDF_load_image($this->pdf, "auto", $val, NULL );
+					$ret = PDF_fill_imageblock($this->pdf, $page, $key, $img, NULL);
+				}
+			}
+		}
+		
+		// ³ä¤êÅö¤Æ¤¿¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+		PDF_close_pdi_page($this->pdf, $page);
+		// ³ä¤êÅö¤Æ¤¿¥É¥­¥å¥á¥ó¥È¤òÊÄ¤¸¤ë
+		PDF_close_pdi($this->pdf, $doc);
+	}
+	
+	// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+	function closePage() {
+		if($this->page_open) {
+			// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+			PDF_end_page_ext($this->pdf, NULL);
+			$this->page_open = false;
+		}		
+	}
+	
+	// ¥Ú¡¼¥¸¤ò³«¤¯
+	function openPage() {
+		if(!$this->page_open) {
+			// ¿·¤·¤¤¥Ú¡¼¥¸¤ò³«¤¯	
+			PDF_begin_page_ext($this->pdf, $this->width, $this->height, NULL);
+			$this->page_open = true;
+		}
+	}
+	
+	// ¿·¤·¤¤¥Ú¡¼¥¸¤ò³«¤¯
+	function newPage() {
+		PDF_end_page_ext($this->pdf, NULL);
+		PDF_begin_page_ext($this->pdf, $this->width, $this->height, NULL);
+	}
+	
+	// ¥¢¥¯¥Æ¥£¥Ö¤Ê¥Ú¡¼¥¸¤Î¥µ¥¤¥º¤ò¼èÆÀ¤¹¤ë
+	function getSize() {
+		$this->openPage();
+		$x = PDF_get_value($this->pdf, 'pagewidth', 0);
+		$y = PDF_get_value($this->pdf, 'pageheight', 0);
+		return array($x, $y);
+	}
+	
+	// ºÂÉ¸¤òÆþ¤ìÂØ¤¨¤Æ¼èÆÀ¤¹¤ë(º¸²¼(0,0)¤òº¸¾å(0,0)¤ËÊÑ´¹)
+	function posTopDown($x, $y) {
+		$width = 0;
+		$height = 0;
+		list($width, $height) = $this->getSize();
+		// xºÂÉ¸¤Ï¡¢ÊÑ¹¹¤ÎÉ¬Í×¤Ê¤·
+		$pdf_x = $x;
+		$pdf_y = $height - $y;
+		return array($pdf_x, $pdf_y);
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¥«¥é¡¼¤ÎÀßÄê
+	function setTableColor($frame_color = "000000", $title_color = "F0F0F0", $line_color = "D1DEFE", $last_color = "FDCBFE") {
+		$this->frame_color = $frame_color;
+		$this->title_color = $title_color;
+		$this->line_color = $line_color;
+		$this->last_color = $last_color;
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¤Î¥°¥ê¥Ã¥É¤òÉ½¼¨¤¹¤ë¡£
+	function writeGrid($x, $y, $arrCol, $line_max, $last_color_flg = true) {
+		// ¥Æ¡¼¥Ö¥ëÉý
+		$max = count($arrCol);
+		$width = 0;
+		for($i = 0; $i < $max; $i++) {
+			$width += $arrCol[$i];
+		}
+		
+		if($this->title_enable) { 
+			// ¥¿¥¤¥È¥ë¥°¥ê¥Ã¥ÉÉÁ²è
+			$this->writeFrameRect($x, $y + GRID_SPACE, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->title_color, $this->frame_color);
+		}
+		
+		// ¥°¥ê¥Ã¥ÉÆÃ¼ì»ØÄê¤¢¤ê
+		if(count($this->arrLines) > 0) {
+			$count = count($this->arrLines);
+			$pos = 0;
+			for($i = 0; $i < $count; $i++) {
+				if(($i % 2) != 0) {
+					// ¹Ô¤Î´Ö³Ö
+					$down = ($pos + 1) * $this->fontsize * 1.5;
+					// ÉÁ²è¤¹¤ë½ÄÉý¤òµá¤á¤ë
+					$height = ($this->fontsize + GRID_SPACE) * $this->arrLines[$i] + ($this->arrLines[$i] - 1);
+					// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+					$this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $height, $this->line_color);
+				}
+				$pos += $this->arrLines[$i];	
+			}						
+		} else {
+			for($i = 1; $i <= $line_max; $i++) {
+				if(($i % 2) == 0) {
+					// ¹Ô¤Î´Ö³Ö
+					$down = $i * $this->fontsize * 1.5;
+					// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+					$this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->line_color);
+				}
+			}
+			// ºÇ½ª¹Ô¤Ë¿§¤ò¤Ä¤±¤ë¾ì¹ç
+			if($last_color_flg) {
+				// ¹Ô¤Î´Ö³Ö
+				$down = $line_max * $this->fontsize * 1.5;
+				// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+				$this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->last_color);
+			}
+		}
+	}
+	
+	// ¥°¥ê¥Ã¥ÉÍÑ¤Î¥¢¥ó¥À¡¼¥é¥¤¥ó¤ò°ú¤¯
+	/*
+		$x			:¥Æ¡¼¥Ö¥ë³«»Ï°ÌÃÖX¼´
+		$y			:¥Æ¡¼¥Ö¥ë³«»Ï°ÌÃÖY¼´
+		$arrCol		:¥«¥é¥à¥µ¥¤¥º¤ÎÇÛÎó
+		$line		:¥¢¥ó¥À¡¼¥é¥¤¥ó¤ò°ú¤¯¹Ô
+		$start_col	:¥¢¥ó¥À¡¼¥é¥¤¥ó³«»Ï¥«¥é¥à(0:³«»Ï¥«¥é¥à)
+	 */
+	function writeUnderLine($x, $y, $arrCol, $line, $start_col = 0) {
+		// ¥Æ¡¼¥Ö¥ëÉý
+		$max = count($arrCol);
+		$width = 0;
+		for($i = 0; $i < $max; $i++) {
+			$width += $arrCol[$i];
+		}
+		
+		$start_x = 0;
+		for($i = 0; $i < $start_col; $i++) {
+			$start_x += $arrCol[$i];
+		}
+		
+		// ¥¢¥ó¥À¡¼¥é¥¤¥ó¤ÎYºÂÉ¸¤òµá¤á¤ë
+		$down = ($line + 1) * $this->fontsize * 1.5;
+		// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+		$sx = $x + $start_x + GRID_SPACE + $this->table_left;
+		$sy = $y + GRID_SPACE + $down - 1;
+		$ex = $x + $width + GRID_SPACE;
+		$ey = $sy;
+				
+		$this->writeLine($sx, $sy, $ex, $ey);		
+	}
+	
+	// ¿¿¤óÃæ²£°ÌÃÖ¤òµá¤á¤ë
+	function getXCenter($width) {
+		$page_width = 0;
+		$page_height = 0;
+		list($page_width, $page_height) = $this->getSize();
+		$x = ($page_width - $width) / 2;
+		return $x;
+	}
+	
+	// ¼«Æ°Ãæ±û¤è¤»
+	function writeTableCenter($table, $y, $arrCol, $arrAlign, $line_max = 256, $start_no = 1, $last_color_flg = false) {
+		// ¥Æ¡¼¥Ö¥ë¥µ¥¤¥º¼èÆÀ
+		$width = 0;
+		foreach($arrCol as $val) {
+			$width += $val;
+		}
+		// Ãæ±û¤è¤»°ÌÃÖ¼èÆÀ
+		$x = $this->getXCenter($width) + $this->table_left;
+		list($ret_x, $ret_y) = $this->writeTable($table, $x, $y, $arrCol, $arrAlign, $line_max, $start_no, $last_color_flg);
+		// X¼´¤ÎºÂÉ¸¤òÊÖ¤¹
+		return array($ret_x, $ret_y);
+	}
+	
+	// ¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß(close¤¹¤ë¤È¼¡²ó¿·µ¬¥Ú¡¼¥¸)
+	// $start_no:1¹ÔÌÜ(¥¿¥¤¥È¥ë)¤ò0¤È¤¹¤ë¡£
+	// $line_max:¥¿¥¤¥È¥ë¤ò´Þ¤Þ¤Ê¤¤¹Ô¿ô
+	function writeTable($table, $x, $y, $arrCol, $arrAlign, $line_max = 256, $start_no = 1, $last_color_flg = false) {
+		$this->openPage();
+		
+		$table = ereg_replace("\n$", "", $table);
+				
+		$arrRet = split("\n", $table);
+								
+		if($line_max > (count($arrRet) - $start_no)) {
+			$line_max = count($arrRet) - $start_no;
+		}
+		
+		// ¥¿¥¤¥È¥ëÍ­¸ú
+		if($this->grid_enable) {
+			// ¥°¥ê¥Ã¥É¤ÎÉÁ²è
+			$this->writeGrid($x, $y, $arrCol, $line_max, $last_color_flg);
+		}
+		
+		// Unicode¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤È¤·¤ÆUTF-8¤òÀßÄê
+		PDF_set_parameter($this->pdf, "textformat", "utf8");
+		
+		// ¥¿¥¤¥È¥ëÍ­¸ú
+		if($this->title_enable) {
+			if(count($this->arrHeaderColSize) > 0 && count($this->arrHeaderAlign) > 0 ) {
+				list($linecol, $aligncol, $width) = $this->getTableOption($this->arrHeaderColSize, $this->arrHeaderAlign);
+			} else {
+				list($linecol, $aligncol, $width) = $this->getTableOption($arrCol, $arrAlign);
+			}	
+						
+			// ¥¿¥¤¥È¥ë¹Ô¤Î½ñ¤­¹þ¤ß
+			$option = "ruler {" . $linecol . "} ";
+			$option.= "tabalignment {" . $aligncol . "} ";
+			$fontsize =  $this->fontsize;
+			$option.= "hortabmethod ruler leading=150% fontname=HeiseiKakuGo-W5 fontsize=$fontsize encoding=UniJIS-UCS2-H";
+			
+			$this->writeTableData($table, $x, $y, $width, 0, 0, $option);
+		}
+		
+		list($linecol, $aligncol, $width) = $this->getTableOption($arrCol, $arrAlign);
+		
+		// ¥Ç¡¼¥¿¹Ô¤Î½ñ¤­¹þ¤ß
+		$option = "ruler {" . $linecol . "} ";
+		$option.= "tabalignment {" . $aligncol . "} ";
+		$option.= "hortabmethod ruler leading=150% fontname=HeiseiMin-W3 fontsize=$this->fontsize encoding=UniJIS-UCS2-H";
+		
+		if($start_no <= 0) {
+			$start_no = 1;
+			$end_no = $line_max;
+		} else {
+			$end_no = $start_no + $line_max - 1;
+		}
+		
+		$y += $this->fontsize * 1.5;
+		
+		list($ret_x, $ret_y) = $this->writeTableData($table, $x, $y, $width, $start_no, $end_no, $option);
+		
+		return array($ret_x, $ret_y);
+	}
+	
+	function getTableOption($arrCol, $arrAlign) {
+		// ¥«¥é¥à¥µ¥¤¥º
+		$max = count($arrCol);
+		$width = 0;
+		for($i = 0; $i < $max; $i++) {
+			$width += $arrCol[$i];
+			$linecol.= $width . " ";
+		}
+		
+		// ¥«¥é¥à°ÌÃÖ
+		$max = count($arrAlign);
+		for($i = 0; $i < $max; $i++) {
+			$aligncol.= $arrAlign[$i] . " ";
+		}
+		
+		return array($linecol, $aligncol, $width);
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß
+	function writeTableData($table, $x, $y, $table_width, $start_no, $end_no, $option) {
+		$arrLine = split("\n", $table);
+		for($i = $start_no; $i <= $end_no; $i++) {
+			$line.=$arrLine[$i] . "\n";
+		}
+				
+		// ¥Æ¡¼¥Ö¥ë°ÌÃÖ¤òµá¤á¤ë
+		list($pdf_x, $pdf_y) = $this->posTopDown($x, $y);
+						
+		// ¥Æ¡¼¥Ö¥ë¹â¤µ¤òµá¤á¤ë
+		$table_height = $this->fontsize * 1.5 * ($end_no - $start_no + 1);
+		// ¥Æ¡¼¥Ö¥ë±¦²¼¤ÎyºÂÉ¸¤òµá¤á¤ë
+		$end_y = $pdf_y - $table_height;
+		if($end_y < 0) {
+			$end_y = 0;
+		}
+		$enc_table = mb_convert_encoding($line, "utf-8", "euc-jp");
+				
+		$tf = PDF_create_textflow($this->pdf, $enc_table, $option);
+
+		PDF_fit_textflow($this->pdf, $tf, $pdf_x, $pdf_y, $pdf_x + $table_width, $end_y, NULL);
+		PDF_delete_textflow($this->pdf, $tf);
+		
+		// ¥Æ¡¼¥Ö¥ëº¸²¼ºÂÉ¸¤òÊÖ¤¹
+		return array($x, $y + $table_height);		
+	}
+		
+	// ¿§¤ÎÀßÄê
+	function setColor($rgb) {
+		if($rgb != "") {
+			list($r, $g, $b) = sfGetPdfRgb($rgb);
+			PDF_setcolor($this->pdf, "fillstroke", "rgb", $r, $g, $b, 0);	
+		}
+	}
+	
+	// Ã»·Á¤òÉÁ²è
+	function writeRect($x, $y, $width, $height, $rgb = "") {
+		$this->openPage();
+		list($pdf_x, $pdf_y) = $this->posTopDown($x, $y);
+		$this->setColor($rgb);
+		PDF_rect($this->pdf, $pdf_x,$pdf_y,$width,-$height);
+		PDF_fill($this->pdf);
+	}
+	
+	// ÏÈÉÕ¤ÎÃ»·Á¤òÉÁ²è
+	function writeFrameRect($x, $y, $width, $height, $rgb, $frgb) {
+		$this->openPage();
+		list($pdf_x, $pdf_y) = $this->posTopDown($x, $y);
+		$this->setColor($frgb);
+		PDF_rect($this->pdf, $pdf_x,$pdf_y,$width,-$height);
+		PDF_fill($this->pdf);
+		
+		$this->setColor($rgb);
+		PDF_rect($this->pdf, $pdf_x+1,$pdf_y-1,$width-2,-$height+2);
+		PDF_fill($this->pdf);		
+	}
+	
+	// Ä¾Àþ¤òÉÁ²è
+	function writeLine($sx, $sy, $ex, $ey, $rgb = "000000") {
+		$this->openPage();
+		list($pdf_sx, $pdf_sy) = $this->posTopDown($sx, $sy);
+		list($pdf_ex, $pdf_ey) = $this->posTopDown($ex, $ey);
+		$this->setColor($rgb);
+		PDF_setlinewidth($this->pdf, 1.0);
+		PDF_moveto($this->pdf, $pdf_sx, $pdf_sy);
+		PDF_lineto($this->pdf, $pdf_ex, $pdf_ey);
+		PDF_stroke($this->pdf);
+	}
+		
+	// ¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É
+	function output($filekey = "") {
+		if(isset($this->pdf)) {
+			// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+			$this->closePage();
+			// PDF¤Î½ªÎ»
+			PDF_end_document($this->pdf, NULL);
+			// ½ÐÎÏÍÑ¥Ç¡¼¥¿¤Î¼èÆÀ 
+			$buf = PDF_get_buffer($this->pdf);
+			$filename = $filekey . date("ymdHis").".pdf";
+						
+			header("Content-disposition: attachment; filename=$filename");
+			header("Content-type: application/octet-stream; name=$filename");
+					
+			/*
+			 * session_start()¤ò»öÁ°¤Ë¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë½ÐÎÏ¤µ¤ì¤ë°Ê²¼¤Î¥Ø¥Ã¥À¤Ï¡¢
+			 * URLÄ¾ÀÜ¸Æ¤Ó½Ð¤·»þ¤Ë¥¨¥é¡¼¤òÈ¯À¸¤µ¤»¤ë¤Î¤Ç¶õ¤Ë¤·¤Æ¤ª¤¯¡£
+			 *
+			 * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
+			 * Progma: no-cache
+			 *
+			 */
+			header("Cache-Control: ");
+			header("Pragma: ");
+			print $buf;
+			
+			// PDF²òÊü
+			PDF_delete($this->pdf);
+		} else {
+			print("PDF¤¬À¸À®¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+		}
+		exit;		
+	}
+	
+	// ¥Õ¥¡¥¤¥ë¤ÎÉ½¼¨
+	function display() {
+		if(isset($this->pdf)) {
+			// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+			$this->closePage();
+			// PDF¤Î½ªÎ»
+			PDF_end_document($this->pdf, NULL);
+			
+			// ½ÐÎÏÍÑ¥Ç¡¼¥¿¤Î¼èÆÀ 
+			$buf = PDF_get_buffer($this->pdf);
+			$len = strlen($buf);
+			header("Content-type: application/pdf");
+			header("Content-Length: $len");
+			header("Content-Disposition: inline; filename=". date("YmdHis").".pdf");
+								
+			/*
+			 * session_start()¤ò»öÁ°¤Ë¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë½ÐÎÏ¤µ¤ì¤ë°Ê²¼¤Î¥Ø¥Ã¥À¤Ï¡¢
+			 * URLÄ¾ÀÜ¸Æ¤Ó½Ð¤·»þ¤Ë¥¨¥é¡¼¤òÈ¯À¸¤µ¤»¤ë¤Î¤Ç¶õ¤Ë¤·¤Æ¤ª¤¯¡£
+			 *
+			 * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
+			 * Progma: no-cache
+			 *
+			 */
+			header("Cache-Control: ");
+			header("Pragma: ");
+			print $buf;
+			
+			// PDF²òÊü
+			PDF_delete($this->pdf);
+		} else {
+			print("PDF¤¬À¸À®¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+		}
+		exit;
+	}
+}
+
+?>
Index: /temp/trunk/data/class/SC_View.php
===================================================================
--- /temp/trunk/data/class/SC_View.php	(revision 1328)
+++ /temp/trunk/data/class/SC_View.php	(revision 1328)
@@ -0,0 +1,125 @@
+<?php
+$current_dir = realpath(dirname(__FILE__));
+require_once($current_dir . "/../module/Smarty/libs/Smarty.class.php");
+
+class SC_View {
+	
+    var $_smarty;
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+    function SC_View() {
+    	$this->_smarty = new Smarty;
+		$this->_smarty->left_delimiter = '<!--{';
+		$this->_smarty->right_delimiter = '}-->';
+		$this->_smarty->register_modifier("sfDispDBDate","sfDispDBDate");
+		$this->_smarty->register_modifier("sfConvSendDateToDisp","sfConvSendDateToDisp");
+		$this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp");
+		$this->_smarty->register_modifier("sfGetVal", "sfGetVal");
+		$this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle");
+		$this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor");
+		$this->_smarty->register_function("srTrim", "sfTrim");
+		$this->_smarty->register_function("sfPreTax", "sfPreTax");
+		$this->_smarty->register_function("sfPrePoint", "sfPrePoint");
+		$this->_smarty->register_function("sfGetChecked", "sfGetChecked");
+		$this->_smarty->register_function("sfTrimURL", "sfTrimURL");
+		$this->_smarty->register_function("sfMultiply", "sfMultiply");
+		$this->_smarty->register_function("sfPutBR", "sfPutBR");
+		$this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash");
+		$this->_smarty->register_function("sfCutString", "sfCutString");
+		$this->_smarty->plugins_dir=array("plugins", ROOT_DIR . "data/smarty_extends");
+		$this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding");
+		$this->_smarty->register_function("sf_mktime","sf_mktime");
+		$this->_smarty->register_function("sf_date","sf_date");		
+		
+		if(ADMIN_MODE == '1') {		
+			$this->time_start = time();
+		}
+	}
+    
+    // ¥Æ¥ó¥×¥ì¡¼¥È¤ËÃÍ¤ò³ä¤êÅö¤Æ¤ë
+    function assign($val1, $val2) {
+        $this->_smarty->assign($val1, $val2);
+    }
+    
+    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤ò¼èÆÀ
+    function fetch($template) {
+        return $this->_smarty->fetch($template);
+    }
+    
+    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤òÉ½¼¨
+    function display($template) {
+		$this->_smarty->display($template);
+		if(ADMIN_MODE == '1') {
+			$time_end = time();
+			$time = $time_end - $this->time_start;
+			print("½èÍý»þ´Ö:" . $time . "ÉÃ");
+		}
+	}
+  	
+  	// ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
+  	function assignobj($obj) {
+		$data = get_object_vars($obj);
+		foreach ($data as $key => $value){
+			$this->_smarty->assign($key, $value);
+		}
+  	}
+  	
+  	// Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
+  	function assignarray($array) {
+  		foreach ($array as $key => $val) {
+  			$this->_smarty->assign($key, $val);
+  		}
+  	}
+
+	/* ¥µ¥¤¥È½é´üÀßÄê */
+	function initpath() {
+		$array['tpl_mainnavi'] = ROOT_DIR . 'data/Smarty/templates/frontparts/mainnavi.tpl';
+//		$array['tpl_search_products_php'] = ROOT_DIR . 'html/frontparts/search_products.php';			// ¾¦ÉÊ¸¡º÷
+//		$array['tpl_leftnavi'] = 'frontparts/leftnavi.tpl';							// º¸¥Ê¥Ó
+		$array['tpl_search_products_php'] = ROOT_DIR . 'html/frontparts/bloc/search_products.php';		// ¾¦ÉÊ¸¡º÷
+		$array['tpl_leftnavi'] = ROOT_DIR . 'html/frontparts/bloc/leftnavi.tpl';						// º¸¥Ê¥Ó
+		$array['tpl_category_php'] = ROOT_DIR . 'html/frontparts/category.php';		// ¥«¥Æ¥´¥ê
+		$array['tpl_pankuzu_php'] = ROOT_DIR . 'html/frontparts/pankuzu.php';		// ¥Ñ¥ó¥¯¥º
+		$array['tpl_tv_products'] = 'frontparts/tv_products.tpl';					// TV¾Ò²ð¾¦ÉÊ
+		$array['tpl_maintitle'] = 'frontparts/maintitle.tpl';						// ¾®¸«½Ð¤·
+		$array['tpl_login_php'] = ROOT_DIR . 'html/frontparts/login.php';			
+		$array['tpl_banner'] = 'frontparts/banner.tpl';								// ¥Ð¥Ê¡¼
+		$array['tpl_root_id'] = sfGetRootId();
+		$array['tpl_mypage_list'] = 'mypage/list.tpl';								//¥Þ¥¤¥Ú¡¼¥¸¤ÎÊÔ½¸¥ê¥¹¥È
+		$this->assignarray($array);
+	}
+}
+
+class SC_AdminView extends SC_View{
+    function SC_AdminView() {
+    	parent::SC_View();
+		$this->_smarty->template_dir = TEMPLATE_ADMIN_DIR;
+		$this->_smarty->compile_dir = COMPILE_ADMIN_DIR;
+		$this->initpath();
+	}
+	
+	function printr($data){
+		print_r($data);
+	}
+}
+
+class SC_SiteView extends SC_View{
+    function SC_SiteView() {
+    	parent::SC_View();
+		$this->_smarty->template_dir = TEMPLATE_DIR;
+		$this->_smarty->compile_dir = COMPILE_DIR;
+		$this->initpath();
+		
+		// PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊÑ¹¹
+		sfDomainSessionStart();
+	}
+}
+
+class SC_UserView extends SC_SiteView{
+    function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) {
+    	parent::SC_SiteView();
+		$this->_smarty->template_dir = $template_dir;
+		$this->_smarty->compile_dir = $compile_dir;
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_PageLayout.php
===================================================================
--- /temp/trunk/data/class/SC_PageLayout.php	(revision 1328)
+++ /temp/trunk/data/class/SC_PageLayout.php	(revision 1328)
@@ -0,0 +1,59 @@
+<?php
+class SC_PageLayout {
+	
+    var $arrPageData;		// ¥Ú¡¼¥¸¥Ç¡¼¥¿³ÊÇ¼ÍÑ
+    var $arrPageList;		// ¥Ú¡¼¥¸¥Ç¡¼¥¿³ÊÇ¼ÍÑ
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+    function SC_PageLayout() {
+		$this->arrPageList = $this->getPageData();
+	}
+    
+	/**************************************************************************************************************
+	 * ´Ø¿ôÌ¾	¡§getPageData
+	 * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	 * °ú¿ô1	¡§$where  ¥¥¥ Where¶çÊ¸
+	 * °ú¿ô2	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+	 * Ìá¤êÃÍ	¡§¥Ö¥í¥Ã¥¯¾ðÊó
+	 **************************************************************************************************************/
+	function getPageData($where = '', $arrVal = ''){
+		$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+		$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+		$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+		
+		// SQLÀ¸À®
+		$sql .= " SELECT";
+		$sql .= " page_id";				// ¥Ú¡¼¥¸ID
+		$sql .= " ,page_name";			// Ì¾¾Î
+		$sql .= " ,url";				// URL
+		$sql .= " ,php_dir";			// phpÊÝÂ¸Àè¥Ç¥£¥ì¥¯¥È¥ê
+		$sql .= " ,tpl_dir";			// tplÊÝÂ¸Àè¥Ç¥£d¥ì¥¯¥È¥ê
+		$sql .= " ,filename";			// ¥Õ¥¡¥¤¥ëÌ¾¾Î
+		$sql .= " ,header_chk ";		// ¥Ø¥Ã¥À¡¼»ÈÍÑFLG
+		$sql .= " ,footer_chk ";		// ¥Õ¥Ã¥¿¡¼»ÈÍÑFLG
+		$sql .= " ,author";				// author¥¿¥°
+		$sql .= " ,description";		// description¥¿¥°
+		$sql .= " ,keyword";			// keyword¥¿¥°
+		$sql .= " ,update_url";			// ¹¹¿·URL
+		$sql .= " ,create_date";		// ¥Ç¡¼¥¿ºîÀ®Æü
+		$sql .= " ,update_date";		// ¥Ç¡¼¥¿¹¹¿·Æü
+		$sql .= " FROM ";
+		$sql .= "     dtb_pagelayout";
+		
+		// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+		if ($where != '') {
+			$sql .= " WHERE " . $where;
+		}
+		
+		$sql .= " ORDER BY 	page_id";
+		
+		$arrRet = $objDBConn->getAll($sql, $arrVal);
+		
+		$this->arrPageData = $arrRet;
+		
+		return $arrRet;
+	}
+
+
+}
+?>
Index: /temp/trunk/data/class/SC_Page.php
===================================================================
--- /temp/trunk/data/class/SC_Page.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Page.php	(revision 1328)
@@ -0,0 +1,8 @@
+<?php
+class SC_Page {
+	var $tpl_main_page;
+	function SC_Page() {
+		$this->tpl_main_page = '';
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_Date.php
===================================================================
--- /temp/trunk/data/class/SC_Date.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Date.php	(revision 1328)
@@ -0,0 +1,127 @@
+<?php
+
+/*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */
+class SC_Date {
+	var $start_year;
+	var $month;
+	var $day;
+	var $end_year;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_Date($start_year='', $end_year='') {
+		if ( $start_year ) 	$this->setStartYear($start_year);	
+		if ( $end_year )	$this->setEndYear($end_year);
+	}
+	
+	function setStartYear($year){
+		$this->start_year = $year;
+	}
+
+	function setEndYear($endYear) {
+		$this->end_year = $endYear;	
+	}
+	
+	function setMonth($month){
+		$this->month = $month;			
+	}
+	
+	function setDay ($day){
+		$this->day = $day;
+	}
+			
+	function getYear($year = '', $default = ''){
+		if ( $year ) $this->setStartYear($year);
+		
+		$year = $this->start_year;
+		if ( ! $year ) $year = DATE("Y");
+		
+		$end_year = $this->end_year;
+		if ( ! $end_year ) $end_year = (DATE("Y") + 3);
+		
+		$year_array = array();
+		
+		for ($i=$year; $i<=($end_year); $i++){		
+			$year_array[$year] = $i;
+			if($year == $default) {
+				$year_array['----'] = "----";
+			}
+			$year++;
+		}
+		return $year_array;
+	}
+	
+	function getZeroYear($year = ''){
+		if ( $year ) $this->setStartYear($year);
+		
+		$year = $this->start_year;
+		if ( ! $year ) $year = DATE("Y");
+		
+		$end_year = $this->end_year;
+		if ( ! $end_year ) $end_year = (DATE("Y") + 3);
+		
+		$year_array = array();
+		
+		for ($i=$year; $i<=($end_year); $i++){
+			$key = substr($i, -2);
+			$year_array[$key] = $key;
+		}
+		return $year_array;
+	}
+	
+	function getZeroMonth(){
+	
+		$month_array = array();
+		for ($i=1; $i <= 12; $i++){
+			$val = sprintf("%02d", $i);
+			$month_array[$val] = $val;
+		}
+		return $month_array;
+	}	
+	
+	
+	function getMonth(){
+	
+		$month_array = array();
+		for ($i=0; $i < 12; $i++){		
+			$month_array[$i + 1 ] = $i + 1;
+		}
+		return $month_array;
+	}	
+	
+	function getDay(){	
+		
+		$day_array = array();
+		for ($i=0; $i < 31; $i++){		
+			$day_array[ $i + 1 ] = $i + 1;
+		}
+		
+		return $day_array;
+	}
+
+	function getHour(){	
+		
+		$day_array = array();
+		for ($i=0; $i<=23; $i++){		
+			$hour_array[$i] = $i;
+		}
+		
+		return $hour_array;
+	}
+
+	function getMinutes(){	
+		
+		$minutes_array = array();
+		for ($i=0; $i<=59; $i++){		
+			$minutes_array[$i] = $i;
+		}
+		
+		return $minutes_array;
+	}
+	
+	function getMinutesInterval(){	
+		
+		$minutes_array = array("00"=>"00", "30"=>"30");		
+		return $minutes_array;
+	}	
+}
+?>
Index: /temp/trunk/data/class/GC_SendMail.php
===================================================================
--- /temp/trunk/data/class/GC_SendMail.php	(revision 1328)
+++ /temp/trunk/data/class/GC_SendMail.php	(revision 1328)
@@ -0,0 +1,97 @@
+<?php
+
+//--- ¥Æ¥­¥¹¥È/HTML¡¡¥á¡¼¥ëÁ÷¿®
+class GC_SendMail {
+
+	var	$html;			//	HTML ¥á¡¼¥ë¥Ø¥Ã¥À¡¼
+	var $to;			//	Á÷¿®Àè
+	var $subject;		//	ÂêÌ¾
+	var $body;			//	ËÜÊ¸
+	var $header;		//	¥Ø¥Ã¥À¡¼
+	var $return_path;	//¡¡return path
+	var $mailer;
+
+	/*	¥Ø¥Ã¥ÀÅù¤ò³ÊÇ¼
+		 $to			-> Á÷¿®Àè¥á¡¼¥ë¥¢¥É¥ì¥¹
+		 $subject		-> ¥á¡¼¥ë¤Î¥¿¥¤¥È¥ë
+		 $body			-> ¥á¡¼¥ëËÜÊ¸
+		 $fromaddress	-> Á÷¿®¸µ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹
+		 $header		-> ¥Ø¥Ã¥À¡¼
+		 $from_name		-> Á÷¿®¸µ¤ÎÌ¾Á°¡ÊÁ´³ÑOK¡Ë
+		 $reply_to		-> reply_toÀßÄê
+		 $return_path	-> return-path¥¢¥É¥ì¥¹ÀßÄê¡Ê¥¨¥é¡¼¥á¡¼¥ëÊÖÁ÷ÍÑ¡Ë
+		 $cc			-> ¥«¡¼¥Ü¥ó¥³¥Ô¡¼
+		 $bcc			-> ¥Ö¥é¥¤¥ó¥É¥«¡¼¥Ü¥ó¥³¥Ô¡¼
+	*/	
+	
+	
+	function setTo($to, $to_name = "") {
+		if($to_name != "") {
+			$name = ereg_replace("<","¡ã", $to_name);
+			$name = ereg_replace(">","¡ä", $name);
+			$name = mb_encode_mimeheader($name);
+			$this->to = $name . "<" . $to . ">";
+		} else {
+			$this->to = $to;
+		}
+	}
+		
+	function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+		
+		$this->to			 = $to;
+		$this->subject		 = $subject;
+		$this->body			 = $body;
+		// ¥Ø¥Ã¥À¡¼¤ËÆüËÜ¸ì¤ò»ÈÍÑ¤¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
+		$from_name = ereg_replace("<","¡ã", $from_name);
+		$from_name = ereg_replace(">","¡ä", $from_name);
+				
+		$this->header		 = "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";
+		$this->header		.= "Reply-To: ". $reply_to . "\n";
+		$this->header		.= "Cc: " . $cc. "\n";
+		$this->header		.= "Bcc: " . $bcc . "\n";
+		$this->header		.= "Errors-To: ". $errors_to ."\n";
+		$this->return_path   = $return_path;
+	}
+
+	
+	function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+			
+		$this->to			 = $to;
+		$this->subject		 = Mb_encode_mimeheader($subject);
+		$this->body			 = mb_convert_encoding( $body, "iso-2022-jp", "EUC-JP");
+		$this->header		 = "Mime-Version: 1.0\n";
+		$this->header		.= "Content-Type: text/html; charset=iso-2022-jp\n";
+		$this->header		.= "Content-Transfer-Encoding: 7bit\n";
+		$this->header		.= "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";
+		$this->header		.= "Reply-To: ". $reply_to . "\n";
+		$this->header		.= "Cc: " . $cc. "\n";
+		$this->header		.= "Bcc: " . $bcc . "\n";
+		$this->header		.= "Errors-To: ". $errors_to ."\n";
+		$this->return_path   = $return_path;
+	}
+
+	//	¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë
+	function sendMail() {
+
+		Mb_language( "Japanese" );
+		
+		//¡¡¥á¡¼¥ëÁ÷¿®
+		if( mb_send_mail( $this->to, $this->subject, $this->body, $this->header, "-f" . $this->return_path ) ) {
+			return true;
+		}
+		return false;
+	}
+
+	function sendHtmlMail() {
+
+		Mb_language( "Japanese" );	
+		
+		//¡¡¥á¡¼¥ëÁ÷¿®
+		if( mail( $this->to, $this->subject, $this->body, $this->header, "-f" . $this->return_path ) ) {
+			return true;
+		}
+		return false;
+	}
+}
+
+?>
Index: /temp/trunk/data/class/SC_SiteInfo.php
===================================================================
--- /temp/trunk/data/class/SC_SiteInfo.php	(revision 1328)
+++ /temp/trunk/data/class/SC_SiteInfo.php	(revision 1328)
@@ -0,0 +1,30 @@
+<?php
+/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_SiteInfo {
+	
+	var $conn;
+	var $data;
+	
+	function SC_SiteInfo($conn = ''){
+		$DB_class_name = "SC_DbConn";
+		if ( is_object($conn)){
+			if ( is_a($conn, $DB_class_name)){
+				// $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë
+				$this->conn = $conn;
+			}
+		} else {
+			if (class_exists($DB_class_name)){
+				//$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë
+				$this->conn = new SC_DbConn();			
+			}
+		}
+		if ( is_object($this->conn)){
+			$conn = $this->conn;
+			$sql = "SELECT * FROM dtb_baseinfo";
+			$data = $conn->getAll($sql);
+			$this->data = $data[0];
+		}
+	}
+	
+}
+?>
Index: /temp/trunk/data/class/SC_Image.php
===================================================================
--- /temp/trunk/data/class/SC_Image.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Image.php	(revision 1328)
@@ -0,0 +1,49 @@
+<?php
+
+//---- ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(thumb.php¤È¥»¥Ã¥È¤Ç»ÈÍÑ¤¹¤ë)
+class SC_Image {
+	
+	var $tmp_dir;
+		
+	function SC_Image($tmp_dir) {
+		// ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëÆÉ¹þ
+		$include_dir = realpath(dirname( __FILE__));
+		require_once($include_dir . "/../lib/thumb.php");
+		if(!ereg("/$", $tmp_dir)) {
+			$this->tmp_dir = $tmp_dir . "/";
+		} else {
+			$this->tmp_dir = $tmp_dir;
+		}
+	}
+	
+	//--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®(¥µ¥à¥Í¥¤¥ë²èÁüÀ¸À®ÍÑ)
+	function makeTempImage($keyname, $max_width, $max_height) {
+		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+		$mainname = uniqid("").".";
+		// ³ÈÄ¥»Ò°Ê³°¤òÃÖ¤­´¹¤¨¤ë¡£
+		$newFileName = ereg_replace("^.*\.",$mainname, $_FILES[$keyname]['name']);
+		$result  = MakeThumb($_FILES[$keyname]['tmp_name'], $this->tmp_dir , $max_width, $max_height, $newFileName);
+		gfDebugLog($result);
+		return $newFileName;
+	}
+
+	//--- ¥Õ¥¡¥¤¥ë¤ò»ØÄêÊÝÂ¸DIR¤Ø°ÜÆ°
+	function moveTempImage($filename, $save_dir) {
+		// ¥³¥Ô¡¼¸µ¥Õ¥¡¥¤¥ë¡¢¥³¥Ô¡¼Àè¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ë¤Î¤ß¼Â¹Ô¤¹¤ë
+		if(file_exists($this->tmp_dir.$filename) && file_exists($save_dir)) {
+			if(copy($this->tmp_dir . $filename , $save_dir."/".$filename)) {
+				unlink( $this->tmp_dir . $filename );
+			}
+		} else {
+			gfDebugLog($this->tmp_dir.$filename."¤Î°ÜÆ°¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+		}
+	}
+
+	//---- »ØÄê¥Õ¥¡¥¤¥ë¤òºï½ü	
+	function deleteImage($filename, $dir) {
+		if(file_exists($dir."/".$filename)) {
+			unlink($dir."/".$filename);
+		}
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_Session.php
===================================================================
--- /temp/trunk/data/class/SC_Session.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Session.php	(revision 1328)
@@ -0,0 +1,88 @@
+<?php
+/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_Session {
+	var $login_id;		// ¥í¥°¥¤¥ó¥æ¡¼¥¶Ì¾
+	var $authority;		// ¥æ¡¼¥¶¸¢¸Â
+	var $cert;			// Ç§¾ÚÊ¸»úÎó(Ç§¾ÚÀ®¸ù¤ÎÈ½Äê¤Ë»ÈÍÑ)
+	var $sid;			// ¥»¥Ã¥·¥ç¥óID
+	var $member_id;		// ¥í¥°¥¤¥ó¥æ¡¼¥¶¤Î¼ç¥­¡¼
+	
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_Session() {
+		// ¥»¥Ã¥·¥ç¥ó³«»Ï
+		sfDomainSessionStart();
+		// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊÝÂ¸
+		if(isset($_SESSION['cert'])) {
+			$this->sid = session_id();
+			$this->cert = $_SESSION['cert'];
+			$this->login_id = $_SESSION['login_id'];
+			$this->authority = $_SESSION['authority'];	// ´ÉÍý¼Ô:0, °ìÈÌ:1, ±ÜÍ÷:2
+			$this->member_id = $_SESSION['member_id'];
+			// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+			gfPrintLog("access : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid);
+		} else {
+			// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+			gfPrintLog("access error.");
+		}
+	}
+	
+	/* Ç§¾ÚÀ®¸ù¤ÎÈ½Äê */
+	function IsSuccess() {
+		global $arrPERMISSION;
+				
+		if($this->cert == CERT_STRING) {
+			if(isset($arrPERMISSION[$_SERVER['PHP_SELF']])) {
+				// ¿ôÃÍ¤¬¼«Ê¬¤Î¸¢¸Â°Ê¾å¤Î¤â¤Î¤Ç¤Ê¤¤¤È¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¡£
+				if($arrPERMISSION[$_SERVER['PHP_SELF']] < $this->authority) {			
+					return AUTH_ERROR;
+				} 
+			}
+			return SUCCESS;
+		}
+		
+		return ACCESS_ERROR;
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥ó¤Î½ñ¤­¹þ¤ß */
+	function SetSession($key, $val) {
+		$_SESSION[$key] = $val;
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥ó¤ÎÆÉ¤ß¹þ¤ß */
+	function GetSession($key) {
+		return $_SESSION[$key];
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥óID¤Î¼èÆÀ */
+	function GetSID() {
+		return $this->sid;
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥ó¤ÎÇË´þ */
+	function EndSession() {
+		// ¥Ç¥Õ¥©¥ë¥È¤Ï¡¢¡ÖPHPSESSID¡×
+		$sname = session_name();
+		// ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤òÁ´¤Æ²ò½ü¤¹¤ë
+		$_SESSION = array();
+		// ¥»¥Ã¥·¥ç¥ó¤òÀÚÃÇ¤¹¤ë¤Ë¤Ï¥»¥Ã¥·¥ç¥ó¥¯¥Ã¥­¡¼¤âºï½ü¤¹¤ë¡£
+		// Note: ¥»¥Ã¥·¥ç¥ó¾ðÊó¤À¤±¤Ç¤Ê¤¯¥»¥Ã¥·¥ç¥ó¤òÇË²õ¤¹¤ë¡£
+		if (isset($_COOKIE[$sname])) {
+			setcookie($sname, '', time()-42000, '/');
+		}
+		// ºÇ½ªÅª¤Ë¡¢¥»¥Ã¥·¥ç¥ó¤òÇË²õ¤¹¤ë
+		session_destroy();
+		// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+		gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid);
+	}
+	
+	// ´ØÏ¢¥»¥Ã¥·¥ç¥ó¤Î¤ßÇË´þ¤¹¤ë¡£
+	function logout() {
+		unset($_SESSION['cert']);
+		unset($_SESSION['login_id']);
+		unset($_SESSION['authority']);
+		unset($_SESSION['member_id']);
+		// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+		gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid);
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_FormParam.php
===================================================================
--- /temp/trunk/data/class/SC_FormParam.php	(revision 1328)
+++ /temp/trunk/data/class/SC_FormParam.php	(revision 1328)
@@ -0,0 +1,343 @@
+<?php
+
+/* ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ */
+class SC_FormParam {
+
+	var $param;	
+	var $disp_name;
+	var $keyname;
+	var $length;
+	var $convert;
+	var $arrCheck;
+	var $default;	// ²¿¤âÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤ËÉ½¼¨¤¹¤ëÃÍ
+	var $input_db;	// DB¤Ë¤½¤Î¤Þ¤ÞÁÞÆþ²ÄÇ½¤«ÈÝ¤«
+	var $html_disp_name;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_FormParam() {
+		$this->check_dir = IMAGE_SAVE_DIR;
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤ÎÄÉ²Ã
+	function addParam($disp_name, $keyname, $length="", $convert="", $arrCheck=array(), $default="", $input_db="true") {
+		$this->disp_name[] = $disp_name;
+		$this->keyname[] = $keyname;
+		$this->length[] = $length;
+		$this->convert[] = $convert;
+		$this->arrCheck[] = $arrCheck;
+		$this->default[] = $default;
+		$this->input_db[] = $input_db;
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤ÎÆþÎÏ
+	// $arrVal	:$arrVal['keyname']¡¦¡¦¤ÎÇÛÎó¤ò°ìÃ×¤·¤¿¥­¡¼¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ë³ÊÇ¼¤¹¤ë
+	// $seq		:true¤Î¾ì¹ç¡¢$arrVal[0]¢·¤ÎÇÛÎó¤òÅÐÏ¿½ç¤Ë¥¤¥ó¥¹¥¿¥ó¥¹¤Ë³ÊÇ¼¤¹¤ë
+	function setParam($arrVal, $seq = false) {
+		$cnt = 0;
+		if(!$seq){
+			foreach($this->keyname as $val) {
+				if(isset($arrVal[$val])) {
+					$this->setValue($val, $arrVal[$val]);
+				}
+			}		
+		} else {
+			foreach($this->keyname as $val) {
+				$this->param[$cnt] = $arrVal[$cnt];
+				$cnt++;
+			}
+		}
+	}
+	
+	// ²èÌÌÉ½¼¨ÍÑ¥¿¥¤¥È¥ëÀ¸À®
+	function setHtmlDispNameArray() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			$find = false;
+			foreach($this->arrCheck[$cnt] as $val) {
+				if($val == "EXIST_CHECK") {
+					$find = true;
+				}
+			}
+			
+			if($find) {
+				$this->html_disp_name[$cnt] = $this->disp_name[$cnt] . "<span class='red'>(¢¨ É¬¿Ü)</span>";					
+			} else {
+				$this->html_disp_name[$cnt] = $this->disp_name[$cnt];
+			}								
+			$cnt++;
+		}
+	}
+	
+	// ²èÌÌÉ½¼¨ÍÑ¥¿¥¤¥È¥ë¼èÆÀ
+	function getHtmlDispNameArray() {
+		return $this->html_disp_name;
+	}
+		
+	// Ê£¿ôÎó¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ
+	function setParamList($arrVal, $keyname) {
+		// DB¤Î·ï¿ô¤ò¼èÆÀ¤¹¤ë¡£
+		$count = count($arrVal);
+		$no = 1;
+		for($cnt = 0; $cnt < $count; $cnt++) {
+			$key = $keyname.$no;
+			if($arrVal[$cnt][$keyname] != "") {
+				$this->setValue($key, $arrVal[$cnt][$keyname]);
+			}
+			$no++;
+		}
+	}
+	
+	function setDBDate($db_date, $year_key = 'year', $month_key = 'month', $day_key = 'day') {
+		list($y, $m, $d) = split("[- ]", $db_date);
+		$this->setValue($year_key, $y);
+		$this->setValue($month_key, $m);
+		$this->setValue($day_key, $d);
+	}
+	
+	// ¥­¡¼¤ËÂÐ±þ¤·¤¿ÃÍ¤ò¥»¥Ã¥È¤¹¤ë¡£
+	function setValue($key, $param) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $key) {
+				$this->param[$cnt] = $param;
+				break;
+			}
+			$cnt++;
+		}
+	}
+	
+	function toLower($key) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $key) {
+				$this->param[$cnt] = strtolower($this->param[$cnt]);
+				break;
+			}
+			$cnt++;
+		}
+	}
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	function checkError($br = true, $keyname = "") {
+		// Ï¢ÁÛÇÛÎó¤Î¼èÆÀ
+		$arrRet = $this->getHashArray($keyname);
+		$objErr = new SC_CheckError($arrRet);
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			foreach($this->arrCheck[$cnt] as $func) {
+				switch($func) {
+				case 'EXIST_CHECK':
+				case 'NUM_CHECK':
+				case 'EMAIL_CHECK':
+				case 'EMAIL_CHAR_CHECK':
+				case 'ALNUM_CHECK':
+				case 'KANA_CHECK':
+				case 'URL_CHECK':
+				case 'SPTAB_CHECK':
+				case 'ZERO_CHECK':
+				case 'ALPHA_CHECK':
+				case 'ZERO_START':
+				case 'FIND_FILE':
+				case 'NO_SPTAB':
+				case 'DIR_CHECK':
+				case 'DOMAIN_CHECK':
+				
+					if(!is_array($this->param[$cnt])) {
+						$objErr->doFunc(array($this->disp_name[$cnt], $val), array($func));
+					} else {
+						$max = count($this->param[$cnt]);
+						for($i = 0; $i < $max; $i++) {
+							$objSubErr = new SC_CheckError($this->param[$cnt]);
+							$objSubErr->doFunc(array($this->disp_name[$cnt], $i), array($func));
+							if(count($objSubErr->arrErr) > 0) {
+								foreach($objSubErr->arrErr as $mess) {
+									if($mess != "") {
+										$objErr->arrErr[$val] = $mess;
+									}
+								}
+							}
+						}
+					}
+					break;
+				case 'MAX_LENGTH_CHECK':
+				case 'NUM_COUNT_CHECK':
+					if(!is_array($this->param[$cnt])) {
+						$objErr->doFunc(array($this->disp_name[$cnt], $val, $this->length[$cnt]), array($func));
+					} else {
+						$max = count($this->param[$cnt]);
+						for($i = 0; $i < $max; $i++) {
+							$objSubErr = new SC_CheckError($this->param[$cnt]);
+							$objSubErr->doFunc(array($this->disp_name[$cnt], $i, $this->length[$cnt]), array($func));
+							if(count($objSubErr->arrErr) > 0) {
+								foreach($objSubErr->arrErr as $mess) {
+									if($mess != "") {
+										$objErr->arrErr[$val] = $mess;
+									}
+								}
+							}
+						}
+					}
+					break;
+				// ¾®Ê¸»ú¤ËÊÑ´¹
+				case 'CHANGE_LOWER':
+					$this->param[$cnt] = strtolower($this->param[$cnt]);
+					break;
+				// ¥Õ¥¡¥¤¥ë¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+				case 'FILE_EXISTS':
+					if($this->param[$cnt] != "" && !file_exists($this->check_dir . $this->param[$cnt])) {
+						$objErr->arrErr[$val] = "¢¨ " . $this->disp_name[$cnt] . "¤Î¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£<br>";					
+					}
+					break;
+				default:
+					$objErr->arrErr[$val] = "¢¨¢¨¡¡¥¨¥é¡¼¥Á¥§¥Ã¥¯·Á¼°($func)¤Ë¤ÏÂÐ±þ¤·¤Æ¤¤¤Þ¤»¤ó¡¡¢¨¢¨ <br>";
+					break;
+				}
+			}
+			
+			if (isset($objErr->arrErr[$val]) && !$br) {
+				$objErr->arrErr[$val] = ereg_replace("<br>$", "", $objErr->arrErr[$val]);
+			}
+			$cnt++;
+		}
+		return $objErr->arrErr;
+	}
+	
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	function convParam() {
+		/*
+		 *	Ê¸»úÎó¤ÎÊÑ´¹
+		 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+		 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+		 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+		 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+		 *  a :  ¡ÖÁ´³Ñ¡×±Ñ»ú¤ò¡ÖÈ¾³Ñ¡×±Ñ»ú¤ËÊÑ´¹
+		 */
+		$cnt = 0;
+		foreach ($this->keyname as $val) {
+			if(!is_array($this->param[$cnt])) {
+				if($this->convert[$cnt] != "") {
+					$this->param[$cnt] = mb_convert_kana($this->param[$cnt] ,$this->convert[$cnt]);
+				}
+			} else {
+				$max = count($this->param[$cnt]);
+				for($i = 0; $i < $max; $i++) {
+					if($this->convert[$cnt] != "") {
+						$this->param[$cnt][$i] = mb_convert_kana($this->param[$cnt][$i] ,$this->convert[$cnt]);
+					}
+				}
+			}
+			$cnt++;
+		}
+	}
+	
+	// Ï¢ÁÛÇÛÎó¤ÎºîÀ®
+	function getHashArray($keyname = "") {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($keyname == "" || $keyname == $val) {
+				$arrRet[$val] = $this->param[$cnt];
+				$cnt++;
+			}
+		}
+		return $arrRet;
+	}
+	
+	// DB³ÊÇ¼ÍÑÇÛÎó¤ÎºîÀ®
+	function getDbArray() {
+		$cnt = 0;
+		foreach ($this->keyname as $val) {
+			if ($this->input_db[$cnt]) {
+				$arrRet[$val] = $this->param[$cnt];
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// ÇÛÎó¤Î½Ä²£¤òÆþ¤ìÂØ¤¨¤ÆÊÖ¤¹
+	function getSwapArray($arrKey) {
+		foreach($arrKey as $keyname) {
+			$arrVal = $this->getValue($keyname);
+			$max = count($arrVal);
+			for($i = 0; $i < $max; $i++) {
+				$arrRet[$i][$keyname] = $arrVal[$i];
+			}
+		}
+		return $arrRet;
+	}
+	
+	// ¹àÌÜÌ¾°ìÍ÷¤Î¼èÆÀ
+	function getTitleArray() {
+		return $this->disp_name;
+	}
+	
+	// ¹àÌÜ¿ô¤òÊÖ¤¹
+	function getCount() {
+		$count = count($this->keyname);
+		return $count;
+	}
+	
+	// ¥Õ¥©¡¼¥à¤ËÅÏ¤¹ÍÑ¤Î¥Ñ¥é¥á¡¼¥¿¤òÊÖ¤¹
+	function getFormParamList() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			// ¥­¡¼Ì¾
+			$arrRet[$val]['keyname'] = $this->keyname[$cnt];
+			// Ê¸»ú¿ôÀ©¸Â
+			$arrRet[$val]['length'] = $this->length[$cnt];
+			// ÆþÎÏÃÍ
+			$arrRet[$val]['value'] = $this->param[$cnt];
+			
+			if($this->default[$cnt] != "" && $this->param[$cnt] == "") {
+				$arrRet[$val]['value'] = $this->default[$cnt];
+			}
+					
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// ¥­¡¼Ì¾¤Î°ìÍ÷¤òÊÖ¤¹
+	function getKeyList() {
+		foreach($this->keyname as $val) {
+			$arrRet[] = $val;
+		}
+		return $arrRet;
+	}
+	
+	// ¥­¡¼Ì¾¤È°ìÃ×¤·¤¿ÃÍ¤òÊÖ¤¹
+	function getValue($keyname) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $keyname) {
+				$ret = $this->param[$cnt];
+				break;
+			}
+			$cnt++;
+		}
+		return $ret;
+	}
+	
+	function splitCheckBoxes($keyname) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $keyname) {
+				$this->param[$cnt] = sfSplitCheckBoxes($this->param[$cnt]);
+			}
+			$cnt++;
+		}
+	}
+	
+	function splitParamCheckBoxes($keyname) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $keyname) {
+				if(!is_array($this->param[$cnt])) {
+					$this->param[$cnt] = split("-", $this->param[$cnt]);
+				}
+			}
+			$cnt++;
+		}
+	}	
+}
+?>
Index: /temp/trunk/data/class/SC_UploadFile.php
===================================================================
--- /temp/trunk/data/class/SC_UploadFile.php	(revision 1328)
+++ /temp/trunk/data/class/SC_UploadFile.php	(revision 1328)
@@ -0,0 +1,274 @@
+<?php
+
+$SC_UPLOADFILE_DIR = realpath(dirname( __FILE__));
+require_once($SC_UPLOADFILE_DIR . "/../lib/gdthumb.php");	
+
+/* ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹ */
+class SC_UploadFile {
+	var $temp_dir;
+	var $save_dir;
+	var $keyname;	// ¥Õ¥¡¥¤¥ëinput¥¿¥°¤Îname
+	var $width;		// ²£¥µ¥¤¥º
+	var $height;	// ½Ä¥µ¥¤¥º
+	var $arrExt;	// »ØÄê¤¹¤ë³ÈÄ¥»Ò
+	var $temp_file;	// ÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾
+	var $save_file; // DB¤«¤éÆÉ¤ß½Ð¤·¤¿¥Õ¥¡¥¤¥ëÌ¾
+	var $disp_name;	// ¹àÌÜÌ¾
+	var $size;		// À©¸Â¥µ¥¤¥º
+	var $necessary; // É¬¿Ü¤Î¾ì¹ç:true
+	var $image;		// ²èÁü¤Î¾ì¹ç:true
+	
+	// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+	function SC_UploadFile($temp_dir, $save_dir) {
+		$this->temp_dir = $temp_dir;
+		$this->save_dir = $save_dir;
+		$this->file_max = 0;
+	}
+
+	// ¥Õ¥¡¥¤¥ë¾ðÊóÄÉ²Ã
+	function addFile($disp_name, $keyname, $arrExt, $size, $necessary=false, $width=0, $height=0, $image=true) {
+		$this->disp_name[] = $disp_name;
+		$this->keyname[] = $keyname;
+		$this->width[] = $width;
+		$this->height[] = $height;
+		$this->arrExt[] = $arrExt;
+		$this->size[] = $size;
+		$this->necessary[] = $necessary;
+		$this->image[] = $image;
+	}
+	// ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎºîÀ®
+	function makeThumb($src_file, $width, $height) {
+		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+		$uniqname = date("mdHi") . "_" . uniqid("");
+		
+		$dst_file = $this->temp_dir . $uniqname;
+		
+		$objThumb = new gdthumb();
+		$ret = $objThumb->Main($src_file, $width, $height, $dst_file);
+		
+		if($ret[0] != 1) {
+			// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÉ½¼¨
+			print($ret[1]);
+			exit;
+		}
+		
+		return basename($ret[1]);
+	}
+		
+	// ¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¤¹¤ë¡£
+	function makeTempFile($keyname) {
+		$objErr = new SC_CheckError();
+		$cnt = 0;
+		if(!($_FILES[$keyname]['size'] > 0)) {
+			$objErr->arrErr[$keyname] = "¢¨ " . $this->disp_name[$cnt] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		} else {
+			foreach($this->keyname as $val) {
+				// °ìÃ×¤·¤¿¥­¡¼¤Î¥Õ¥¡¥¤¥ë¤Ë¾ðÊó¤òÊÝÂ¸¤¹¤ë¡£
+				if ($val == $keyname) {
+					// ³ÈÄ¥»Ò¥Á¥§¥Ã¥¯
+					$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array("FILE_EXT_CHECK"));
+					// ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¥Á¥§¥Ã¥¯
+					$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK"));
+					// ¥¨¥é¡¼¤¬¤Ê¤¤¾ì¹ç
+					if(!isset($objErr->arrErr[$keyname])) {
+						// ²èÁü¥Õ¥¡¥¤¥ë¤Î¾ì¹ç
+						if($this->image[$cnt]) {
+							$this->temp_file[$cnt] = $this->makeThumb($_FILES[$keyname]['tmp_name'], $this->width[$cnt], $this->height[$cnt]);
+						// ²èÁü¥Õ¥¡¥¤¥ë°Ê³°¤Î¾ì¹ç
+						} else {
+							// °ì°Õ¤Ê¥Õ¥¡¥¤¥ëÌ¾¤òºîÀ®¤¹¤ë¡£
+							$uniqname = date("mdHi") . "_" . uniqid("").".";
+							$this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);
+							$result  = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir. "/". $this->temp_file[$cnt]);
+							gfPrintLog($_FILES[$keyname]['name']." -> ".$this->temp_dir. "/". $this->temp_file[$cnt]);
+						}
+					}
+				}
+				$cnt++;
+			}
+		}
+		return $objErr->arrErr[$keyname];
+	}
+		
+	// ²èÁü¤òºï½ü¤¹¤ë¡£
+	function deleteFile($keyname) {
+		$objImage = new SC_Image($this->temp_dir);
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if ($val == $keyname) {
+				// °ì»þ¥Õ¥¡¥¤¥ë¤Î¾ì¹çºï½ü¤¹¤ë¡£
+				if($this->temp_file[$cnt] != "") {
+					$objImage->deleteImage($this->temp_file[$cnt], $this->save_dir);
+				}
+				$this->temp_file[$cnt] = "";
+				$this->save_file[$cnt] = "";
+			}
+			$cnt++;
+		}
+	}
+	
+	// °ì»þ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë¡£
+	function getTempFilePath($keyname) {
+		$cnt = 0;
+		$filepath = "";
+		foreach($this->keyname as $val) {
+			if ($val == $keyname) {
+				if($this->temp_file[$cnt] != "") {
+					$filepath = $this->temp_dir . "/" . $this->temp_file[$cnt];
+				}
+			}
+			$cnt++;
+		}
+		return $filepath;
+	}
+	
+	// °ì»þ¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Ü¤¹
+	function moveTempFile() {
+		$cnt = 0;
+		$objImage = new SC_Image($this->temp_dir);
+		
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+													
+				$objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir);
+				// ¤¹¤Ç¤ËÊÝÂ¸¥Õ¥¡¥¤¥ë¤¬¤¢¤Ã¤¿¾ì¹ç¤Ïºï½ü¤¹¤ë¡£
+				if($this->save_file[$cnt] != "" && !ereg("^sub/", $this->save_file[$cnt])) {
+					$objImage->deleteImage($this->save_file[$cnt], $this->save_dir);
+				}
+			}
+			$cnt++;
+		}
+	}
+	
+	// HIDDENÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
+	function getHiddenFileList() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+				$arrRet["temp_" . $val] = $this->temp_file[$cnt];
+			}
+			if($this->save_file[$cnt] != "") {
+				$arrRet["save_" . $val] = $this->save_file[$cnt];
+			}
+			$cnt++; 
+		}
+		return $arrRet;
+	}
+	
+	// HIDDEN¤ÇÁ÷¤é¤ì¤Æ¤­¤¿¥Õ¥¡¥¤¥ëÌ¾¤ò¼èÆÀ¤¹¤ë
+	function setHiddenFileList($arrPOST) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			$key = "temp_" . $val;
+			if($arrPOST[$key] != "") {
+				$this->temp_file[$cnt] = $arrPOST[$key];
+			}
+			$key = "save_" . $val;
+			if($arrPOST[$key] != "") {
+				$this->save_file[$cnt] = $arrPOST[$key];
+			}
+			$cnt++;
+		}
+	}
+	
+	// ¥Õ¥©¡¼¥à¤ËÅÏ¤¹ÍÑ¤Î¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÊÖ¤¹
+	function getFormFileList($temp_url, $save_url) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+				// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
+				if(ereg("/$", $temp_url)) {
+					$arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt];
+				} else {
+					$arrRet[$val]['filepath'] = $temp_url . "/" . $this->temp_file[$cnt];
+				}
+			} elseif ($this->save_file[$cnt] != "") {
+				// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
+				if(ereg("/$", $save_url)) {
+					$arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt];
+				} else {
+					$arrRet[$val]['filepath'] = $save_url . "/" . $this->save_file[$cnt];
+				}
+			}
+			if($arrRet[$val]['filepath'] != "") {
+				// ¥Õ¥¡¥¤¥ë²£Éý
+				$arrRet[$val]['width'] = $this->width[$cnt];
+				// ¥Õ¥¡¥¤¥ë½ÄÉý
+				$arrRet[$val]['height'] = $this->height[$cnt];
+				// É½¼¨Ì¾
+				$arrRet[$val]['disp_name'] = $this->disp_name[$cnt];
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// DBÊÝÂ¸ÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
+	function getDBFileList() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+				$arrRet[$val] = $this->temp_file[$cnt];
+			} else  {
+				$arrRet[$val] = $this->save_file[$cnt];
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// DB¤ÇÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë
+	function setDBFileList($arrVal) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($arrVal[$val] != "") {
+				$this->save_file[$cnt] = $arrVal[$val];
+			}
+			$cnt++; 
+		}
+	}
+	
+	// ²èÁü¤ò¥»¥Ã¥È¤¹¤ë
+	function setDBImageList($arrVal) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($arrVal[$val] != "" && $val == 'tv_products_image') {
+				$this->save_file[$cnt] = $arrVal[$val];
+			}
+			$cnt++; 
+		}
+	}
+	
+	// DB¾å¤Î¥Õ¥¡¥¤¥ë¤ÎÆâºï½üÍ×µá¤¬¤¢¤Ã¤¿¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë¡£ 
+	function deleteDBFile($arrVal) {
+		$objImage = new SC_Image($this->temp_dir);
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($arrVal[$val] != "") {
+				if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) {
+					$objImage->deleteImage($arrVal[$val], $this->save_dir);
+				}
+			}
+			$cnt++; 
+		}
+	}
+	
+	// É¬¿ÜÈ½Äê
+	function checkEXISTS($keyname = "") {
+		$cnt = 0;
+		$arrRet = array();
+		foreach($this->keyname as $val) {
+			if($val == $keyname || $keyname == "") {
+				// É¬¿Ü¤Ç¤¢¤ì¤Ð¥¨¥é¡¼¥Á¥§¥Ã¥¯
+				if ($this->necessary[$cnt] == true) {
+					if($this->save_file[$cnt] == "" && $this->temp_file[$cnt] == "") {
+						$arrRet[$val] = "¢¨ " . $this->disp_name[$cnt] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>";
+					}
+				}
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_CheckError.php
===================================================================
--- /temp/trunk/data/class/SC_CheckError.php	(revision 1328)
+++ /temp/trunk/data/class/SC_CheckError.php	(revision 1328)
@@ -0,0 +1,697 @@
+<?php
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] SC_CheckError
+ * [³µÍ×] ¥¨¥é¡¼¥Á¥§¥Ã¥¯¥¯¥é¥¹
+ *----------------------------------------------------------------------
+ */
+class SC_CheckError {
+	var $arrErr;
+	var $arrParam;
+	
+	// ¥Á¥§¥Ã¥¯ÂÐ¾Ý¤ÎÃÍ¤¬´Þ¤Þ¤ì¤ëÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£
+	function SC_CheckError($array = "") {
+		if($array != "") {
+			$this->arrParam = $array;
+		} else {
+			$this->arrParam = $_POST;
+		}
+
+	}
+	
+	function doFunc($value, $arrFunc) {
+		foreach ( $arrFunc as $key ) {
+			$this->$key($value);
+		}
+	}
+	
+	/* HTML¤Î¥¿¥°¤ò¥Á¥§¥Ã¥¯¤¹¤ë */
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý value[2] = µö²Ä¤¹¤ë¥¿¥°¤¬³ÊÇ¼¤µ¤ì¤¿ÇÛÎó
+	function HTML_TAG_CHECK($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		
+		// ´Þ¤Þ¤ì¤Æ¤¤¤ë¥¿¥°¤òÃê½Ð¤¹¤ë
+		preg_match_all("/<([\/]?[a-z]+)/", $this->arrParam[$value[1]], $arrTag);
+
+		foreach($arrTag[1] as $val) {
+			$find = false;
+			
+			foreach($value[2] as $tag) {
+				if(eregi("^" . $tag . "$", $val)) {
+					$find = true;
+				} else {
+				}
+			}
+			
+			if(!$find) {
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ëµö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¥¿¥°[" . strtoupper($val) . "]¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£<br />";
+				return;
+			}		
+		}		
+	}
+
+	/*¡¡É¬¿ÜÆþÎÏ¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function EXIST_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) == 0 ){					
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function SPTAB_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) != 0 && ereg("^[ ¡¡\t\r\n]+$", $this->arrParam[$value[1]])){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¡¢²þ¹Ô¤Î¤ß¤ÎÆþÎÏ¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function NO_SPTAB( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) != 0 && mb_ereg("[¡¡ \t\r\n]+", $this->arrParam[$value[1]])){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¡¢²þ¹Ô¤Ï´Þ¤á¤Ê¤¤¤Ç²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+	/* ¥¼¥í¤Ç³«»Ï¤µ¤ì¤Æ¤¤¤ë¿ôÃÍ¤ÎÈ½Äê */
+	function ZERO_START($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) != 0 && ereg("^[0]+[0-9]+$", $this->arrParam[$value[1]])){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë0¤Ç»Ï¤Þ¤ë¿ôÃÍ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br />";
+		}
+	}
+	
+	/*¡¡É¬¿ÜÁªÂò¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý 
+	function SELECT_CHECK( $value ) {			// ¥×¥ë¥À¥¦¥ó¤Ê¤É¤ÇÁªÂò¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) == 0 ){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+
+	/*¡¡Æ±°ìÀ­¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾1 value[1] = ¹àÌÜÌ¾2 value[2] = È½ÄêÂÐ¾ÝÊ¸»úÎó1  value[3] = È½ÄêÂÐ¾ÝÊ¸»úÎó2
+	function EQUAL_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if( $this->arrParam[$value[2]] != $this->arrParam[$value[3]]) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤È" . $value[1] . "¤¬°ìÃ×¤·¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡ÃÍ¤¬°Û¤Ê¤ë¤³¤È¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾1 value[1] = ¹àÌÜÌ¾2 value[2] = È½ÄêÂÐ¾ÝÊ¸»úÎó1  value[3] = È½ÄêÂÐ¾ÝÊ¸»úÎó2
+	function DIFFERENT_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if( $this->arrParam[$value[2]] == $this->arrParam[$value[3]]) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤È" . $value[1] . "¤Ï¡¢Æ±¤¸ÃÍ¤ò»ÈÍÑ¤Ç¤­¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡ÃÍ¤ÎÂç¤­¤µ¤òÈæ³Ó¤¹¤ë value[2] < value[3]¤Ç¤Ê¤±¤ì¤Ð¥¨¥é¡¼¡¡*/
+	// value[0] = ¹àÌÜÌ¾1 value[1] = ¹àÌÜÌ¾2 value[2] = È½ÄêÂÐ¾ÝÊ¸»úÎó1  value[3] = È½ÄêÂÐ¾ÝÊ¸»úÎó2
+	function GREATER_CHECK($value) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if($this->arrParam[$value[2]] != "" && $this->arrParam[$value[3]] != "" && ($this->arrParam[$value[2]] > $this->arrParam[$value[3]])) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤Ï" . $value[1] . "¤è¤êÂç¤­¤¤ÃÍ¤òÆþÎÏ¤Ç¤­¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	
+	/*¡¡ºÇÂçÊ¸»ú¿ôÀ©¸Â¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó  value[2] = ºÇÂçÊ¸»ú¿ô(È¾³Ñ¤âÁ´³Ñ¤â1Ê¸»ú¤È¤·¤Æ¿ô¤¨¤ë)
+	function MAX_LENGTH_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if( mb_strlen($this->arrParam[$value[1]]) > $value[2] ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï" . $value[2] . "»ú°Ê²¼¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+	
+	
+
+	/*¡¡ºÇ¾®Ê¸»ú¿ôÀ©¸Â¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó value[2] = ºÇ¾®Ê¸»ú¿ô(È¾³Ñ¤âÁ´³Ñ¤â1Ê¸»ú¤È¤·¤Æ¿ô¤¨¤ë)
+	function MIN_LENGTH_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ôÌ¤Ëþ¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		// Ê¸»ú¿ô¤Î¼èÆÀ		
+		if( mb_strlen($this->arrParam[$value[1]]) < $value[2] ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï" . $value[2] . "»ú°Ê¾å¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+	
+	/*¡¡ºÇÂçÊ¸»ú¿ôÀ©¸Â¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó  value[2] = ºÇÂç¿ô
+	function MAX_CHECK( $value ) {		// ÆþÎÏ¤¬ºÇÂç¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if($this->arrParam[$value[1]] > $value[2] ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï" . $value[2] . "°Ê²¼¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+	
+		
+	/*¡¡¿ô»ú¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function NUM_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬¿ô»ú°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[1]])) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+	
+		/*¡¡¾®¿ôÅÀ¤ò´Þ¤à¿ô»ú¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function NUM_POINT_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬¿ô»ú°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:digit:]]+[\.]?[[:digit:]]+$", $this->arrParam[$value[1]])) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+		
+	function ALPHA_CHECK($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:alpha:]]+$", $this->arrParam[$value[1]])) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤ÏÈ¾³Ñ±Ñ»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+	
+	/* ÅÅÏÃÈÖ¹æ¤ÎÈ½Äê ¡Ê¿ô»ú¥Á¥§¥Ã¥¯¤ÈÊ¸»ú¿ô¥Á¥§¥Ã¥¯¤ò¼Â»Ü¤¹¤ë¡£)
+		value[0] : ¹àÌÜÌ¾
+		value[1] : ÅÅÈÖ1¹àÌÜÌÜ
+		value[2] : ÅÅÈÖ2¹àÌÜÌÜ
+		value[3] : ÅÅÈÖ3¹àÌÜÌÜ
+		value[4] : Ê¸»ú¿ôÀ©¸Â
+	*/
+	function TEL_CHECK($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		
+		$cnt = 0;
+		
+		for($i = 1; $i <= 3; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) > 0) {
+				$cnt++;
+			}
+		}
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤òÈ½Äê(°ìÉô¤À¤±ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¾õÂÖ)
+		if($cnt > 0 && $cnt < 3) {
+			$this->arrErr[$value[1]] .= "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+					
+		for($i = 1; $i <= 3; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) > 0 && strlen($this->arrParam[$value[$i]]) > $value[4]) {
+				$this->arrErr[$value[1]] .= "¢¨ " . $value[0] . $i . "¤Ï" . $value[4] . "»ú°ÊÆâ¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+			} else if (strlen($this->arrParam[$value[$i]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[$i]])) {
+				$this->arrErr[$value[1]] .= "¢¨ " . $value[0] . $i . "¤Ï¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+			}
+		}
+	}
+	
+	/* ´ØÏ¢¹àÌÜ¤¬´°Á´¤ËËþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê 
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function FULL_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$blank = false;
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) <= 0) {
+				$blank = true;
+			}
+		}
+		
+		if($blank) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+		
+	/* ´ØÏ¢¹àÌÜ¤¬¤¹¤Ù¤ÆËþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê 
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function ALL_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$blank = false;
+		$input = false;
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) <= 0) {
+				$blank = true;
+			} else {
+				$input = true;
+			}
+		}
+		
+		if($blank && $input) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+		/* ´ØÏ¢¹àÌÜ¤¬¤É¤ì¤«°ì¤ÄËþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê 
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function ONE_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$input = false;
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) > 0) {
+				$input = true;
+			}
+		}
+		
+		if(!$input) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/* ¾å°Ì¤Î¹àÌÜ¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function TOP_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$blank = false;
+		$error = false;
+				
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) <= 0) {
+				$blank = true;
+			} else {
+				if($blank) {
+					$error = true;
+				}
+			}
+		}
+		
+		if($error) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤ÏÀèÆ¬¤Î¹àÌÜ¤«¤é½çÈÖ¤ËÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+	
+	/*¡¡¥«¥¿¥«¥Ê¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function KANA_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬¥«¥Ê°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && ! ereg("^(\xA5[\xA1-\xF6]|\xA1\xBC|\xA1\xA6|\xA1\xA1|\x20)+$", $this->arrParam[$value[1]] ) ) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¥«¥¿¥«¥Ê¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+
+	/*¡¡±Ñ¿ô»ú¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function ALNUM_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬±Ñ¿ô»ú°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		if( strlen($this->arrParam[$value[1]]) > 0 && ! EregI("^[[:alnum:]]+$", $this->arrParam[$value[1]] ) ) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï±Ñ¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+
+	/*¡¡É¬¿ÜÁªÂò¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function ZERO_CHECK( $value ) {				// ÆþÎÏÃÍ¤Ç0¤¬µö¤µ¤ì¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		
+		if($this->arrParam[$value[1]] == "0" ){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï1°Ê¾å¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+
+	/*¡¡·å¿ô¤ÎÈ½Äê¡¡¡ÊºÇ¾®ºÇÂç¡Ë*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó value[2] = ºÇ¾®·å¿ô value[3] = ºÇÂç·å¿ô
+	function NUM_RANGE_CHECK( $value ) {		// ÆþÎÏÊ¸»ú¤Î·å¿ôÈ½Äê¡¡¢ª¡¡ºÇ¾®·å¿ô¡ãÆþÎÏÊ¸»úÎó¡ãºÇÂç·å¿ô
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										 
+		// $this->arrParam[$value[0]] = mb_convert_kana($this->arrParam[$value[0]], "n");										
+		$count = strlen($this->arrParam[$value[1]]);
+		if( ( $count > 0 ) && $value[2] > $count || $value[3] < $count ) {  
+			$this->arrErr[$value[1]] =  "¢¨ $value[0]¤Ï$value[2]·å¡Á$value[3]·å¤ÇÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+
+	/*¡¡·å¿ô¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó value[2] = ·å¿ô 
+	function NUM_COUNT_CHECK( $value ) {		// ÆþÎÏÊ¸»ú¤Î·å¿ôÈ½Äê¡¡¢ª¡¡ÆþÎÏÊ¸»úÎó = ·å¿ô¡¡°Ê³°¤ÏNG¤Î¾ì¹ç
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		$count = strlen($this->arrParam[$value[1]]);
+		if(($count > 0) && $count != $value[2] ) {  
+			$this->arrErr[$value[1]] =  "¢¨ $value[0]¤Ï$value[2]·å¤ÇÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}				
+	
+	/*¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹·Á¼°¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý¥á¡¼¥ë¥¢¥É¥ì¥¹
+	function EMAIL_CHECK( $value ){				//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^[^@]+@[^.]+\..+", $this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î·Á¼°¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+		}
+	}		
+		
+	/*¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ë»ÈÍÑ¤Ç¤­¤ëÊ¸»ú¤ÎÈ½Äê¡¡*/
+	//  value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý¥á¡¼¥ë¥¢¥É¥ì¥¹
+	function EMAIL_CHAR_CHECK( $value ){				//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ë»ÈÍÑ¤¹¤ëÊ¸»ú¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("[a-zA-Z0-9_\.@\+\?-]+$",$this->arrParam[$value[1]]) ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë»ÈÍÑ¤¹¤ëÊ¸»ú¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}		
+	
+	/*¡¡URL·Á¼°¤ÎÈ½Äê¡¡*/
+	//  value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝURL
+	function URL_CHECK( $value ){				//¡¡URL¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Çhttp://¤¬¤¢¤Ã¤Æ¤âOK
+	 	if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+        if( strlen($this->arrParam[$value[1]]) > 0 && !ereg( "^https?://+($|[a-zA-Z0-9_~=&\?\.\/-])+$", $this->arrParam[$value[1]] ) ) {
+            $this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";     
+        }
+    }
+  	    
+	/*¡¡³ÈÄ¥»Ò¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý value[2]=array(³ÈÄ¥»Ò)	
+	function FILE_EXT_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if($_FILES[$value[1]]['name'] != "" ) {										
+			$errFlag = 1;
+			$array_ext = explode(".", $_FILES[$value[1]]['name']);
+			$ext = $array_ext[ count ( $array_ext ) - 1 ];
+			$ext = strtolower($ext);
+			
+			$strExt = "";
+			
+			foreach ( $value[2] as $checkExt ){
+				if ( $ext == $checkExt) {
+					$errFlag = 0;
+				}
+				
+				if($strExt == "") {
+					$strExt.= $checkExt;
+				} else {
+					$strExt.= "¡¦$checkExt";
+				}
+			}
+		}
+		if ($errFlag == 1) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Çµö²Ä¤µ¤ì¤Æ¤¤¤ë·Á¼°¤Ï¡¢" . $strExt . "¤Ç¤¹¡£<br />";
+		}
+	}
+	
+	/* ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë */
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý  value[2] = »ØÄê¥Ç¥£¥ì¥¯¥È¥ê
+	function FIND_FILE( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		
+		if($value[2] != "") {
+			$dir = $value[2];
+		} else {
+			$dir = IMAGE_SAVE_DIR;
+		}
+		
+		$path = $dir . "/" . $this->arrParam[$value[1]];
+		$path = ereg_replace("//", "/", $path);
+				
+		if($this->arrParam[$value[1]] != "" && !file_exists($path)){
+			$this->arrErr[$value[1]] = "¢¨ " . $path . "¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡¥Õ¥¡¥¤¥ë¤¬¾å¤²¤é¤ì¤¿¤«³ÎÇ§¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý  value[2] = »ØÄê¥µ¥¤¥º¡ÊKB)
+	function FILE_EXIST_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}											
+		if(!($_FILES[$value[1]]['size'] != "" && $_FILES[$value[1]]['size'] > 0)){
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤ò¥¢¥Ã¥×¥í¡¼¥É¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+	/*¡¡¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý  value[2] = »ØÄê¥µ¥¤¥º¡ÊKB)
+	function FILE_SIZE_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}											
+		if( $_FILES[$value[1]]['size'] > $value[2] *  1024 ){
+			$byte = "KB";
+			if( $value[2] >= 1000 ) {
+				$value[2] = $value[2] / 1000; 
+				$byte = "MB";
+			}
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤Ï" . $value[2] . $byte . "°Ê²¼¤Î¤â¤Î¤ò»ÈÍÑ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+
+	/*¡¡¥Õ¥¡¥¤¥ëÌ¾¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó
+	function FILE_NAME_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬±Ñ¿ô»ú,"_","-"°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($_FILES[$value[1]]['name']) > 0 && ! EregI("^[[:alnum:]_\.-]+$", $_FILES[$value[1]]['name']) ) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î¥Õ¥¡¥¤¥ëÌ¾¤ËÆüËÜ¸ì¤ä¥¹¥Ú¡¼¥¹¤Ï»ÈÍÑ¤·¤Ê¤¤¤Ç²¼¤µ¤¤¡£<br />";	
+		}
+	}
+	
+	//ÆüÉÕ¥Á¥§¥Ã¥¯
+	// value[0] = ¹àÌÜÌ¾
+	// value[1] = YYYY
+	// value[2] = MM
+	// value[3] = DD
+	function CHECK_DATE($value) {						
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		// ¾¯¤Ê¤¯¤È¤â¤É¤ì¤«°ì¤Ä¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¡£
+		if($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0) {
+			// Ç¯·îÆü¤Î¤É¤ì¤«¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+			if(!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0)) {
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+			} else if ( ! checkdate($this->arrParam[$value[2]], $this->arrParam[$value[3]], $this->arrParam[$value[1]])) {						
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />";
+			}
+		}
+	}
+	
+	//ÆüÉÕ¥Á¥§¥Ã¥¯
+	// value[0] = ¹àÌÜÌ¾
+	// value[1] = YYYY
+	// value[2] = MM
+	// value[3] = DD
+	// value[4] = HH
+	function CHECK_DATE2($value) {						
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		// ¾¯¤Ê¤¯¤È¤â¤É¤ì¤«°ì¤Ä¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¡£
+		if($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0 || $this->arrParam[$value[4]] > 0) {
+			// Ç¯·îÆü»þ¤Î¤É¤ì¤«¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+			if(!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]]) > 0)) {
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+			} else if ( ! checkdate($this->arrParam[$value[2]], $this->arrParam[$value[3]], $this->arrParam[$value[1]])) {						
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />";
+			}
+		}
+	}
+
+	/*-----------------------------------------------------------------*/
+	/*	CHECK_SET_TERM
+	/*	Ç¯·îÆü¤ËÊÌ¤ì¤¿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ­¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ­¤È´ü´Ö¤òÊÖ¤¹
+	/*¡¡°ú¿ô (³«»ÏÇ¯,³«»Ï·î,³«»ÏÆü,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü)
+	/*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
+	/*  		£±¡¥³«»ÏÇ¯·îÆü (YYYYMMDD 000000)
+	/*			£²¡¥½ªÎ»Ç¯·îÆü (YYYYMMDD 235959)
+	/*			£³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
+	/*-----------------------------------------------------------------*/
+	// value[0] = ¹àÌÜÌ¾1
+	// value[1] = ¹àÌÜÌ¾2
+	// value[2] = start_year
+	// value[3] = start_month
+	// value[4] = start_day
+	// value[5] = end_year
+	// value[6] = end_month
+	// value[7] = end_day
+	function CHECK_SET_TERM ($value) {
+
+		// ´ü´Ö»ØÄê
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[5]])) {
+			return;
+		}	
+		$error = 0;
+		if ( (strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0 || strlen($this->arrParam[$value[4]] ) > 0) && ! checkdate($this->arrParam[$value[3]], $this->arrParam[$value[4]], $this->arrParam[$value[2]]) ) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[5]]) > 0 || strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]] ) > 0) && ! checkdate($this->arrParam[$value[6]], $this->arrParam[$value[7]], $this->arrParam[$value[5]]) ) {
+			$this->arrErr[$value[5]] = "¢¨ " . $value[1] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]] ) > 0) &&  (strlen($this->arrParam[$value[5]]) > 0 || strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]] ) > 0) ){
+
+			$date1 = $this->arrParam[$value[2]] .sprintf("%02d", $this->arrParam[$value[3]]) .sprintf("%02d",$this->arrParam[$value[4]]) ."000000";
+			$date2 = $this->arrParam[$value[5]] .sprintf("%02d", $this->arrParam[$value[6]]) .sprintf("%02d",$this->arrParam[$value[7]]) ."235959";
+			
+			if (($this->arrErr[$value[2]] == "" && $this->arrErr[$value[5]] == "") && $date1 > $date2) {
+				$this->arrErr[$value[2]] = "¢¨ " .$value[0]. "¤È" .$value[1]. "¤Î´ü´Ö»ØÄê¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+			}
+		}
+	}
+	
+	/*-----------------------------------------------------------------*/
+	/*	CHECK_SET_TERM2
+	/*	Ç¯·îÆü»þ¤ËÊÌ¤ì¤¿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ­¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ­¤È´ü´Ö¤òÊÖ¤¹
+	/*¡¡°ú¿ô (³«»ÏÇ¯,³«»Ï·î,³«»ÏÆü,³«»Ï»þ´Ö,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü,½ªÎ»»þ´Ö)
+	/*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
+	/*  		£±¡¥³«»ÏÇ¯·îÆü (YYYYMMDDHH 0000)
+	/*			£²¡¥½ªÎ»Ç¯·îÆü (YYYYMMDDHH 0059)
+	/*			£³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
+	/*-----------------------------------------------------------------*/
+	// value[0] = ¹àÌÜÌ¾1
+	// value[1] = ¹àÌÜÌ¾2
+	// value[2] = start_year
+	// value[3] = start_month
+	// value[4] = start_day
+	// value[5] = start_hour
+	// value[6] = end_year
+	// value[7] = end_month
+	// value[8] = end_day
+	// value[9] = end_hour
+	function CHECK_SET_TERM2 ($value) {
+
+		// ´ü´Ö»ØÄê
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[6]])) {
+			return;
+		}	
+		$error = 0;
+		if ( (strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0 || strlen($this->arrParam[$value[4]] ) > 0 || strlen($this->arrParam[$value[5]]) > 0) && ! checkdate($this->arrParam[$value[3]], $this->arrParam[$value[4]], $this->arrParam[$value[2]]) ) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]]) > 0 || strlen($this->arrParam[$value[8]] ) > 0 || strlen($this->arrParam[$value[9]] ) > 0) && ! checkdate($this->arrParam[$value[7]], $this->arrParam[$value[8]], $this->arrParam[$value[6]]) ) {
+			$this->arrErr[$value[6]] = "¢¨ " . $value[1] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]] ) > 0 && strlen($this->arrParam[$value[5]] ) > 0) &&  (strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]]) > 0 || strlen($this->arrParam[$value[8]] ) > 0 || strlen($this->arrParam[$value[9]] ) > 0) ){
+
+			$date1 = $this->arrParam[$value[2]] .sprintf("%02d", $this->arrParam[$value[3]]) .sprintf("%02d",$this->arrParam[$value[4]]) .sprintf("%02d",$this->arrParam[$value[5]])."0000";
+			$date2 = $this->arrParam[$value[6]] .sprintf("%02d", $this->arrParam[$value[7]]) .sprintf("%02d",$this->arrParam[$value[8]]) .sprintf("%02d",$this->arrParam[$value[9]])."0000";
+			
+			if (($this->arrErr[$value[2]] == "" && $this->arrErr[$value[6]] == "") && $date1 > $date2) {
+				$this->arrErr[$value[2]] = "¢¨ " .$value[0]. "¤È" .$value[1]. "¤Î´ü´Ö»ØÄê¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+			}
+			if($date1 == $date2) {
+				$this->arrErr[$value[2]] = "¢¨ " .$value[0]. "¤È" .$value[1]. "¤Î´ü´Ö»ØÄê¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+			}
+			
+		}
+	}	
+	//¥Ç¥£¥ì¥¯¥È¥êÂ¸ºß¥Á¥§¥Ã¥¯
+	function DIR_CHECK ($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(!is_dir($this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ »ØÄê¤·¤¿" . $value[0] . "¤ÏÂ¸ºß¤·¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	//¥Ç¥£¥ì¥¯¥È¥êÂ¸ºß¥Á¥§¥Ã¥¯
+	function DOMAIN_CHECK ($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^\.[^.]+\..+", $this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î·Á¼°¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+		}
+	}	
+}
+?>
Index: /temp/trunk/data/class/SC_PageNavi.php
===================================================================
--- /temp/trunk/data/class/SC_PageNavi.php	(revision 1328)
+++ /temp/trunk/data/class/SC_PageNavi.php	(revision 1328)
@@ -0,0 +1,117 @@
+<?php
+/* ¢¨»ÈÍÑ¾ò·ï¢¨
+	¡¦form¥¿¥°¤Ë°Ê²¼¤òÄÉ²Ã¤¹¤ë¡£
+		<input type="hidden" name="pageno" value="<!--{$tpl_pageno}-->">
+	¡¦¥½¡¼¥¹¤ÎºÇ½é¤Ë°Ê²¼¤òµ­½Ò¤¹¤ë¡£
+		$objPage->tpl_pageno = $_POST['pageno'];
+	¡¦$func_name¤Ë»ØÄê¤¹¤ëJavaScript¤ÎÎã
+		// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+		function fnNaviPage(pageno) {
+			document.form1['pageno'].value = pageno;
+			document.form1.submit();
+		}		
+*/
+class SC_PageNavi {
+	var $now_page;		// ¸½ºß¤Î¥Ú¡¼¥¸ÈÖ¹æ
+	var $max_page;		// ºÇ½ª¤Î¥Ú¡¼¥¸ÈÖ¹æ
+	var $start_row;		// ³«»Ï¥ì¥³¡¼¥É
+	var $strnavi;		// ¥Ú¡¼¥¸Á÷¤êÊ¸»úÎó
+	var $arrPagenavi = array();	// ¥Ú¡¼¥¸
+
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX) {
+		$this->arrPagenavi['mode'] = 'search';
+
+		//¸½ºß¥Ú¡¼¥¸($now_page)¤¬Àµ¤·¤¤¿ôÃÍ¤Ç¤Ê¤¤¾ì¹ç
+		if (!eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || $now_page == "") {
+			$this->now_page = 1;
+		} else {
+			$this->now_page = $now_page;
+		}
+		$this->arrPagenavi['now_page'] = $this->now_page;
+
+		// ºÇ½ª¥Ú¡¼¥¸¤Î·×»»
+		$this->max_page = ceil($all_row/$page_row);
+
+		// ºÇ½ª¥Ú¡¼¥¸¤è¤ê¤â¸½ºß¥Ú¡¼¥¸¤¬Âç¤­¤¤¾ì¹ç¤Ï¡¢ºÇ½é¤ËÌá¤¹¡£
+		if($this->max_page < $this->now_page) {
+			$this->now_page = 1;
+		}
+
+		$this->start_row = ($this->now_page - 1) * $page_row;
+	
+		// ³«»Ï¹Ô¤¬ÉÔÀµ¤Ê¾ì¹ç
+		if (!($this->start_row < $all_row && $this->start_row >= 0)) {
+			$this->start_row = 0;
+		}
+
+		if($all_row > 1) {
+
+			//¡ÖÁ°¤Ø¡×¡Ö¼¡¤Ø¡×¤ÎÀßÄê
+			if ($this->now_page > 1) {
+				$before="<a href=\"". $_SERVER['PHP_SELF']. "\" onclick=\"$func_name('" .(($this->now_page) - 1). "'); return false;\">¢«Á°¤Ø</a> ";
+				$this->arrPagenavi['before'] = ($this->now_page) - 1;
+			}else{
+				$this->arrPagenavi['before'] = $this->now_page;
+			}
+			
+			if ($this->now_page < $this->max_page) {
+				$next="<a href=\"". $_SERVER['PHP_SELF']. "\" onclick=\"$func_name('" .(($this->now_page) + 1) ."'); return false;\">¼¡¤Ø¢ª</a> ";
+				$this->arrPagenavi['next'] = ($this->now_page) + 1;
+			}else{
+				$this->arrPagenavi['next'] = $this->now_page;
+			}
+			
+			// É½¼¨¤¹¤ëºÇÂç¥Ê¥Ó¿ô¤ò·è¤á¤ë¡£
+			if($navi_max == "" || $navi_max > $this->max_page) {
+				// À©¸Â¥Ê¥Ó¿ô¤Î»ØÄê¤¬¤Ê¤¤¡£¥Ú¡¼¥¸ºÇÂç¿ô¤¬À©¸Â¥Ê¥Ó¿ô¤è¤ê¾¯¤Ê¤¤¡£
+				$disp_max = $this->max_page;
+			} else {
+				// ¸½ºß¤Î¥Ú¡¼¥¸¡ÜÀ©¸Â¥Ê¥Ó¿ô¤¬É½¼¨¤µ¤ì¤ë¡£
+				$disp_max = $this->now_page + $navi_max - 1;
+				// ¥Ú¡¼¥¸ºÇÂç¿ô¤òÄ¶¤¨¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥Ú¡¼¥¸ºÇÂç¿ô¤Ë¹ç¤ï¤»¤ë¡£
+				if($disp_max > $this->max_page) {
+					$disp_max = $this->max_page;
+				}
+			}
+
+			// É½¼¨¤¹¤ëºÇ¾®¥Ê¥Ó¿ô¤ò·è¤á¤ë¡£
+			if($navi_max == "" || $navi_max > $this->now_page) {
+				// À©¸Â¥Ê¥Ó¿ô¤Î»ØÄê¤¬¤Ê¤¤¡£¸½ºß¥Ú¡¼¥¸ÈÖ¹æ¤¬À©¸Â¥Ê¥Ó¿ô¤è¤ê¾¯¤Ê¤¤¡£
+				$disp_min = 1;
+			} else {
+				// ¸½ºß¤Î¥Ú¡¼¥¸-À©¸Â¥Ê¥Ó¿ô¤¬É½¼¨¤µ¤ì¤ë¡£
+				$disp_min = $this->now_page - $navi_max + 1;
+			}
+			
+			$this->arrPagenavi['arrPageno'] = array();
+			for ($i=$disp_min; $i <= $disp_max; $i++) {
+				if($i != $disp_max) {
+					$sep = " | ";
+				} else {
+					$sep = "";
+				}
+				
+				if ($i == $this->now_page) {
+					$page_number .= "<strong>$i</strong> ";
+				} else {
+					$page_number.="<a href=\"". $_SERVER['PHP_SELF']. "\" onclick=\"$func_name('$i'); return false;\">$i</a> ";
+				}
+				
+				$page_number.=$sep;
+				
+				$this->arrPagenavi['arrPageno'][$i] = $i;
+			}
+			
+			if ($before || $next) {
+				$this->strnavi = $before .$page_number .$next;
+			}
+		}else{
+			$this->arrPagenavi['arrPageno'][0] = 1;
+			$this->arrPagenavi['before'] = 1;
+			$this->arrPagenavi['next'] = 1;
+		}
+	}
+}
+
+?>
Index: /temp/trunk/data/class/SC_JpGraph.php
===================================================================
--- /temp/trunk/data/class/SC_JpGraph.php	(revision 1328)
+++ /temp/trunk/data/class/SC_JpGraph.php	(revision 1328)
@@ -0,0 +1,323 @@
+<?php
+
+//¥°¥é¥ÕºîÀ®
+include_once ("jpgraph/jpgraph.php");
+
+class SC_JpGraph {
+
+	var $rgb_table;		// ¿§¤ÎRGB
+	var $rgb_name;		// ¿§¤ÎÌ¾Á°
+	var $max_cnt;		// ¥°¥é¥ÕÍ×ÁÇ¤ÎºÇÂç¿ô
+	var $graph_w;		// Éý
+	var $graph_h;		// ¹â¤µ
+	var $margin;		// (array)Í¾Çò¤ò¤É¤ì¤À¤±¤È¤ë¤« º¸¡¢±¦¡¢¾å¡¢²¼
+
+	var $objGraph;		// ¥°¥é¥Õ¥ª¥Ö¥¸¥§¥¯¥È
+	
+	function SC_JpGraph($graph_w = 800, $graph_h = 450){
+		
+		$this->max_cnt = 10;						// ºÇÂçÍ×ÁÇ¿ô¡¡¤³¤ì°Ê¾å¤ÎÃÍ¤òÅÏ¤µ¤ì¤Æ¤âÌµ»ë¤·¤Þ¤¹
+
+		// ¿§¥Æ¡¼¥Ö¥ë¡ÊÄÉ²Ã¤¹¤ë¤È¤­¤Ï¥Þ¥Ë¥å¥¢¥ë¤Î¿§¸«ËÜ¤ò¤ß¤Æ²¼¤µ¤¤¡Ë
+		$this->rgb_table = array(   "goldenrod1"
+									,"olivedrab2"
+									,"steelblue2"
+									,"mistyrose"
+									,"azure2"
+									,"navy"
+									,"plum2"
+									,"yellow3"
+									,"lightcoral"
+									,"mediumpurple"
+								);
+
+		$this->graph_w = $graph_w;
+		$this->graph_h = $graph_h;
+		$this->margin[0] = 40;			// Í¾Çòº¸ ½é´üÃÍ
+		$this->margin[1] = 30;			// Í¾Çò±¦ ½é´üÃÍ
+		$this->margin[2] = 30;			// Í¾Çò¾å ½é´üÃÍ
+		$this->margin[3] = 40;			// Í¾Çò²¼ ½é´üÃÍ
+	}
+
+	// °ú¿ô$file_path¤¬¤¢¤ì¤Ð¡¢¤½¤Î¾ì½ê¤Ø¥Õ¥¡¥¤¥ë½ÐÎÏ
+	function getGraph($file_path = ""){
+		
+		$this->setMainProperties();
+		
+		if ( $file_path ){
+			// ²èÁü¤ò¥Õ¥¡¥¤¥ë¤Ç½ÐÎÏ¤¹¤ë
+			$this->objGraph->Stroke( $file_path );
+		} else {
+			//web¥Ú¡¼¥¸ÍÑ²èÁü½ÐÎÏ
+			$this->objGraph->SetFrame('false', array(255,255,255));
+			$this->objGraph->Stroke();
+		}
+	}
+	
+	function setMainProperties(){
+		//½ÐÎÏÁ°¤Ë¼Â¹Ô¤¹¤ë´Ø¿ô
+		$this->objGraph->legend->SetFont(FF_GOTHIC, FS_NORMAL,8);
+		$this->objGraph->title->SetFont(FF_GOTHIC , FS_NORMAL,12);
+		$this->objGraph->img->SetMargin($this->margin[0],$this->margin[1],$this->margin[2],$this->margin[3]);
+	}
+	
+	function setTitle($title) {
+		$this->objGraph->title->Set($title);
+	}
+	
+	function setWidth($graph_w){
+		// ½ÐÎÏ²èÁü¤ÎÉý
+		$this->graph_w = $graph_w;
+	}
+	
+	function setHeight($graph_h){					
+		// ½ÐÎÏ²èÁü¤Î¹â¤µ
+		$this->graph_h = $graph_h;					
+	}
+
+	function setMargin($left, $right, $top, $bottom){
+		//¡¡¥°¥é¥Õ¥¨¥ê¥¢¤Î¾å²¼º¸±¦¤ÎÍ¾ÇòÀßÄê
+		$this->margin[0] = $left;	// Í¾Çòº¸
+		$this->margin[1] = $right;	// Í¾Çò±¦
+		$this->margin[2] = $top;	// Í¾Çò¾å
+		$this->margin[3] = $bottom;	// Í¾Çò²¼
+	}
+}
+
+class SC_JpGraph_Pie extends SC_JpGraph{
+
+	var $graph_size;			// ±ß¤Î¥µ¥¤¥º
+	var $graph_center;
+	var $cnt_min;				// ÃÍ¤ÎºÇ¾®µ¬½à¿ôÃÍ¡Ê¤³¤ì¤è¤ê¾®¤µ¤¤¤È¡Ö¤½¤ÎÂ¾¡×¤Ë¤¤¤ì¤é¤ì¤ë¡Ë
+	
+	function SC_JpGraph_Pie($graph_w = "", $graph_h = "", $graph_size = 100 ){
+		include_once ("jpgraph/jpgraph_pie.php");
+		include_once ("jpgraph/jpgraph_pie3d.php");
+		parent::SC_JpGraph();
+		if ( $graph_w ) $this->setWidth($graph_w);
+		if ( $graph_h ) $this->setHeight($graph_h);
+		$this->objGraph = new PieGraph( $this->graph_w, $this->graph_h, "auto");
+		
+		$this->graph_size = $graph_size;
+		$this->graph_center = 0.35;
+		$this->cnt_min = 1.5;		// ÃÍ¤ÎºÇ¾®µ¬½à¿ôÃÍ
+	}
+	
+	// setData¤ÎÁ°¤Ë¸Æ¤Ó½Ð¤¹
+	function setPieTitle($title) {
+		$this->title = $title;
+	}
+	
+	function setData($data){
+		// Ï¢ÁÛÇÛÎó¤òÅÏ¤·¤Þ¤¹ key=ËÞÎã val=ÃÍ¡ÊÃ±°Ì¤Ï%¤òÀ°¿ô¤ÇÉ½¤·¤¿¿ô¡Ë
+
+		if ( count($data) < $this->max_cnt ) $this->max_cnt = count($data);
+		$i = 0;
+		$otherVal = 0;
+		foreach ( $data as $key=>$val ) {
+			if ( $val <= $this->cnt_min ) {
+				// ºÇ¾®µ¬½à¿ôÃÍ°Ê²¼¤Ï¡Ö¤½¤ÎÂ¾¡×¤Ë¤Ê¤ë
+				$otherVal += $val;
+			} else {
+				$arrayHanrei[] = $key."     ";
+				$cnt[] = (double) $val;
+			}
+			$i++;
+			if ($i<$max_cnt) break;
+		}
+		// ºÇ¾®µ¬½à¿ôÃÍ°Ê²¼¤¬¹ç¤Ã¤¿¾ì¹ç¤ÏËöÈø¤Ë¡Ö¤½¤ÎÂ¾¡×¤ò¤Ä¤¯¤ë
+		if ( $otherVal > 0 ) {
+			$arrayHanrei[] = "¤½¤ÎÂ¾     ";
+			$cnt[] = (double) $otherVal;
+		}
+
+		//É¸½àÀßÄê¤Ç¤ÏÈ¿»þ·×²ó¤ê¤Î±ß¥°¥é¥Õ¤Ê¤Î¤Ç¡¢µÕ½ç¤Ë¤¹¤ë
+		$p1 = new PiePlot3d( array_reverse($cnt) );		// ±ßÍ×ÁÇ¤òÄÉ²Ã
+		$p1->SetSliceColors( array_reverse( array_slice($this->rgb_table, 0, $this->max_cnt) ) );
+		$p1->SetStartAngle(90); 
+				
+		// ËÞÎã
+		$this->objGraph->legend->SetLayout(LEGEND_VERT);
+		$this->objGraph->legend->Pos(0.013,0.05,"right","top");		// ËÞÎã¤Î°ÌÃÖ
+		
+		// ÆÃÄê¤ÎÊ¸»úÎó¤Ç¥é¥Ù¥ë¤¬Ê¸»ú²½¤±¤¹¤ë¤³¤È¤¬¤¢¤ë¤Î¤ÇÂÐºö
+		if(is_array($arrayHanrei)) {
+			foreach($arrayHanrei as $key => $val) {
+				// Ê¸»ú¥³¡¼¥É¤ÎºÆÊÑ´¹
+				$arrData[$key] = mb_convert_encoding($val, "EUC-JP", "EUC-JP");
+			}
+		}
+		
+		$p1->SetLegends( array_reverse($arrData) );				// ËÞÎã¤âµÕ¸þ¤­¤Ë
+						
+		$this->objGraph->legend->SetReverse();
+				
+		// ¥°¥é¥Õ¤Î¤½¤ÎÂ¾Â°À­
+		$p1->SetEdge("navy");					// ¥¨¥Ã¥¸¤Î¿§¡£
+		$p1->value->HideZero();
+		$p1->SetLabelMargin(5);					// ¥é¥Ù¥ë°ÌÃÖ¡£±ß¤Î¥¨¥Ã¥¸¤«¤é¤Îµ÷Î¥¡£¥Þ¥¤¥Ê¥¹¤ÏÃæ¿´Â¦¤Ë¡£
+		$p1->SetCenter($this->graph_center);
+		$p1->SetSize($this->graph_size);
+		if($this->title != "") {
+			$p1->title->SetFont(FF_GOTHIC, FS_NORMAL,8);
+			$p1->title->SetColor("gray4");
+			$p1->title->Set($this->title);
+			$p1->title->SetMargin(30);	
+		}
+		// ÃÍ¤ò¥»¥Ã¥È
+		$this->objGraph->Add($p1);
+	}
+}
+
+class SC_JpGraph_Bar extends SC_JpGraph{
+
+	function SC_JpGraph_Bar ($graph_w = "", $graph_h = ""){
+		include_once ("jpgraph/jpgraph_bar.php");
+		parent::SC_JpGraph();
+		if ( $graph_w ) $this->setWidth($graph_w);
+		if ( $graph_h ) $this->setHeight($graph_h);	
+		$this->objGraph = new Graph( $this->graph_w, $this->graph_h, "auto");
+		$this->objGraph->SetScale("textlin");
+		$this->objGraph->SetMarginColor('white');
+		$this->objGraph->yaxis->title->SetFont(FF_GOTHIC, FS_NORMAL,8);		// ½Ä¼´¥é¥Ù¥ë¤Î¥Õ¥©¥ó¥È
+		$this->objGraph->xaxis->title->SetFont(FF_GOTHIC, FS_NORMAL,8);		// ²£¼´¥é¥Ù¥ë¤Î¥Õ¥©¥ó¥È
+		$this->objGraph->xaxis->SetFont(FF_GOTHIC);
+		$this->objGraph->yaxis->SetTitleMargin(35);
+		$this->objGraph->legend->Pos(0.013,0.05,"right","top");				// ËÞÎã¤Î°ÌÃÖ
+	}
+	
+	// ²£¼´¤Î¥¿¥¤¥È¥ë
+	function setXTitle($title) {
+		$this->objGraph->xaxis->SetTitleMargin(10);
+		$this->objGraph->xaxis->title->Set($title);
+		$this->objGraph->xaxis->title->SetColor("gray4");
+	}
+	
+	// ½Ä¼´¤Î¥¿¥¤¥È¥ë
+	function setYTitle($title) {
+		$this->objGraph->subtitle->SetFont(FF_GOTHIC, FS_NORMAL,8);
+		$this->objGraph->subtitle->SetColor("gray4");
+		$this->objGraph->subtitle->Set($title);
+		$this->objGraph->subtitle->SetAlign('left');
+	}
+	
+	function setData($data){
+		
+		if ( count($data) < $this->max_cnt ) $this->max_cnt = count($data);	// ºÇÂçÍ×ÁÇ¿ô¤ÎÀßÄê
+		$cnt = 0;
+		$otherVal = 0;
+		
+		foreach ( $data as $key=>$val ) {
+			$arrLabel[] = $key;
+			
+			// ¥°¥é¥ÕËè¤Ë¿§´¹¤¨¤ò¹Ô¤¦¤¿¤á¤ËÇÛÎó¤ò½Å¤Í¤ÆÉÁ²è¤µ¤»¤ë¡£
+			for($i = 0; $i < $this->max_cnt; $i++) {
+				if($cnt == $i) {
+					$arrVal[$i] = (double)$val;
+				} else {
+					$arrVal[$i] = 0;
+				}
+			}
+					
+			$bar[$cnt] = new BarPlot($arrVal);						
+			
+			//$bar[$i]->SetLegend( $key."     " );		// ÀâÌÀÉ½¼¨
+					
+			$bar[$cnt]->SetFillColor( $this->rgb_table[$cnt] );	// ¿§ÀßÄê
+			$bar[$cnt]->value->Show();
+			$bar[$cnt]->value->SetFont(FF_GOTHIC, FS_NORMAL,8);
+			$bar[$cnt]->value->SetFormat('%01.0f');
+			
+			$bar[$cnt]->SetShadow("black", 1, 1); //±Æ¿§,±Æ¥µ¥¤¥º(h),±Æ¥µ¥¤¥º(y)
+			$bar[$cnt]->SetAlign("center");
+			
+			$bar[$cnt]->SetWidth(0.75); 
+			
+			$cnt++;
+			if ($cnt > $this->max_cnt) break;
+		}
+		
+		
+		for($i = 0; $i < $this->max_cnt; $i++) {
+			$this->objGraph->Add($bar[$i]);			
+		}
+			
+		$this->objGraph->xaxis->SetTickLabels($arrLabel);	
+	}	
+}
+
+class SC_JpGraph_Line extends SC_JpGraph{
+	
+	function SC_JpGraph_Line ($graph_w = "", $graph_h = ""){
+		include ("jpgraph/jpgraph_line.php");
+		parent::SC_JpGraph();
+		if ( $graph_w ) $this->setWidth($graph_w);
+		if ( $graph_h ) $this->setHeight($graph_h);	
+		$this->objGraph = new Graph( $this->graph_w, $this->graph_h, "auto" );
+		$this->objGraph->SetMarginColor('white');
+		$this->objGraph->SetScale("textlin");
+		$this->objGraph->yaxis->SetTitleMargin(35);									// ½Ä¼´ ¸«½Ð¤·¤Þ¤Ç¤ÎÍ¾Çò
+		$this->objGraph->yaxis->title->SetFont(FF_GOTHIC, FS_NORMAL,8);				// ½Ä¼´ ¸«½Ð¤·¤Î¥Õ¥©¥ó¥È
+		$this->objGraph->xaxis->title->SetFont(FF_GOTHIC, FS_NORMAL,8);				// ²£¼´ ¸«½Ð¤·¤Î¥Õ¥©¥ó¥È
+		$this->objGraph->xaxis->SetFont(FF_GOTHIC); 								// ²£¼´ ÃÍ¤Î¥Õ¥©¥ó¥È
+	}
+	
+	// ²£¼´¥é¥Ù¥ë¤ò²¿¸Ä¤Ë°ì²óÉ½¼¨¤µ¤»¤ë¤«
+	function setXLabelInterval($interval) {
+		$this->objGraph->xaxis->SetTextLabelInterval($interval);					
+	}
+	
+	// ²£¼´¥é¥Ù¥ë¤ÎÉ½¼¨³ÑÅÙ¡ÊÆüËÜ¸ìÉÔ²Ä¡Ë
+ 	function setXLabelAngle($angle) {
+		$this->objGraph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
+		$this->objGraph->xaxis->SetLabelAngle($angle);
+ 	}
+	
+	// ²£¼´¤Î¥¿¥¤¥È¥ë
+	function setXTitle($title) {
+		$this->objGraph->xaxis->SetTitleMargin(25);
+		$this->objGraph->xaxis->title->Set($title);
+		$this->objGraph->xaxis->title->SetColor("gray4");
+	}
+	
+	// ½Ä¼´¤Î¥¿¥¤¥È¥ë
+	function setYTitle($title) {
+		$this->objGraph->subtitle->SetFont(FF_GOTHIC, FS_NORMAL,8);
+		$this->objGraph->subtitle->SetColor("gray4");
+		$this->objGraph->subtitle->Set($title);
+		$this->objGraph->subtitle->SetAlign('left');
+	}
+	
+	// ²£¼´¥é¥Ù¥ë¤ÎÉ½¼¨¥¿¥¤¥×¡ÊÆüËÜ¸ìÉÔ²Ä¡Ë
+ 	function setXLabelBold($ttf, $type) {
+		$this->objGraph->xaxis->SetFont($ttf, $type, 8);
+ 	}
+	
+	function setData($data){
+
+		if ( count($data) < $this->max_cnt ) $this->max_cnt = count($data);	//ºÇÂçÍ×ÁÇ¿ô¤ÎÀßÄê
+		
+		$i =0;
+		foreach ( $data as $key=>$val ) {
+			$arrayHanrei[] = $key;
+			$cnt[] = (double) $val;
+			$i++;
+			if ($i < $max_cnt) break;
+		}
+		$bar = new linePlot( $cnt );
+		$bar->value->Show();
+		$bar->value->SetFont(FF_GOTHIC, FS_NORMAL,8);			// ÃÍ¤Î¥Õ¥©¥ó¥È
+		$bar->value->SetFormat('%01.0f');
+		$bar->SetStyle('solid'); 
+		$bar->SetColor("navy");	 								// Àþ¤Î¿§
+		$bar->SetCenter();
+		$bar->mark->SetType(MARK_FILLEDCIRCLE);					// ¥Ý¥¤¥ó¥È¤Î·Á
+		$bar->mark->SetFillColor("red");						// ¥Ý¥¤¥ó¥È¤Î¿§
+		$bar->mark->SetWidth(2);								// ¥Ý¥¤¥ó¥È¤Î¥µ¥¤¥º
+		
+		$this->objGraph->Add($bar);		
+		$this->objGraph->xaxis->SetTickLabels($arrayHanrei);
+	}
+	
+}
+?>
Index: /temp/trunk/data/class/SC_CartSession.php
===================================================================
--- /temp/trunk/data/class/SC_CartSession.php	(revision 1328)
+++ /temp/trunk/data/class/SC_CartSession.php	(revision 1328)
@@ -0,0 +1,281 @@
+<?php
+/* ¥«¡¼¥È¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_CartSession {
+	var $key;
+	var $key_tmp;	// ¥æ¥Ë¡¼¥¯ID¤ò»ØÄê¤¹¤ë¡£
+	
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_CartSession($key = 'cart') {
+		sfDomainSessionStart();
+		$this->key = $key;
+	}
+	
+	// ¾¦ÉÊ¹ØÆþ½èÍýÃæ¤Î¥í¥Ã¥¯
+	function saveCurrentCart($key_tmp) {
+		$this->key_tmp = "savecart_" . $key_tmp;
+		// ¤¹¤Ç¤Ë¾ðÊó¤¬¤Ê¤±¤ì¤Ð¸½¾õ¤Î¥«¡¼¥È¾ðÊó¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		if(count($_SESSION[$this->key_tmp]) == 0) {
+			$_SESSION[$this->key_tmp] = $_SESSION[$this->key];
+		}
+		// 1À¤Âå¸Å¤¤¥³¥Ô¡¼¾ðÊó¤Ï¡¢ºï½ü¤·¤Æ¤ª¤¯
+		foreach($_SESSION as $key => $val) {
+			if($key != $this->key_tmp && ereg("^savecart_", $key)) {
+				unset($_SESSION[$key]);
+			}
+		}
+	}
+
+	// ¾¦ÉÊ¹ØÆþÃæ¤ÎÊÑ¹¹¤¬¤¢¤Ã¤¿¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	function getCancelPurchase() {
+		$ret = $_SESSION[$this->key]['cancel_purchase'];
+		$_SESSION[$this->key]['cancel_purchase'] = false;
+		return $ret;
+	}
+	
+	// ¹ØÆþ½èÍýÃæ¤Ë¾¦ÉÊ¤ËÊÑ¹¹¤¬¤Ê¤«¤Ã¤¿¤«¤òÈ½Äê
+	function checkChangeCart() {
+		$change = false;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if ($_SESSION[$this->key][$i]['quantity'] != $_SESSION[$this->key_tmp][$i]['quantity']) {
+				$change = true;
+				break;
+			}
+			if ($_SESSION[$this->key][$i]['id'] != $_SESSION[$this->key_tmp][$i]['id']) {
+				$change = true;
+				break;
+			}
+		}
+		if ($change) {
+			// °ì»þ¥«¡¼¥È¤Î¥¯¥ê¥¢
+			unset($_SESSION[$this->key_tmp]);
+			$_SESSION[$this->key]['cancel_purchase'] = true;
+		} else {
+			$_SESSION[$this->key]['cancel_purchase'] = false;
+		}
+		return $_SESSION[$this->key]['cancel_purchase'];
+	}
+	
+	// ¼¡¤Ë³ä¤êÅö¤Æ¤ë¥«¡¼¥È¤ÎID¤ò¼èÆÀ¤¹¤ë
+	function getNextCartID() {
+		$max = count($_SESSION[$this->key]);
+		for($i = 0; $i < $max; $i++) {
+			$arrRet[] = $_SESSION[$this->key][$i]['cart_no'];
+		}
+		return (max($arrRet) + 1);		
+	}
+			
+	// ¾¦ÉÊ¤´¤È¤Î¹ç·×²Á³Ê
+	function getProductTotal($arrInfo, $id) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['id'] == $id) {
+				// ÀÇ¹þ¤ß¹ç·×
+				$price = $_SESSION[$this->key][$i]['price'];
+				$quantity = $_SESSION[$this->key][$i]['quantity'];
+				$pre_tax = sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+				$total = $pre_tax * $quantity;
+				return $total;
+			}
+		}
+		return 0;
+	}
+	
+	// ÃÍ¤Î¥»¥Ã¥È
+	function setProductValue($id, $key, $val) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['id'] == $id) {
+				$_SESSION[$this->key][$i][$key] = $val;
+			}
+		}
+	}
+		
+	// ¥«¡¼¥ÈÆâ¾¦ÉÊ¤ÎºÇÂçÍ×ÁÇÈÖ¹æ¤ò¼èÆÀ¤¹¤ë¡£
+	function getMax() {
+		$cnt = 0;
+		$pos = 0;
+		$max = 0;
+		if (count($_SESSION[$this->key]) > 0){
+			foreach($_SESSION[$this->key] as $key => $val) {
+				if (is_numeric($key)) {
+					if($max < $key) {
+						$max = $key;
+					}
+				}
+			}
+		}
+		return ($max);
+	}
+	
+	// ¥«¡¼¥ÈÆâ¾¦ÉÊ¿ô¤Î¹ç·×
+	function getTotalQuantity() {
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$total+= $_SESSION[$this->key][$i]['quantity'];
+		}
+		return $total;
+	}
+	
+
+	// Á´¾¦ÉÊ¤Î¹ç·×²Á³Ê
+	function getAllProductsTotal($arrInfo) {
+		// ÀÇ¹þ¤ß¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$price = $_SESSION[$this->key][$i]['price'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$pre_tax = sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+			$total+= ($pre_tax * $quantity);
+		}
+		return $total;
+	}
+
+	// Á´¾¦ÉÊ¤Î¹ç·×ÀÇ¶â
+	function getAllProductsTax($arrInfo) {
+		// ÀÇ¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$price = $_SESSION[$this->key][$i]['price'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$tax = sfTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+			$total+= ($tax * $quantity);
+		}
+		return $total;
+	}
+	
+	// Á´¾¦ÉÊ¤Î¹ç·×¥Ý¥¤¥ó¥È
+	function getAllProductsPoint() {
+		// ¥Ý¥¤¥ó¥È¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$price = $_SESSION[$this->key][$i]['price'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$point_rate = $_SESSION[$this->key][$i]['point_rate'];
+			$id = $_SESSION[$this->key][$i]['id'][0];
+			$point = sfPrePoint($price, $point_rate, POINT_RULE, $id);
+			$total+= ($point * $quantity);
+		}
+		return $total;
+	}
+	
+	// ¥«¡¼¥È¤Ø¤Î¾¦ÉÊÄÉ²Ã
+	function addProduct($id, $quantity) {
+		$find = false;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			
+			if($_SESSION[$this->key][$i]['id'] == $id) {
+				$val = $_SESSION[$this->key][$i]['quantity'] + $quantity;
+				if(strlen($val) <= INT_LEN) {
+					$_SESSION[$this->key][$i]['quantity']+= $quantity;
+				}
+				$find = true;
+			}
+		}
+		if(!$find) {
+			$_SESSION[$this->key][$max+1]['id'] = $id;
+			$_SESSION[$this->key][$max+1]['quantity'] = $quantity;
+			$_SESSION[$this->key][$max+1]['cart_no'] = $this->getNextCartID();
+		}
+	}
+	
+	// ¥­¡¼¤¬°ìÃ×¤·¤¿¾¦ÉÊ¤Îºï½ü
+	function delProductKey($keyname, $val) {
+		$max = count($_SESSION[$this->key]);
+		for($i = 0; $i < $max; $i++) {
+			if($_SESSION[$this->key][$i][$keyname] == $val) {
+				unset($_SESSION[$this->key][$i]);
+			}
+		}
+	}
+	
+	function setValue($key, $val) {
+		$_SESSION[$this->key][$key] = $val;
+	}
+	
+	function getValue($key) {
+		return $_SESSION[$this->key][$key];
+	}
+	
+	function getCartList() {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] != "") {
+				$arrRet[] = $_SESSION[$this->key][$i];
+			}
+		}
+		return $arrRet;
+	}
+	
+	// ¥«¡¼¥ÈÆâ¤Ë¤¢¤ë¾¦ÉÊ£É£Ä¤òÁ´¤Æ¼èÆÀ¤¹¤ë
+	function getAllProductID() {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] != "") {
+				$arrRet[] = $_SESSION[$this->key][$i]['id'][0];
+			}
+		}
+		return $arrRet;
+	}
+	
+	function delAllProducts() {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			unset($_SESSION[$this->key][$i]);
+		}
+	}
+	
+	// ¾¦ÉÊ¤Îºï½ü
+	function delProduct($cart_no) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) {
+				unset($_SESSION[$this->key][$i]);
+			}
+		}
+	}
+	
+	// ¸Ä¿ô¤ÎÁý²Ã
+	function upQuantity($cart_no) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) {
+				if(strlen($_SESSION[$this->key][$i]['quantity'] + 1) <= INT_LEN) {
+					$_SESSION[$this->key][$i]['quantity']++;
+				}
+			}
+		}
+	}
+	
+	// ¸Ä¿ô¤Î¸º¾¯
+	function downQuantity($cart_no) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) {
+				if($_SESSION[$this->key][$i]['quantity'] > 1) {
+					$_SESSION[$this->key][$i]['quantity']--;
+				}
+			}
+		}
+	}
+	
+	// Á´¾¦ÉÊ¤Î¹ç·×Á÷ÎÁ
+	function getAllProductsDelivFee() {
+		// ¥Ý¥¤¥ó¥È¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$deliv_fee = $_SESSION[$this->key][$i]['deliv_fee'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$total+= ($deliv_fee * $quantity);
+		}
+		return $total;
+	}	
+	
+}
+?>
Index: /temp/trunk/data/class/SC_CustomerList.php
===================================================================
--- /temp/trunk/data/class/SC_CustomerList.php	(revision 1328)
+++ /temp/trunk/data/class/SC_CustomerList.php	(revision 1328)
@@ -0,0 +1,274 @@
+<?php
+
+/*  [Ì¾¾Î] SC_CustomerList
+ *  [³µÍ×] ²ñ°÷¸¡º÷ÍÑ¥¯¥é¥¹
+ */
+class SC_CustomerList extends SC_SelectSql {
+
+	var $arrColumnCSV;
+	
+	function SC_CustomerList($array, $mode = '') {
+		parent::SC_SelectSql($array);
+		
+		if($mode == "") {
+			// ²ñ°÷ËÜÅÐÏ¿²ñ°÷¤Çºï½ü¤·¤Æ¤¤¤Ê¤¤²ñ°÷
+			$this->setWhere("status = 2 AND delete = 0 ");		
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer.update_date';
+		}
+		if($mode == "customer") {
+			// ´ÉÍý¼Ô¥Ú¡¼¥¸¸ÜµÒ¸¡º÷¤Î¾ì¹ç²¾ÅÐÏ¿²ñ°÷¤â¸¡º÷
+			$this->setWhere( "(status = 1 OR status = 2) AND delete = 0 ");		
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer.update_date';
+		}
+		
+		// ¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤Î¾ì¹ç		
+		if($mode == "magazine") {
+			$this->setWhere("(delete = 0 OR delete IS NULL)");
+			
+			if(is_array($this->arrSql['customer'])) {
+				$tmp_where = "";
+				foreach($this->arrSql['customer'] as $val) {
+					if($tmp_where != "") {
+						$tmp_where.= " OR ";
+					}					
+					switch($val) {
+					// ²ñ°÷
+					case '1':
+						$tmp_where.= "status = 2";
+						break;
+					// ¥á¥ë¥Þ¥¬ÅÐÏ¿
+					case '2':
+						// dtb_customer_mail¤Ë¤Î¤ßÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ì¥³¡¼¥É¤òÃê½Ð
+						$tmp_where.= "customer_id IS NULL ";
+						break;
+					// CSVÅÐÏ¿
+					case '3':
+						// dtb_customer_mail¤Ë¤Î¤ßÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ì¥³¡¼¥É¤òÃê½Ð
+						$tmp_where.= "customer_id IS NULL";
+						break;
+					default:
+						$tmp_where = "";
+						break;
+					}
+				}
+				if($tmp_where != "") {
+					$tmp_where = "(" . $tmp_where . ")";
+				}
+				$this->setWhere($tmp_where);
+			}
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer_mail.create_date';
+		}
+				
+		// ¸ÜµÒID
+		if ( strlen($this->arrSql['search_customer_id']) > 0 ) {
+			$this->setWhere( "customer_id =  ?" );
+			$this->arrVal[] = $this->arrSql['search_customer_id'];
+		}
+		
+		// Ì¾Á°
+		if ( strlen($this->arrSql['search_name']) > 0 ) {
+			$this->setWhere("(name01 || name02 LIKE ?)" );
+			$searchName = $this->addSearchStr($this->arrSql['search_name']);
+			$this->arrVal[] = ereg_replace("[ ¡¡]+","",$searchName);
+		}
+
+		//¡¡Ì¾Á°¡Ê¥«¥Ê¡Ë
+		if ( strlen($this->arrSql['search_kana']) > 0 ) {
+			$this->setWhere("(kana01 || kana02 LIKE ?)");
+			$searchKana = $this->addSearchStr($this->arrSql['search_kana']);
+			$this->arrVal[] = ereg_replace("[ ¡¡]+","",$searchKana);
+		}
+		
+		//¡¡ÅÔÆ»ÉÜ¸©
+		if ( strlen($this->arrSql['search_pref']) > 0 ) {
+			$this->setWhere( "pref = ?" );
+			$this->arrVal[] = $this->arrSql['search_pref'];
+		}
+
+		//¡¡ÅÅÏÃÈÖ¹æ
+		if ( is_numeric( $this->arrSql['search_tel'] ) ) {
+			$this->setWhere( "(tel01 || tel02 || tel03 LIKE ?)" );
+			$searchTel = $this->addSearchStr($this->arrSql['search_tel']);
+			$this->arrVal[] = ereg_replace("-", "", $searchTel);
+		}
+		
+		//¡¡À­ÊÌ
+		if ( is_array( $this->arrSql['search_sex'] ) ){
+			$arrSexVal = $this->setItemTerm( $this->arrSql['search_sex'] ,"sex" );
+			foreach ($arrSexVal as $data) {
+				$this->arrVal[] = $data;
+			}
+		}
+
+		//¡¡¿¦¶È
+		if ( is_array( $this->arrSql['search_job'] ) ){
+			if ( in_array("ÉÔÌÀ", $this->arrSql['search_job'] ) ) {
+				$arrJobVal = $this->setItemTermWithNull( $this->arrSql['search_job'] ,"job" );
+			} else {
+				$arrJobVal = $this->setItemTerm( $this->arrSql['search_job'] ,"job" );
+			}
+			if (is_array($arrJobVal)) {
+				foreach ($arrJobVal as $data) {
+					$this->arrVal[] = $data;
+				}
+			}
+		}
+
+		//¡¡E-MAIL
+		if ( strlen($this->arrSql['search_email']) > 0 ) {
+			$this->setWhere( "email ILIKE ? " );
+			$searchEmail = $this->addSearchStr($this->arrSql['search_email']);
+			$this->arrVal[] = $searchEmail;
+		}
+
+		//¡¡HTML-mail
+		if ( $mode == 'magazine' ){
+			if ( strlen($this->arrSql['search_htmlmail']) > 0 ) {
+				$this->setWhere( " mail_flag = ? ");
+				$this->arrVal[] = $this->arrSql['search_htmlmail'];
+			} else {
+				$this->setWhere( " (mail_flag = 1 or mail_flag = 2) ");
+			}
+		}
+		
+		// ¹ØÆþ¶â³Û»ØÄê
+		if( is_numeric( $this->arrSql["buy_total_from"] ) || is_numeric( $this->arrSql["buy_total_to"] ) ) {
+			$arrBuyTotal = $this->selectRange($this->arrSql["buy_total_from"], $this->arrSql["buy_total_to"], "buy_total");
+			foreach ($arrBuyTotal as $data1) {
+				$this->arrVal[] = $data1;
+			}
+		}
+
+		// ¹ØÆþ²ó¿ô»ØÄê
+		if( is_numeric( $this->arrSql["buy_times_from"] ) || is_numeric( $this->arrSql["buy_times_to"] ) ) {
+			$arrBuyTimes = $this->selectRange($this->arrSql["buy_times_from"], $this->arrSql["buy_times_to"], "buy_times");
+			foreach ($arrBuyTimes as $data2) {
+				$this->arrVal[] = $data2;
+			}
+		}
+		
+		// ÃÂÀ¸Æü´ü´Ö»ØÄê
+		if ( (strlen($this->arrSql['search_b_start_year']) > 0 && strlen($this->arrSql['search_b_start_month']) > 0 && strlen($this->arrSql['search_b_start_day']) > 0) ||
+			  strlen($this->arrSql['search_b_end_year']) > 0 && strlen($this->arrSql['search_b_end_month']) > 0 && strlen($this->arrSql['search_b_end_day']) > 0) {
+
+			$arrBirth = $this->selectTermRange($this->arrSql['search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day']
+					  , $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], "birth");
+			if (is_array($arrBirth)) {
+				foreach ($arrBirth as $data3) {
+					$this->arrVal[] = $data3;
+				}
+			}
+		}
+
+		// ÃÂÀ¸·î¤Î¸¡º÷
+		if (is_numeric($this->arrSql["birth_month"])) {
+			$this->setWhere(" EXTRACT(month from birth) = ?");  
+			$this->arrVal[] = $this->arrSql["birth_month"];
+		}
+
+		// ÅÐÏ¿´ü´Ö»ØÄê
+		if ( (strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0 ) || 
+				(strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) >0 && strlen($this->arrSql['search_end_day']) > 0) ) {
+
+			$arrRegistTime = $this->selectTermRange($this->arrSql['search_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day']
+							, $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col);
+			if (is_array($arrRegistTime)) {
+				foreach ($arrRegistTime as $data4) {
+					$this->arrVal[] = $data4;
+				}
+			}
+		}
+
+		// ºÇ½ª¹ØÆþÆü»ØÄê
+		if ( (strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0 ) || 
+				(strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) >0 && strlen($this->arrSql['search_buy_end_day']) > 0) ) {
+			$arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day']
+							, $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], "last_buy_date");
+			if (is_array($arrRegistTime)) {
+				foreach ($arrRegistTime as $data4) {
+					$this->arrVal[] = $data4;
+				}
+			}
+		}
+		
+		//¹ØÆþ¾¦ÉÊ¥³¡¼¥É
+		if ( strlen($this->arrSql['search_buy_product_code']) > 0 ) {
+			$this->setWhere( "customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_code LIKE ? ))");
+			$search_buyproduct_code = $this->addSearchStr($this->arrSql['search_buy_product_code']);
+			$this->arrVal[] = $search_buyproduct_code;
+		}
+
+		//¹ØÆþ¾¦ÉÊÌ¾¾Î
+		if ( strlen($this->arrSql['search_buy_product_name']) > 0 ) {
+			$this->setWhere( "customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_name LIKE ? ))");
+			$search_buyproduct_name = $this->addSearchStr($this->arrSql['search_buy_product_name']);
+			$this->arrVal[] = $search_buyproduct_name;
+		}
+		
+		//¥«¥Æ¥´¥ê¡¼¤òÁªÂò¤·¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¹Ê¹þ¸¡º÷¤ò¹Ô¤¦
+		if ( strlen($this->arrSql['search_category_id']) != ""){
+			//¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¸¡º÷¤ò¹Ô¤¦SQLÊ¸À¸À®
+			list($tmp_where, $tmp_arrval) = sfGetCatWhere(sfManualEscape($this->arrSql['search_category_id']));
+
+			//¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¤ß¤¬²ÄÇ½¤Î¾ì¹ç
+			if($tmp_where != "") {
+				$this->setWhere( " customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_products WHERE ".$tmp_where." ))) ");
+				$this->arrVal = array_merge($this->arrVal, $tmp_arrval);
+			}
+		}
+
+		$this->setOrder( "customer_id DESC" );
+	}
+
+	// ¸¡º÷ÍÑSQL
+	function getList() {
+		$this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,status FROM dtb_customer ";
+		return $this->getSql(0);	
+	}
+
+	function getListMailMagazine() {
+		$this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref, mail_flag FROM dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";
+		return $this->getSql(0);	
+	}
+	
+	function getListMailMagazineCount() {
+		$this->select = "SELECT COUNT(*) FROM dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";
+		return $this->getSql(0);	
+	}
+	//¹ØÆþ¾¦ÉÊ¥³¡¼¥É¸¡º÷ÍÑSQL
+	function getBuyList(){
+		$this->select = "SELECT A.customer_id, A.name01, A.name02, A.kana01, A.kana02, A.sex, A.email, A.tel01, A.tel02, A.tel03, A.pref, A.mail_flag, B.order_email, B.order_id, C.product_code 
+						FROM (dtb_customer LEFT OUTER JOIN dtb_customer_mail USING (email)) AS A LEFT OUTER JOIN dtb_order AS B ON 
+						A.email=B.order_email LEFT OUTER JOIN dtb_order_detail AS C ON B.order_id = C.order_id";
+	}
+
+	//¡¡¸¡º÷Áí¿ô¥«¥¦¥ó¥ÈÍÑSQL
+	function getListCount() {
+		$this->select = "SELECT COUNT (customer_id) FROM dtb_customer ";	
+		return $this->getSql(1);
+	}
+
+	//¡¡CSV¥À¥¦¥ó¥í¡¼¥ÉÍÑSQL
+	function getListCSV($arrColumnCSV) {
+		$this->arrColumnCSV = $arrColumnCSV;
+		$i = 0;
+		foreach ($this->arrColumnCSV as $val) {
+			if ($i != 0) $state .= ", ";
+			$state .= $val["sql"];
+			$i ++;
+		}
+
+		$this->select = "SELECT " .$state. " FROM dtb_customer ";
+		return $this->getSql(2);	
+	}
+	
+	function getWhere() {
+		return array($this->where, $this->arrVal);
+	}
+	
+}
+
+?>
Index: /temp/trunk/data/class/SC_SelectSql.php
===================================================================
--- /temp/trunk/data/class/SC_SelectSql.php	(revision 1328)
+++ /temp/trunk/data/class/SC_SelectSql.php	(revision 1328)
@@ -0,0 +1,234 @@
+<?php
+
+/* ---- SQLÊ¸¤òºî¤ë¥¯¥é¥¹ ---- */
+class SC_SelectSql {
+	
+	var $sql;
+	
+	var $select;	
+	var $where;
+	var $order;
+	var $group;
+	var $limit;
+	var $offset;
+	var $arrSql;
+	var $arrVal;
+
+	//--¡¡¥³¥ó¥¹¥È¥é¥¯¥¿¡£
+	function SC_SelectSql($array = "") {
+		if (is_array($array)) {
+			$this->arrSql = $array;
+		}
+	}
+
+	//-- SQLÊ¬À¸À®
+	function getSql( $mode = "" ){
+		$this->sql = $this->select ." ". $this->where ." ". $this->group ." ";
+						
+		// $mode == 1 ¤Ï limit & offsetÌµ¤·						
+		if ( $mode != 1 ){
+			$this->sql .= $this->order . " " .$this->limit ." ". $this->offset;	
+		} elseif ($mode == 2) {
+			$this->sql .= $this->order;
+		}
+		return $this->sql;	
+	}
+
+		// ¸¡º÷ÍÑ
+	function addSearchStr($val) {
+		$return = sfManualEscape($val);
+		$return = "%" .$return. "%";
+		return $return;
+	}
+	
+	//-- ÈÏ°Ï¸¡º÷¡Ê¡û¡¡¢·¡¡¡û¡¡¤Þ¤Ç¡Ë
+	function selectRange($from, $to, $column) {
+
+		// ¤¢¤ëÃ±°Ì¤Î¤ß¸¡º÷($from = $to)
+		if(  $from == $to ) {
+			$this->setWhere( $column ." = ?" );
+			$return = array($from);
+		//¡¡¢·$to¤Þ¤Ç¸¡º÷
+		} elseif(  strlen($from) == 0 && strlen($to) > 0 ) {
+			$this->setWhere( $column ." <= ? "); 
+			$return = array($to);
+		//¡¡¢·$from°Ê¾å¤ò¸¡º÷
+		} elseif(  strlen($from) > 0 && strlen($to) == 0 ) {
+			$this->setWhere( $column ." >= ? ");
+			$return = array($from);
+		//¡¡$from¢·$to¤Î¸¡º÷
+		} else {
+			$this->setWhere( $column ."	BETWEEN ? AND ?" ); 
+			$return = array($from, $to);
+		}
+		return $return;
+	}
+
+	//--¡¡´ü´Ö¸¡º÷¡Ê¡ûÇ¯¡û·î¡ûÆü¤«¢·¡ûÇ¯¡û·î¡ûÆü¤Þ¤Ç¡Ë
+	function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column) {
+
+		// ³«»Ï´ü´Ö¤À¤±»ØÄê¤Î¾ì¹ç¤ÏËÜÆüÅÐÏ¿Ê¬¤Þ¤Ç
+		if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) &&	( $to_year == "" ) && ( $to_month == "" ) && ( $to_day == "" ) ) {
+			list( $date1, $date2, $err ) = sfCheckSetTerm( $from_year, $from_month, $from_day, date("Y"), date("m"), date("d") );
+  			if ( ! $err ) {
+				$this->setWhere( $column ." BETWEEN ? AND ?" );
+				$return = array($date1, $date2);
+  			}
+		}
+
+		//¡¡³«»Ï¢·½ªÎ»
+		if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && 
+			( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) {
+
+			list( $date1, $date2, $err ) = sfCheckSetTerm( $from_year, $from_month, $from_day, $to_year, $to_month, $to_day );
+  			if ( ! $err ) {
+				$this->setWhere( $column ." BETWEEN ? AND ?" );
+				$return = array($date1, $date2);
+  			}
+		}
+
+		// ½ªÎ»´ü´Ö¤À¤±»ØÄê¤Î¾ì¹ç
+		if( ( $from_year == "" ) && ( $from_month == "" ) && ( $from_day == "" ) && ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) {
+	
+			list( $date1, $date2, $err ) = sfCheckSetTerm( 1900, 1, 2, $to_year, $to_month, $to_day );
+			if ( ! $err ) {
+				$this->setWhere( $column ." < ?" );
+				$return = array($date2);
+			}
+		}
+		return $return;
+	}	
+
+	// checkbox¤Ê¤É¤ÇÆ±°ì¥«¥é¥àÆâ¤ÇÃ±°ì¡¢¤â¤·¤¯¤ÏÊ£¿ôÁªÂò»è¤¬Í­¤ë¾ì¹ç¡¡Îã: AND ( sex = xxx OR sex = xxx OR sex = xxx  ) AND ... 
+	function setItemTerm( $arr, $ItemStr ) {
+
+		foreach( $arr as $data ) {
+	
+			if( count( $arr ) > 1 ) {
+				if( ! is_null( $data ) ) $item .= $ItemStr . " = ? OR ";	
+			} else {
+				if( ! is_null( $data ) ) $item = $ItemStr . " = ?";	
+			}
+			$return[] = $data;
+		}
+
+		if( count( $arr ) > 1 )  $item = "( " . rtrim( $item, " OR " ) . " )";
+		$this->setWhere( $item );
+		return $return;
+	}
+
+	//¡¡NULLÃÍ¤¬É¬Í×¤Ê¾ì¹ç
+	function setItemTermWithNull( $arr, $ItemStr ) {
+
+		$item = " ${ItemStr} IS NULL ";
+		
+		if ( $arr ){
+			foreach( $arr as $data ) {	
+				if ($data != "ÉÔÌÀ") {
+					$item .= " OR ${ItemStr} = ?";
+					$return[] = $data;
+				}
+			}
+		}
+		
+	 	$item = "( ${item} ) ";
+		$this->setWhere( $item );
+		return $return;
+	}
+	// NULL¤â¤·¤¯¤Ï''¤Ç¸¡º÷¤¹¤ë¾ì¹ç
+	function setItemTermWithNullAndSpace( $arr, $ItemStr ) {
+		$count = count($arr);
+		$item = " ${ItemStr} IS NULL OR ${ItemStr} = '' ";
+		$i = 1;
+		if ( $arr ){
+			foreach( $arr as $data ) {	
+				if ($i == $count) break;
+				$item .= " OR ${ItemStr} = ?";	
+				$return[] = $data;
+				$i ++;
+			}
+		}
+	 	$item = "( ${item} ) ";
+		$this->setWhere( $item );
+		return $return;
+	}
+	
+
+
+	/* Ê£¿ô¤Î¥«¥é¥à¤ÇOR¤ÇÍ¥Àè¸¡º÷¤¹¤ë¾ì¹ç¡¡Îã¡§¡¡AND ( item_flag1 = xxx OR item_flag2 = xxx OR item_flag3 = xxx  ) AND ... 
+
+		ÇÛÎó¤Î¹½Â¤Îã¡¡
+		if ( $_POST['show_site1'] ) $arrShowsite_1 = array( "column" => "show_site1",
+															"value"  => $_POST['show_site1'] );
+
+	*/
+	function setWhereByOR( $arrWhere ){
+
+		$count = count( $arrWhere );
+
+		for( $i = 0; $i < $count; $i++ ) {
+
+			if( isset( $arrWhere[$i]["value"] ) ) $statement .= $arrWhere[$i]["column"] ." = '" . addslashes( $arrWhere[$i]["value"] ) ."' OR "  ;
+		}
+
+		$statement = "( " . rtrim( $statement, " OR " ) . " )";
+
+		if( $this->where ) {
+
+			$this->where .= " AND " . $statement;
+
+		} else {
+
+			$this->where = "WHERE " . $statement;
+		}
+	}
+
+	function setWhere($where){
+		if ($where != "") {		
+			if( $this->where ) {
+	
+				$this->where .= " AND " . $where;
+	
+			} else {
+	
+				$this->where = "WHERE " . $where;
+			}
+		}
+	}
+
+	function setOrder($order){
+		
+			$this->order =  "ORDER BY " . $order;
+		
+	}
+
+	function setGroup( $group ) {
+		
+		$this->group =  "GROUP BY " . $group;
+		
+	}
+
+	
+	function setLimitOffset( $limit, $offset ){
+
+		if ( is_numeric($limit) and is_numeric($offset) ){
+
+			$this->limit = " LIMIT " .$limit;
+			$this->offset = " OFFSET " .$offset;
+		}	
+	}
+	
+	function clearSql(){
+		$this->select = "";
+		$this->where = "";
+		$this->group = "";
+		$this->order = "";
+		$this->limit = "";
+		$this->offset = "";
+	}
+	
+	function setSelect($sql) {
+		$this->select = $sql;
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_Customer.php
===================================================================
--- /temp/trunk/data/class/SC_Customer.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Customer.php	(revision 1328)
@@ -0,0 +1,131 @@
+<?php
+/*  [Ì¾¾Î] SC_Customer
+ *  [³µÍ×] ²ñ°÷´ÉÍý¥¯¥é¥¹
+ */
+class SC_Customer {
+	
+	var $conn;
+	var $email;
+	var $customer_data;		// ²ñ°÷¾ðÊó   
+		
+	function SC_Customer( $conn = '', $email = '', $pass = '' ) {
+		// ¥»¥Ã¥·¥ç¥ó³«»Ï
+		/* startSession¤«¤é°ÜÆ° 2005/11/04 ÃæÀî */
+		sfDomainSessionStart();
+		
+		// DBÀÜÂ³¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+		$DB_class_name = "SC_DbConn";
+		if ( is_object($conn)){
+			if ( is_a($conn, $DB_class_name)){
+				// $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë
+				$this->conn = $conn;
+			}
+		} else {
+			if (class_exists($DB_class_name)){
+				//$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë
+				$this->conn = new SC_DbConn();			
+			}
+		}
+			
+		if ( is_object($this->conn) ) { 
+			// Àµ¾ï¤ËDB¤ËÀÜÂ³¤Ç¤­¤ë
+			if ( $email ){
+				// email¤«¤é¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+				// $this->setCustomerDataFromEmail( $email );
+			}
+		} else {
+			echo "DBÀÜÂ³¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ë¼ºÇÔ¤·¤Æ¤¤¤Þ¤¹";
+			exit;
+		}
+		
+		if ( strlen($email) > 0 && strlen($pass) > 0 ){
+			$this->getCustomerDataFromEmailPass( $email, $pass );
+		}
+	}
+	
+	function getCustomerDataFromEmailPass( $pass, $email ) {
+		// ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND delete = 0 AND status = 2";
+		$result = $this->conn->getAll($sql, array($email));
+		$data = $result[0];
+		
+		// ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ì¤Ð¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë¥»¥Ã¥È¤·¤Ætrue¤òÊÖ¤¹
+		if ( crypt($pass,$data['password'] ) == $data['password'] ){
+			$this->customer_data = $data;
+			$this->startSession();
+			return true;
+		}
+		return false;
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¤ò³ÎÇ§¤»¤º¤Ë¥í¥°¥¤¥ó
+	function setLogin($email) {
+		// ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND delete = 0 AND status = 2";
+		$result = $this->conn->getAll($sql, array($email));
+		$data = $result[0];
+		$this->customer_data = $data;
+		$this->startSession();
+	}
+	
+	// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾ðÊó¤Ë¹¹¿·¤¹¤ë
+	function updateSession() {
+		$sql = "SELECT * FROM dtb_customer WHERE customer_id = ? AND delete = 0";
+		$customer_id = $this->getValue('customer_id');
+		$arrRet = $this->conn->getAll($sql, array($customer_id));
+		$this->customer_data = $arrRet[0];
+		$_SESSION['customer'] = $this->customer_data;
+	}
+		
+	// ¥í¥°¥¤¥ó¾ðÊó¤ò¥»¥Ã¥·¥ç¥ó¤ËÅÐÏ¿¤·¡¢¥í¥°¤Ë½ñ¤­¹þ¤à
+	function startSession() {
+		sfDomainSessionStart();
+		$_SESSION['customer'] = $this->customer_data;
+		// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊÝÂ¸
+		gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH );
+	}
+
+	// ¥í¥°¥¢¥¦¥È¡¡$_SESSION['customer']¤ò²òÊü¤·¡¢¥í¥°¤Ë½ñ¤­¹þ¤à
+	function EndSession() {
+		// $_SESSION['customer']¤Î²òÊü
+		unset($_SESSION['customer']);
+		// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+		gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH );
+	}
+	
+	// ¥í¥°¥¤¥ó¤ËÀ®¸ù¤·¤Æ¤¤¤ë¤«È½Äê¤¹¤ë¡£
+	function isLoginSuccess() {
+		// ¥í¥°¥¤¥ó»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÈDB¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬°ìÃ×¤·¤Æ¤¤¤ë¾ì¹ç
+		if(sfIsInt($_SESSION['customer']['customer_id'])) {
+			$objQuery = new SC_Query();
+			$email = $objQuery->get("dtb_customer", "email", "customer_id = ?", array($_SESSION['customer']['customer_id']));
+			if($email == $_SESSION['customer']['email']) {
+				return true;
+			}
+		}
+		return false;
+	}
+		
+	// ¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ
+	function getValue($keyname) {
+		return $_SESSION['customer'][$keyname];
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤Î¥»¥Ã¥È
+	function setValue($keyname, $val) {
+		$_SESSION['customer'][$keyname] = $val;
+	}
+	
+	// ÃÂÀ¸Æü·î¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎÈ½Äê
+	function isBirthMonth() {
+		$arrRet = split("[- :/]", $_SESSION['customer']['birth']);
+		$birth_month = intval($arrRet[1]);
+		$now_month = intval(date("m"));
+		
+		if($birth_month == $now_month) {
+			return true;
+		}
+		return false;
+	}
+}
+?>
Index: /temp/trunk/data/class/GC_Thumb.php
===================================================================
--- /temp/trunk/data/class/GC_Thumb.php	(revision 1328)
+++ /temp/trunk/data/class/GC_Thumb.php	(revision 1328)
@@ -0,0 +1,58 @@
+<?php
+require_once("../lib/thumb.php");
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] GC_Thumb
+ * [³µÍ×] ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(thumb.php¤È¥»¥Ã¥È¤Ç»ÈÍÑ¤¹¤ë)
+ * [°ú¿ô] -
+ * [ÌáÃÍ] -
+ * [°ÍÂ¸] thumb.php
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+
+Class GC_Thumb {
+
+	var $tempPath;
+
+	function GC_Thumb($tempFilePath = "") {
+		$this->tempPath	 = $_SERVER['DOCUMENT_ROOT'] . $tempFilePath;
+	}
+
+	//--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®(¥µ¥à¥Í¥¤¥ë²èÁüÀ¸À®ÍÑ)
+	function makeImageTempFile($fileName, $phpFileName, $max_width,$max_height) {
+		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+		$mainname = uniqid("").".";
+		// ³ÈÄ¥»Ò°Ê³°¤òÃÖ¤­´¹¤¨¤ë¡£
+		$newFileName = ereg_replace("^.*\.",$mainname,$fileName);
+		$result  = MakeThumb( $phpFileName, $this->tempPath, $max_width, $max_height, $newFileName );
+		return $newFileName;
+	}
+
+	//--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®
+	function makeTempFile($fileName, $phpFileName) {
+		$newFileNname = str_replace("'", "¡Ç", $fileName );
+		$newFileNname = date("siU") . $newFileNname;
+		copy( $phpFileName, $this->tempPath . $newFileNname );
+		return $newFileNname;	
+	}
+
+	//--- ¥Õ¥¡¥¤¥ë¤ò»ØÄêÊÝÂ¸DIR¤Ø°ÜÆ°
+	function fileMove($fileName, $dirName) {
+		if(copy( $this->tempPath . $fileName , $_SERVER['DOCUMENT_ROOT'] . $dirName . $fileName)) {
+			unlink( $this->tempPath . $fileName );
+		}
+	}
+
+	//---- °ì»þDIR¤Î¥Õ¥¡¥¤¥ë¤ò°ì³çºï½ü	
+	function execDeleteTempFile() {
+		chdir( $this->tempPath );
+		$delFile = glob( "*.*" );
+		if( is_array($delFile) ) foreach( $delFile as $val ) @unlink( $val );
+	}
+
+	//---- »ØÄê¥Õ¥¡¥¤¥ë¤òºï½ü	
+	function fileDelete($fileName, $dirName) {
+		unlink( $_SERVER['DOCUMENT_ROOT'] . $dirName . $fileName );
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_DbConn.php
===================================================================
--- /temp/trunk/data/class/SC_DbConn.php	(revision 1328)
+++ /temp/trunk/data/class/SC_DbConn.php	(revision 1328)
@@ -0,0 +1,155 @@
+<?php
+$current_dir = realpath(dirname(__FILE__));
+require_once($current_dir . "/../module/DB.php");
+
+$objDbConn = "";
+
+class SC_DbConn{
+
+	var $conn;
+	var $result; 
+	var $includePath;
+	
+	var $error_mail_to;
+	var $error_mail_title;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_DbConn($dsn = ""){
+		global $objDbConn;
+		// ´û¤ËÀÜÂ³¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤ÏÀÜÂ³¤·¤Ê¤¤
+		if(!isset($objDbConn->connection)) {
+			if($dsn != "") {
+				$objDbConn = DB::connect($dsn);
+			} else {
+				$objDbConn = DB::connect(DEFAULT_DSN);
+			}
+		}
+		$this->conn = $objDbConn;
+		$this->error_mail_to = DB_ERROR_MAIL_TO;
+		$this->error_mail_title = DB_ERROR_MAIL_SUBJECT;
+	}
+	
+	// ¥¯¥¨¥ê¤Î¼Â¹Ô
+	function query($n ,$arr = "", $ignore_err = false){
+		if ( $arr ) {
+			$result = $this->conn->query($n, $arr);	
+		} else {
+			$result = $this->conn->query($n);
+		}
+	
+		if ($this->conn->isError($result) && !$ignore_err){
+			$this->send_err_mail ($result, $n);
+		}
+		
+		$this->result = $result;
+		return $this->result;
+	}
+
+	// °ì·ï¤Î¤ß¼èÆÀ
+	function getOne($n, $arr = ""){
+		
+		if ( $arr ) {
+			$result = $this->conn->getOne($n, $arr);
+		} else {
+			$result = $this->conn->getOne($n);
+		}		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result ,$n);
+		}
+		$this->result = $result;
+		return $this->result;
+	}
+	
+	function getRow($n, $arr = ""){
+		
+		if ( $arr ) {
+			$result = $this->conn->getRow($n, $arr);
+		} else {
+			$result = $this->conn->getRow($n);
+		}		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result ,$n);
+		}
+		$this->result = $result;
+		return $this->result;
+	}
+
+	// SELECTÊ¸¤Î¼Â¹Ô·ë²Ì¤òÁ´¤Æ¼èÆÀ
+	function getAll($n, $arr = ""){
+
+		if ( $arr ){
+			$result = $this->conn->getAll($n, $arr, DB_FETCHMODE_ASSOC);
+		} else {
+			$result = $this->conn->getAll($n, DB_FETCHMODE_ASSOC);
+		}
+		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result, $n);
+		}
+		$this->result = $result;
+		
+		return $this->result;
+	}	
+	
+	function autoExecute($table_name, $fields_values, $sql_where = null){
+	
+		if ( $sql_where ) {
+			$result = $this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_UPDATE, $sql_where);
+		} else {
+			$result = $this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_INSERT);
+		}
+		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result, $n);
+		}
+		$this->result = $result;
+		return $this->result;
+	}
+	
+	
+	function prepare($n){
+		global $sql;
+		$sql = $n;		
+		$result = $this->conn->prepare($n);
+		$this->result = $result;
+		return $this->result;
+	}
+	
+	function execute($n, $obj){
+		global $sql;
+		$sql = $n;
+		$result = $this->conn->execute($n, $obj);
+		$this->result = $result;
+		return $this->result;
+	}	
+	
+	function reset(){
+		$this->conn->disconnect();
+	}
+
+	function send_err_mail( $result, $sql ){
+		
+		if ($_SERVER['HTTPS'] == "on") {
+			$url = "https://";
+		} else {
+			$url = "http://";
+		}
+		$url.= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+		
+		$errmsg = $url."\n\n";
+		$errmsg.= $sql . "\n";
+		$errmsg.= $result->message . "\n\n";
+		$errmsg.= $result->userinfo . "\n\n";
+		
+		ob_start();
+		print_R($result);	
+		$errmsg .= ob_get_contents();
+		ob_end_clean();	
+		
+		mb_send_mail ( $this->error_mail_to, $this->error_mail_title, "${errmsg}\n".date("Y/m/d H:i:s") );
+		
+		exit(sfprintr($errmsg));
+	}
+}
+
+?>
Index: /temp/trunk/data/class/SC_Query.php
===================================================================
--- /temp/trunk/data/class/SC_Query.php	(revision 1328)
+++ /temp/trunk/data/class/SC_Query.php	(revision 1328)
@@ -0,0 +1,356 @@
+<?php
+class SC_Query {
+	var $option;
+	var $where;
+	var $conn;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_Query($dsn = "") {
+		$this->conn = new SC_DBconn($dsn);
+		$this->where = "";
+		return $this->conn;
+	}
+	
+	// COUNTÊ¸¤Î¼Â¹Ô
+	function count($table, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT COUNT(*) FROM $table";
+		} else {
+			$sqlse = "SELECT COUNT(*) FROM $table WHERE $where";
+		}
+		// ¥«¥¦¥ó¥ÈÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+
+		return $ret;
+	}
+	
+	function select($col, $table, $where = "", $arrval = array()){
+		$sqlse = $this->getsql($col, $table, $where);
+		$ret = $this->conn->getAll($sqlse, $arrval);
+
+		return $ret;
+	}
+
+	function getLastQuery($disp = false) {
+		$sql = $this->conn->conn->last_query;
+		if($disp) { 
+			print($sql.";<br />\n");
+		}
+		return $sql;
+	}
+
+	function commit() {
+		$this->conn->query("COMMIT");
+	}
+	
+	function begin() {
+		$this->conn->query("BEGIN");
+	}
+	
+	function rollback() {
+		$this->conn->query("ROLLBACK");
+	}
+	
+	function exec($str, $arrval = array()) {
+		$this->conn->query($str, $arrval);
+	}
+	
+	function autoselect($col, $table, $arrwhere = array(), $arrcon = array()) {
+		$strw = "";			
+		$find = false;
+		foreach ($arrwhere as $key => $val) {
+			if(strlen($val) > 0) {
+				if(strlen($strw) <= 0) {
+					$strw .= $key ." LIKE ?";
+				} else if(strlen($arrcon[$key]) > 0) {
+					$strw .= " ". $arrcon[$key]. " " . $key ." LIKE ?";
+				} else {
+					$strw .= " AND " . $key ." LIKE ?";
+				}
+				
+				$arrval[] = $val;
+			}
+		}
+		
+		if(strlen($strw) > 0) {
+			$sqlse = "SELECT $col FROM $table WHERE $strw ".$this->option;
+		} else {
+			$sqlse = "SELECT $col FROM $table ".$this->option;
+		}
+		$ret = $this->conn->getAll($sqlse, $arrval);
+		return $ret;
+	}
+	
+	function getall($sql, $arrval = array()) {
+		$ret = $this->conn->getAll($sql, $arrval);
+		return $ret;
+	}
+
+	function getsql($col, $table, $where) {
+		if($where != "") {
+			// °ú¿ô¤Î$where¤òÍ¥Àè¤·¤Æ¼Â¹Ô¤¹¤ë¡£
+			$sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option;
+		} else {
+			if($this->where != "") {
+					$sqlse = "SELECT $col FROM $table WHERE $this->where " . $this->groupby . " " . $this->order . " " . $this->option;
+				} else {
+					$sqlse = "SELECT $col FROM $table " . $this->groupby . " " . $this->order . " " . $this->option;
+			}
+		}
+		return $sqlse;
+	}
+			
+	function setoption($str) {
+		$this->option = $str;
+	}
+	
+	function setlimitoffset($limit, $offset = 0) {
+		if (is_numeric($limit) && is_numeric($offset)){
+			$this->option.= " LIMIT " . $limit;
+			$this->option.= " OFFSET " . $offset;
+		}
+	}
+	
+	function setgroupby($str) {
+		$this->groupby = "GROUP BY " . $str;
+	}
+	
+	function andwhere($str) {
+		if($this->where != "") {
+			$this->where .= " AND " . $str;
+		} else {
+			$this->where = $str;
+		}
+	}
+	
+	function orwhere($str) {
+		if($this->where != "") {
+			$this->where .= " OR " . $str;
+		} else {
+			$this->where = $str;
+		}
+	}
+		
+	function setwhere($str) {
+		$this->where = $str;
+	}
+	
+	function setorder($str) {
+		$this->order = "ORDER BY " . $str;
+	}
+	
+		
+	function setlimit($limit){
+		if ( is_numeric($limit)){
+			$this->option = " LIMIT " .$limit;
+		}	
+	}
+	
+	function setoffset($offset) {
+		if ( is_numeric($offset)){
+			$this->offset = " OFFSET " .$offset;
+		}	
+	}
+	
+	
+	// INSERTÊ¸¤ÎÀ¸À®¡¦¼Â¹Ô
+	// $table	:¥Æ¡¼¥Ö¥ëÌ¾
+	// $sqlval	:ÎóÌ¾ => ÃÍ¤Î³ÊÇ¼¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó
+	function insert($table, $sqlval) {
+		$strcol = '';
+		$strval = '';
+		$find = false;
+		foreach ($sqlval as $key => $val) {
+				$strcol .= $key . ',';
+				if(eregi("^Now\(\)$", $val)) {
+					$strval .= 'Now(),';
+				} else {
+					$strval .= '?,';
+					if($val != ""){
+						$arrval[] = $val;
+					} else {
+						$arrval[] = NULL;
+					}
+				}
+				$find = true;
+		}
+		if(!$find) {
+			return false;
+		}
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strcol = ereg_replace(",$","",$strcol);
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strval = ereg_replace(",$","",$strval);
+		$sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";
+		
+		// INSERTÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->query($sqlin, $arrval);
+		
+		return $ret;		
+	}
+	
+		// INSERTÊ¸¤ÎÀ¸À®¡¦¼Â¹Ô
+	// $table	:¥Æ¡¼¥Ö¥ëÌ¾
+	// $sqlval	:ÎóÌ¾ => ÃÍ¤Î³ÊÇ¼¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó
+	function fast_insert($table, $sqlval) {
+		$strcol = '';
+		$strval = '';
+		$find = false;
+		
+		foreach ($sqlval as $key => $val) {
+				$strcol .= $key . ',';
+				if($val != ""){
+					$eval = pg_escape_string($val);
+					$strval .= "'$eval',";
+				} else {
+					$strval .= "NULL,";
+				}
+				$find = true;
+		}
+		if(!$find) {
+			return false;
+		}
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strcol = ereg_replace(",$","",$strcol);
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strval = ereg_replace(",$","",$strval);
+		$sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";
+		
+		// INSERTÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->query($sqlin);
+		
+		return $ret;		
+	}
+	
+	
+	// UPDATEÊ¸¤ÎÀ¸À®¡¦¼Â¹Ô
+	// $table	:¥Æ¡¼¥Ö¥ëÌ¾
+	// $sqlval	:ÎóÌ¾ => ÃÍ¤Î³ÊÇ¼¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó
+	// $where	:WHEREÊ¸»úÎó
+	function update($table, $sqlval, $where = "", $arradd = "", $addcol = "") {
+		$strcol = '';
+		$strval = '';
+		$find = false;
+		foreach ($sqlval as $key => $val) {
+			if(eregi("^Now\(\)$", $val)) {
+				$strcol .= $key . '= Now(),';
+			} else {
+				$strcol .= $key . '= ?,';
+				if($val != ""){
+					$arrval[] = $val;
+				} else {
+					$arrval[] = NULL;
+				}
+			}
+			$find = true;
+		}
+		if(!$find) {
+			return false;
+		}
+		
+		if($addcol != "") {
+			foreach($addcol as $key => $val) {
+				$strcol .= "$key = $val,";
+			}
+		}
+				
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strcol = ereg_replace(",$","",$strcol);
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strval = ereg_replace(",$","",$strval);
+		
+		if($where != "") {
+			$sqlup = "UPDATE $table SET $strcol WHERE $where";
+		} else {
+			$sqlup = "UPDATE $table SET $strcol";
+		}
+		
+		if(is_array($arradd)) {
+			// ¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼ÍÑ¤ËÇÛÎó¤òÄÉ²Ã
+			foreach($arradd as $val) {
+				$arrval[] = $val;
+			}
+		}
+		
+		// INSERTÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->query($sqlup, $arrval);
+		return $ret;		
+	}
+
+	// MAXÊ¸¤Î¼Â¹Ô
+	function max($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT MAX($col) FROM $table";
+		} else {
+			$sqlse = "SELECT MAX($col) FROM $table WHERE $where";
+		}
+		// MAXÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	// MINÊ¸¤Î¼Â¹Ô
+	function min($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT MIN($col) FROM $table";
+		} else {
+			$sqlse = "SELECT MIN($col) FROM $table WHERE $where";
+		}
+		// MINÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	// ÆÃÄê¤Î¥«¥é¥à¤ÎÃÍ¤ò¼èÆÀ
+	function get($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT $col FROM $table";
+		} else {
+			$sqlse = "SELECT $col FROM $table WHERE $where";
+		}
+		// SQLÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	function getone($sql, $arrval = array()) {
+		// SQLÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sql, $arrval);
+		return $ret;
+	}
+		
+	// °ì¹Ô¤ò¼èÆÀ
+	function getrow($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT $col FROM $table";
+		} else {
+			$sqlse = "SELECT $col FROM $table WHERE $where";
+		}
+		// SQLÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getRow($sqlse, $arrval);
+		return $ret;
+	}
+		
+	// ¥ì¥³¡¼¥É¤Îºï½ü
+	function delete($table, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlde = "DELETE FROM $table";
+		} else {
+			$sqlde = "DELETE FROM $table WHERE $where";
+		}
+		$ret = $this->conn->query($sqlde, $arrval);
+		return $ret;
+	}
+	
+	function nextval($table, $colname) {
+		$seqtable = $table . "_" . $colname . "_seq";
+		$ret = $this->conn->getOne("SELECT NEXTVAL('$seqtable')");
+		return $ret;
+	}
+	
+	function query($n ,$arr = "", $ignore_err = false){
+		$result = $this->conn->query($n, $arr, $ignore_err);
+		return $this->result;
+	}
+}
+?>
Index: /temp/trunk/data/class/SC_SiteSession.php
===================================================================
--- /temp/trunk/data/class/SC_SiteSession.php	(revision 1328)
+++ /temp/trunk/data/class/SC_SiteSession.php	(revision 1328)
@@ -0,0 +1,64 @@
+<?php
+/* ¥«¡¼¥È¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_SiteSession {
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_SiteSession() {
+		sfDomainSessionStart();
+		// Á°¥Ú¡¼¥¸¤Ç¤ÎÅÐÏ¿À®¸ùÈ½Äê¤ò°ú¤­·Ñ¤°
+		$_SESSION['site']['pre_regist_success'] = $_SESSION['site']['regist_success'];
+		$_SESSION['site']['regist_success'] = false;
+		$_SESSION['site']['pre_page'] = $_SESSION['site']['now_page'];
+		$_SESSION['site']['now_page'] = $_SERVER['PHP_SELF'];
+	}
+	
+	/* Á°¥Ú¡¼¥¸¤¬ÀµÅö¤Ç¤¢¤ë¤«¤ÎÈ½Äê */
+	function isPrePage() {
+		if($_SESSION['site']['pre_page'] != "" && $_SESSION['site']['now_page'] != "") {
+			if($_SESSION['site']['pre_regist_success'] || $_SESSION['site']['pre_page'] == $_SESSION['site']['now_page']) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	function setNowPage($path) {
+		$_SESSION['site']['now_page'] = $path;
+	}
+	
+	/* ÃÍ¤Î¼èÆÀ */
+	function getValue($keyname) {
+		return $_SESSION['site'][$keyname];
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ */
+	function getUniqId() {
+		return $_SESSION['site']['uniqid'];
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î¥»¥Ã¥È */
+	function setUniqId() {
+		// Í½Â¬¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¥é¥ó¥À¥àÊ¸»úÎó¤òÉÕÍ¿¤¹¤ë¡£
+		$_SESSION['site']['uniqid'] = sfGetUniqRandomId();
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î¥Á¥§¥Ã¥¯ */
+	function checkUniqId() {
+		if($_POST['uniqid'] != "") {
+			if($_POST['uniqid'] != $_SESSION['site']['uniqid']) {
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î²ò½ü */
+	function unsetUniqId() {
+		$_SESSION['site']['uniqid'] = "";
+	}
+	
+	/* ÅÐÏ¿À®¸ù¤òµ­Ï¿ */
+	function setRegistFlag() {
+		$_SESSION['site']['regist_success'] = true;
+	}
+}
+?>
Index: /temp/trunk/data/conf/conf.php
===================================================================
--- /temp/trunk/data/conf/conf.php	(revision 1328)
+++ /temp/trunk/data/conf/conf.php	(revision 1328)
@@ -0,0 +1,745 @@
+<?php
+
+$CONF_PHP_PATH = realpath( dirname( __FILE__) );
+require_once($CONF_PHP_PATH ."/../../html/install.inc");
+require_once($CONF_PHP_PATH ."/core.php" );
+
+//--------------------------------------------------------------------------------------------------------
+/** ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑ **/
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑ¥Õ¥¡¥¤¥ë³ÊÇ¼¾ì½ê
+define("UPDATE_HTTP", "http://ec-cube.lockon.co.jp/share/");
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑCSV1¹ÔÊÕ¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("UPDATE_CSV_LINE_MAX", 4096);
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑCSV¥«¥é¥à¿ô
+define("UPDATE_CSV_COL_MAX", 13);
+//--------------------------------------------------------------------------------------------------------
+
+define("CLOSE_DAY", 31);	// Äù¤áÆü¤Î»ØÄê(ËöÆü¤Î¾ì¹ç¤Ï¡¢31¤ò»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£)
+
+//°ìÈÌ¥µ¥¤¥È¥¨¥é¡¼
+define("FAVORITE_ERROR", 13);
+
+//¤ª¤¹¤¹¤á¾¦ÉÊ¿ô
+define ("RECOMMEND_PRODUCT_MAX", 4);
+
+/** ¥°¥é¥Õ´ØÏ¢ **/
+	
+define("LIB_DIR", ROOT_DIR . "data/lib/");						// ¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥¹
+define("TTF_DIR", ROOT_DIR . "data/fonts/");					// ¥Õ¥©¥ó¥È¤Î¥Ñ¥¹
+define("GRAPH_DIR", ROOT_DIR . "html/upload/graph_image/");		// ¥°¥é¥Õ³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+define("GRAPH_URL", "/upload/graph_image/");					// ¥°¥é¥ÕURL
+define("GRAPH_PIE_MAX", 10);									// ±ß¥°¥é¥ÕºÇÂçÉ½¼¨¿ô
+define("GRAPH_LABEL_MAX", 40);									// ¥°¥é¥Õ¤Î¥é¥Ù¥ë¤ÎÊ¸»ú¿ô
+
+/** ¥Ñ¥¹´ØÏ¢ **/
+
+define("PDF_DIR", ROOT_DIR . "data/pdf/");	// PDF³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+
+/** Çä¾å¤²½¸·× **/
+
+define("BAT_ORDER_AGE", 70);		// ²¿ºÐ¤Þ¤Ç½¸·×¤ÎÂÐ¾Ý¤È¤¹¤ë¤«
+define("PRODUCTS_TOTAL_MAX", 15);	// ¾¦ÉÊ½¸·×¤Ç²¿°Ì¤Þ¤ÇÉ½¼¨¤¹¤ë¤«
+
+/** ¥Ç¥Õ¥©¥ë¥ÈÃÍ **/
+define("DEFAULT_PRODUCT_DISP", 2);	// 1:¸ø³« 2:Èó¸ø³«
+
+/** ¥ª¥×¥·¥ç¥óÀßÄê **/
+define("DELIV_FREE_AMOUNT", 0);				// Á÷ÎÁÌµÎÁ¹ØÆþ¸Ä¿ô¡Ê0¤Î¾ì¹ç¤Ï¡¢²¿¸ÄÇã¤Ã¤Æ¤âÌµÎÁ¤Ë¤Ê¤é¤Ê¤¤)
+define("INPUT_DELIV_FEE", 1);				// ÇÛÁ÷ÎÁ¤ÎÀßÄê²èÌÌÉ½¼¨(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_PRODUCT_DELIV_FEE", 0);		// ¾¦ÉÊ¤´¤È¤ÎÁ÷ÎÁÀßÄê(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_DELIV_FEE", 1);				// ÇÛÁ÷¶È¼Ô¤´¤È¤ÎÇÛÁ÷ÎÁ¤ò²Ã»»¤¹¤ë(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_RECOMMEND", 1);		// ¤ª¤¹¤¹¤á¾¦ÉÊÅÐÏ¿(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_CLASS_REGIST", 1);	// ¾¦ÉÊµ¬³ÊÅÐÏ¿(Í­¸ú:1 Ìµ¸ú:0)
+
+define("TV_IMAGE_WIDTH",170);		//TVÏ¢Æ°¾¦ÉÊ²èÁü²£
+define("TV_IMAGE_HEIGHT",95);		//TVÏ¢Æ°¾¦ÉÊ²èÁü½Ä
+define("TV_PRODUCTS_MAX",10);		//TVÏ¢Æ°¾¦ÉÊºÇÂçÅÐÏ¿¿ô
+
+/** ¥ª¥×¥·¥ç¥óÀßÄê **/
+
+
+
+//²ñ°÷ÅÐÏ¿ÊÑ¹¹(¥Þ¥¤¥Ú¡¼¥¸)¥Ñ¥¹¥ï¡¼¥ÉÍÑ
+define("DEFAULT_PASSWORD", "UAhgGR3L");
+//ÊÌ¤Î¤ªÆÏ¤±ÀèºÇÂçÅÐÏ¿¿ô
+define("DELIV_ADDR_MAX", 20);
+//¥Þ¥¤¥Ú¡¼¥¸¤ªÆÏ¤±ÀèURL
+define("MYPAGE_DELIVADDR_URL", "/mypage/delivery.php");
+//±ÜÍ÷ÍúÎòÊÝÂ¸¿ô
+define("CUSTOMER_READING_MAX",30);
+//SSLURLÈ½Äê
+define("SSLURL_CHECK", 0);
+//´ÉÍý²èÌÌ¥¹¥Æ¡¼¥¿¥¹°ìÍ÷É½¼¨·ï¿ô
+define("ORDER_STATUS_MAX", 50);
+//¥Õ¥í¥ó¥È¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ßºÇÂç¿ô
+define("REVIEW_REGIST_MAX", 5);
+
+/*
+ * ¥µ¥¤¥ÈÄêµÁÄê¿ô
+ */
+/* ¥·¥¹¥Æ¥à´ØÏ¢ */
+define ("LOGIN_FRAME", "login_frame.tpl");				// ¥í¥°¥¤¥ó²èÌÌ¥Õ¥ì¡¼¥à
+define ("MAIN_FRAME", "main_frame.tpl");				// ´ÉÍý²èÌÌ¥Õ¥ì¡¼¥à
+define ("SITE_FRAME", "site_frame.tpl");				// °ìÈÌ¥µ¥¤¥È²èÌÌ¥Õ¥ì¡¼¥à
+define ("CERT_STRING", "7WDhcBTF");						// Ç§¾ÚÊ¸»úÎó
+define ("ADMIN_ID", "1");								// ´ÉÍý¥æ¡¼¥¶ID(¥á¥ó¥Æ¥Ê¥ó¥¹ÍÑÉ½¼¨¤µ¤ì¤Ê¤¤¡£)
+define ("DUMMY_PASS", "########");						// ¥À¥ß¡¼¥Ñ¥¹¥ï¡¼¥É
+define ("UNLIMITED", "++");								// ºß¸Ë¿ô¡¢ÈÎÇäÀ©¸ÂÌµ¸Â¤ò¼¨¤¹¡£
+define ("BIRTH_YEAR", 1901);							// À¸Ç¯·îÆüÅÐÏ¿³«»ÏÇ¯
+define ("RELEASE_YEAR", 2005);							// ËÜ¥·¥¹¥Æ¥à¤Î²ÔÆ¯³«»ÏÇ¯
+define ("CREDIT_ADD_YEAR", 10);							// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤Î´ü¸Â¡Ü²¿Ç¯
+define ("PARENT_CAT_MAX", 12);							// ¿Æ¥«¥Æ¥´¥ê¤Î¥«¥Æ¥´¥êID¤ÎºÇÂç¿ô¡Ê¤³¤ì°Ê²¼¤Ï¿Æ¥«¥Æ¥´¥ê¤È¤¹¤ë¡£)
+define ("NUMBER_MAX", 1000000000);						// GETÃÍÊÑ¹¹¤Ê¤É¤Î¤¤¤¿¤º¤é¤òËÉ¤°¤¿¤áºÇÂç¿ôÀ©¸Â¤òÀß¤±¤ë¡£
+define ("POINT_RULE", 2);								// ¥Ý¥¤¥ó¥È¤Î·×»»¥ë¡¼¥ë(1:»Í¼Î¸ÞÆþ¡¢2:ÀÚ¤ê¼Î¤Æ¡¢3:ÀÚ¤ê¾å¤²)
+define ("POINT_VALUE", 1);								// 1¥Ý¥¤¥ó¥ÈÅö¤¿¤ê¤ÎÃÍÃÊ(±ß)
+define ("ADMIN_MODE", 0);								// ´ÉÍý¥â¡¼¥É 1:Í­¸ú¡¡0:Ìµ¸ú(Ç¼ÉÊ»þ)
+
+define ("FORGOT_MAIL", 0);								// ¥Ñ¥¹¥ï¡¼¥ÉËº¤ì¤Î³ÎÇ§¥á¡¼¥ë¤òÁ÷ÉÕ¤¹¤ë¤«ÈÝ¤«¡£(0:Á÷¿®¤·¤Ê¤¤¡¢1:Á÷¿®¤¹¤ë)
+define ("HTML_TEMPLATE_SUB_MAX", 12);					// ÅÐÏ¿¤Ç¤­¤ë¥µ¥Ö¾¦ÉÊ¤Î¿ô
+define ("LINE_LIMIT_SIZE", 60);							// Ê¸»ú¿ô¤¬Â¿¤¹¤®¤ë¤È¤­¤Ë¶¯À©²þ¹Ô¤¹¤ë¥µ¥¤¥º(È¾³Ñ)
+define ("BIRTH_MONTH_POINT", 100);						// ÃÂÀ¸Æü·î¥Ý¥¤¥ó¥È
+define ("INPUT_DELIV_FEE", true);						// ÇÛÁ÷ÎÁ¤ÎÀßÄê²èÌÌ(true:¤¢¤ê¡¢false:¤Ê¤·)
+
+/* ¥¯¥ì¥¸¥Ã¥È¥í¡¼¥ó(¥»¥ó¥È¥é¥ë¥Õ¥¡¥¤¥Ê¥ó¥¹) */
+define ("CF_HOMEADDR", "https://cf.ufit.ne.jp/dotcredit");					// ¥Û¡¼¥à¥¢¥É¥ì¥¹
+define ("CF_STORECODE", "361901000000000");									// ²ÃÌÁÅ¹¥³¡¼¥É(¥Ï¥¤¥Õ¥ó¤Ê¤·¤Ç¡Ë
+// define ("CF_HOMEADDR", "https://cf.ufit.ne.jp/dotcredittest");				// ¥Û¡¼¥à¥¢¥É¥ì¥¹(¥Æ¥¹¥ÈÍÑ)
+// define ("CF_STORECODE", "111111111111111");									// ²ÃÌÁÅ¹¥³¡¼¥É(¥Æ¥¹¥ÈÍÑ)
+
+define ("CF_SIMULATE", "/simulate/simulate.cgi");							// ¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·
+define ("CF_RETURNURL", SSL_URL . "shopping/loan.php");						// Ìá¤êÀè
+define ("CF_CANCELURL", SSL_URL . "shopping/loan_cancel.php");				// Ìá¤êÀè
+define ("CF_CONTINUE", "1");												// ¸Æ¤Ó½Ð¤·¶èÊ¬(0:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¤Î¤ß¡¢1:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó+¿½¹þ)
+define ("CF_LABOR", "0");													// ÌòÌ³Í­Ìµ¶èÊ¬(0:Ìµ¡¢1:Í­)
+define ("CF_RESULT", "1");													// ·ë²Ì±þÅú(1:·ë²Ì¤¢¤ê¡¢2:·ë²Ì¤Ê¤·)
+
+/* ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É(¥Ù¥ê¥È¥é¥ó¥¹) */
+define ("CGI_DIR", ROOT_DIR . "cgi-bin/");									// ¥â¥¸¥å¡¼¥ë³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+define ("CGI_FILE", "mauthonly.cgi");										// ¥³¥¢CGI
+
+// ¥ë¡¼¥È¥«¥Æ¥´¥êID
+define ("ROOT_CATEGORY_1", 2);
+define ("ROOT_CATEGORY_2", 3);
+define ("ROOT_CATEGORY_3", 4);
+define ("ROOT_CATEGORY_4", 5);
+define ("ROOT_CATEGORY_5", 6);
+define ("ROOT_CATEGORY_6", 7);
+define ("ROOT_CATEGORY_7", 8);
+
+// ¤ª»ÙÊ§¤¤ÊýË¡ÆÃ¼ìID
+define ("PAYMENT_DAIBIKI_ID",1);		// Âå¶â°ú´¹
+define ("PAYMENT_GINFURI_ID", 2);		// ¶ä¹Ô¿¶¹þ
+define ("PAYMENT_KAKITOME_ID", 3);		// ¸½¶â½ñÎ±
+define ("PAYMENT_CREDIT_ID",4);			// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É
+define ("PAYMENT_LOAN_ID", 5);			// ¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó
+define ("PAYMENT_CONVENIENCE_ID", 6);	// ¥³¥ó¥Ó¥Ë·èºÑ
+
+define("LARGE_IMAGE_WIDTH",  500);						// ³ÈÂç²èÁü²£
+define("LARGE_IMAGE_HEIGHT", 500);						// ³ÈÂç²èÁü½Ä
+define("SMALL_IMAGE_WIDTH",  130);						// °ìÍ÷²èÁü²£
+define("SMALL_IMAGE_HEIGHT", 130);						// °ìÍ÷²èÁü½Ä
+define("NORMAL_IMAGE_WIDTH",  260);						// ÄÌ¾ï²èÁü²£
+define("NORMAL_IMAGE_HEIGHT", 260);						// ÄÌ¾ï²èÁü½Ä
+define("NORMAL_SUBIMAGE_WIDTH", 130);					// ÄÌ¾ï¥µ¥Ö²èÁü²£
+define("NORMAL_SUBIMAGE_HEIGHT", 130);					// ÄÌ¾ï¥µ¥Ö²èÁü½Ä
+define("LARGE_SUBIMAGE_WIDTH", 500);					// ³ÈÂç¥µ¥Ö²èÁü²£
+define("LARGE_SUBIMAGE_HEIGHT", 500);					// ³ÈÂç¥µ¥Ö²èÁü½Ä
+define("DISP_IMAGE_WIDTH",  65);						// °ìÍ÷É½¼¨²èÁü²£
+define("DISP_IMAGE_HEIGHT", 65);						// °ìÍ÷É½¼¨²èÁü½Ä
+define("OTHER_IMAGE1_WIDTH", 500);						// ¤½¤ÎÂ¾¤Î²èÁü1
+define("OTHER_IMAGE1_HEIGHT", 500);						// ¤½¤ÎÂ¾¤Î²èÁü1
+define("HTMLMAIL_IMAGE_WIDTH",  110);					// HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ëÃ´Åö²èÁü²£
+define("HTMLMAIL_IMAGE_HEIGHT", 120);					//  HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ëÃ´Åö²èÁü½Ä
+
+define("IMAGE_SIZE", 100);								// ²èÁü¥µ¥¤¥ºÀ©¸Â(KB)
+define("CSV_SIZE", 2000);								// CSV¥µ¥¤¥ºÀ©¸Â(KB)
+define("PDF_SIZE", 5000);								// PDF¥µ¥¤¥ºÀ©¸Â(KB):¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ëÅù
+define("LEVEL_MAX", 3);									// ¥«¥Æ¥´¥ê¤ÎºÇÂç³¬ÁØ
+define("CATEGORY_MAX", 1000);							// ºÇÂç¥«¥Æ¥´¥êÅÐÏ¿¿ô
+
+/* É½¼¨´ØÏ¢ */
+define ("ADMIN_TITLE", "EC¥µ¥¤¥È´ÉÍý¥Ú¡¼¥¸");			// ´ÉÍý¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+define ("SELECT_RGB", "#ffffdf");						// ÊÔ½¸»þ¶¯Ä´É½¼¨¿§
+define ("DISABLED_RGB", "#dddddd");						// ÆþÎÏ¹àÌÜÌµ¸ú»þ¤ÎÉ½¼¨¿§
+define ("ERR_COLOR", "#ffe8e8");						// ¥¨¥é¡¼»þÉ½¼¨¿§
+define ("CATEGORY_HEAD", "¢£");							// ¿Æ¥«¥Æ¥´¥êÉ½¼¨Ê¸»ú
+define ("START_BIRTH_YEAR", 1901);						// À¸Ç¯·îÆüÁªÂò³«»ÏÇ¯
+
+/* ¥·¥¹¥Æ¥à¥Ñ¥¹ */
+define ("LOG_PATH", ROOT_DIR . "data/logs/site.log");							// ¥í¥°¥Õ¥¡¥¤¥ë
+define ("CUSTOMER_LOG_PATH", ROOT_DIR . "data/logs/customer.log");				// ²ñ°÷¥í¥°¥¤¥ó ¥í¥°¥Õ¥¡¥¤¥ë
+define ("TEMPLATE_ADMIN_DIR", ROOT_DIR . "data/Smarty/templates/admin");		// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define ("TEMPLATE_DIR", ROOT_DIR . "data/Smarty/templates");					// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define ("COMPILE_ADMIN_DIR", ROOT_DIR . "data/Smarty/templates_c/admin");		// SMARTY¥³¥ó¥Ñ¥¤¥ë
+define ("COMPILE_DIR", ROOT_DIR . "data/Smarty/templates_c");					// SMARTY¥³¥ó¥Ñ¥¤¥ë
+
+define ("TEMPLATE_FTP_DIR", ROOT_DIR . "html/user_data/templates/");			// SMARTY¥Æ¥ó¥×¥ì¡¼¥È(FTPµö²Ä)
+define ("COMPILE_FTP_DIR", ROOT_DIR . "data/Smarty/templates_c/user_data/");	// SMARTY¥³¥ó¥Ñ¥¤¥ë
+
+define ("IMAGE_TEMP_DIR", ROOT_DIR . "html/upload/temp_image/");				// ²èÁü°ì»þÊÝÂ¸
+define ("IMAGE_SAVE_DIR", ROOT_DIR . "html/upload/save_image/");				// ²èÁüÊÝÂ¸Àè
+define ("IMAGE_TEMP_URL", "/upload/temp_image/");								// ²èÁü°ì»þÊÝÂ¸URL
+define ("IMAGE_SAVE_URL", "/upload/save_image/");								// ²èÁüÊÝÂ¸ÀèURL
+define ("CSV_TEMP_DIR", ROOT_DIR. "html/upload/csv/");							// ¥¨¥ó¥³¡¼¥ÉCSV¤Î°ì»þÊÝÂ¸Àè
+define ("NO_IMAGE_URL", "/misc/dummy.gif");										// ²èÁü¤¬¤Ê¤¤¾ì¹ç¤ËÉ½¼¨
+
+/* URL¥Ñ¥¹ */
+define ("URL_SYSTEM_TOP", "/admin/system/index.php");		// ¥·¥¹¥Æ¥à´ÉÍý¥È¥Ã¥×
+define ("URL_CLASS_REGIST", "/admin/products/class.php");	// µ¬³ÊÅÐÏ¿
+define ("URL_INPUT_ZIP", "/input_zip.php");			// Í¹ÊØÈÖ¹æÆþÎÏ
+define ("URL_DELIVERY_TOP", "/admin/basis/delivery.php");	// ÇÛÁ÷¶È¼ÔÅÐÏ¿
+define ("URL_PAYMENT_TOP", "/admin/basis/payment.php");		// »ÙÊ§¤¤ÊýË¡ÅÐÏ¿
+define ("URL_HOME", "/admin/home.php");						// ¥Û¡¼¥à
+define ("URL_LOGIN", "/admin/index.php");					// ¥í¥°¥¤¥ó¥Ú¡¼¥¸
+define ("URL_SEARCH_TOP", "/admin/products/index.php");		// ¾¦ÉÊ¸¡º÷¥Ú¡¼¥¸
+define ("URL_ORDER_EDIT", "/admin/order/edit.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_SEARCH_ORDER", "/admin/order/index.php");		// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_ORDER_MAIL", "/admin/order/mail.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_LOGOUT", "/admin/logout.php");					// ¥í¥°¥¢¥¦¥È¥Ú¡¼¥¸
+define ("URL_SYSTEM_CSV", "/admin/system/member_csv.php");	// ¥·¥¹¥Æ¥à´ÉÍýCSV½ÐÎÏ¥Ú¡¼¥¸
+define ("URL_SYSTEM_TOP", "/admin/system/index.php");		// ¥·¥¹¥Æ¥à´ÉÍýTOP¥Ú¡¼¥¸
+define ("URL_ADMIN_CSS", "/admin/css/");					// ´ÉÍý¥Ú¡¼¥¸ÍÑCSSÊÝ´É¥Ç¥£¥ì¥¯¥È¥ê
+
+/* Ç§¾Ú¥¨¥é¡¼ */
+define ("SUCCESS", 0);			// ¥¢¥¯¥»¥¹À®¸ù
+define ("LOGIN_ERROR", 1);		// ¥í¥°¥¤¥ó¼ºÇÔ
+define ("ACCESS_ERROR", 2);		// ¥¢¥¯¥»¥¹¼ºÇÔ¡Ê¥¿¥¤¥à¥¢¥¦¥ÈÅù¡Ë
+define ("AUTH_ERROR", 3);		// ¥¢¥¯¥»¥¹¸¢¸Â°ãÈ¿
+
+/* É½¼¨¿ôÀ©¸Â */
+define ("PRODUCTS_LIST_MAX", 15);	// ¾¦ÉÊ°ìÍ÷É½¼¨¿ô
+define ("MEMBER_PMAX", 10);			// ¥á¥ó¥Ð¡¼´ÉÍý¥Ú¡¼¥¸É½¼¨¹Ô¿ô
+define ("SEARCH_PMAX", 10);			// ¸¡º÷¥Ú¡¼¥¸É½¼¨¹Ô¿ô
+define ("NAVI_PMAX", 5);			// ¥Ú¡¼¥¸ÈÖ¹æ¤ÎºÇÂçÉ½¼¨¸Ä¿ô
+define ("PRODUCTSUB_MAX", 5);		// ¾¦ÉÊ¥µ¥Ö¾ðÊóºÇÂç¿ô
+define ("DELIVTIME_MAX", 16);		// ÇÛÁ÷»þ´Ö¤ÎºÇÂçÉ½¼¨¿ô
+define ("DELIVFEE_MAX", 47);		// ÇÛÁ÷ÎÁ¶â¤ÎºÇÂçÉ½¼¨¿ô
+
+/* Ê¸»ú¿ôÀ©¸Â */
+define ("STEXT_LEN", 50);		// Ã»¤¤¹àÌÜ¤ÎÊ¸»ú¿ô¡ÊÌ¾Á°¤Ê¤É)
+define ("SMTEXT_LEN", 100);
+define ("MTEXT_LEN", 200);		// Ä¹¤¤¹àÌÜ¤ÎÊ¸»ú¿ô¡Ê½»½ê¤Ê¤É¡Ë
+define ("MLTEXT_LEN", 1000);	// Ä¹ÃæÊ¸¤ÎÊ¸»ú¿ô¡ÊÌä¤¤¹ç¤ï¤»¤Ê¤É¡Ë
+define ("LTEXT_LEN", 3000);		// Ä¹Ê¸¤ÎÊ¸»ú¿ô
+define ("LLTEXT_LEN", 99999);	// Ä¶Ä¹Ê¸¤ÎÊ¸»ú¿ô¡Ê¥á¥ë¥Þ¥¬¤Ê¤É¡Ë
+define ("URL_LEN", 300);		// URL¤ÎÊ¸»úÄ¹
+define("ID_MAX_LEN", 15);		// ID¡¦¥Ñ¥¹¥ï¡¼¥É¤ÎÊ¸»ú¿ôÀ©¸Â
+define("ID_MIN_LEN", 4);		// ID¡¦¥Ñ¥¹¥ï¡¼¥É¤ÎÊ¸»ú¿ôÀ©¸Â
+define("PRICE_LEN", 8);			// ¶â³Û·å¿ô
+define("PERCENTAGE_LEN", 3);	// Î¨·å¿ô
+define("AMOUNT_LEN", 6);		// ºß¸Ë¿ô¡¢ÈÎÇäÀ©¸Â¿ô
+define("ZIP01_LEN", 3);			// Í¹ÊØÈÖ¹æ1
+define("ZIP02_LEN", 4);			// Í¹ÊØÈÖ¹æ2
+define("TEL_ITEM_LEN", 6);		// ÅÅÏÃÈÖ¹æ³Æ¹àÌÜÀ©¸Â
+define("TEL_LEN", 12);			// ÅÅÏÃÈÖ¹æÁí¿ô
+define("PASSWORD_LEN1", 4);		// ¥Ñ¥¹¥ï¡¼¥É1
+define("PASSWORD_LEN2", 10);	// ¥Ñ¥¹¥ï¡¼¥É2
+define("INT_LEN", 8);			// ¸¡ºº¿ôÃÍÍÑ·å¿ô(INT)
+define("CREDIT_NO_LEN", 4);		// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤ÎÊ¸»ú¿ô
+define("SEARCH_CATEGORY_LEN", 18);	// ¸¡º÷¥«¥Æ¥´¥êºÇÂçÉ½¼¨Ê¸»ú¿ô(byte)
+
+/** ¥Õ¥í¥ó¥È¥Ú¡¼¥¸ **/
+
+/* ¥·¥¹¥Æ¥à´ØÏ¢ */
+define ("SALE_LIMIT_MAX", 10);		// ¹ØÆþÀ©¸Â¤Ê¤·¤Î¾ì¹ç¤ÎºÇÂç¹ØÆþ¸Ä¿ô
+define ("SITE_TITLE", "£Å£Ã-£Ã£Õ£Â£Å  ¥Æ¥¹¥È¥µ¥¤¥È");	// HTML¥¿¥¤¥È¥ë
+define ("COOKIE_EXPIRE", 365);		// ¥¯¥Ã¥­¡¼ÊÝ»ý´ü¸Â(Æü)
+define ("FREE_DIAL", "0120-339337");
+
+/* °ìÈÌ¥µ¥¤¥È¥¨¥é¡¼ */
+define ("PRODUCT_NOT_FOUND", 1);	// »ØÄê¾¦ÉÊ¥Ú¡¼¥¸¤¬¤Ê¤¤
+define ("CART_EMPTY", 2);			// ¥«¡¼¥ÈÆâ¤¬¶õ
+define ("PAGE_ERROR", 3);			// ¥Ú¡¼¥¸¿ä°Ü¥¨¥é¡¼
+define ("CART_ADD_ERROR", 4);		// ¹ØÆþ½èÍýÃæ¤Î¥«¡¼¥È¾¦ÉÊÄÉ²Ã¥¨¥é¡¼
+define ("CANCEL_PURCHASE", 5);		// Â¾¤Ë¤â¹ØÆþ¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿¾ì¹ç
+define ("CATEGORY_NOT_FOUND", 6);	// »ØÄê¥«¥Æ¥´¥ê¥Ú¡¼¥¸¤¬¤Ê¤¤
+define ("SITE_LOGIN_ERROR", 7);		// ¥í¥°¥¤¥ó¤Ë¼ºÇÔ
+define ("CUSTOMER_ERROR", 8);		// ²ñ°÷ÀìÍÑ¥Ú¡¼¥¸¤Ø¤Î¥¢¥¯¥»¥¹¥¨¥é¡¼
+define ("SOLD_OUT", 9);				// ¹ØÆþ»þ¤ÎÇä¤êÀÚ¤ì¥¨¥é¡¼
+define ("CART_NOT_FOUND", 10);		// ¥«¡¼¥ÈÆâ¾¦ÉÊ¤ÎÆÉ¹þ¥¨¥é¡¼
+define ("LACK_POINT", 11);			// ¥Ý¥¤¥ó¥È¤ÎÉÔÂ­
+define ("TEMP_LOGIN_ERROR", 12);	// ²¾ÅÐÏ¿¼Ô¤¬¥í¥°¥¤¥ó¤Ë¼ºÇÔ
+define ("URL_ERROR", 13);			// URL¥¨¥é¡¼
+define ("EXTRACT_ERROR", 14);		//¥Õ¥¡¥¤¥ë²òÅà¥¨¥é¡¼
+define ("FTP_DOWNLOAD_ERROR", 15);	//FTP¥À¥¦¥ó¥í¡¼¥É¥¨¥é¡¼
+define ("FTP_LOGIN_ERROR", 16);		//FTP¥í¥°¥¤¥ó¥¨¥é¡¼
+define ("FTP_CONNECT_ERROR", 17);	//FTPÀÜÂ³¥¨¥é¡¼
+define ("CREATE_DB_ERROR", 18);		//DBºîÀ®¥¨¥é¡¼
+define ("DB_IMPORT_ERROR", 19);		//DB¥¤¥ó¥Ý¡¼¥È¥¨¥é¡¼
+define ("FILE_NOT_FOUND", 20);		//ÀßÄê¥Õ¥¡¥¤¥ëÂ¸ºß¥¨¥é¡¼
+define ("WRITE_FILE_ERROR", 21);	//¥Õ¥¡¥¤¥ë½ñ¤­¹þ¤ß¥¨¥é¡¼
+
+/* É½¼¨´ØÏ¢ */
+define ("SEPA_CATNAVI", " > ");	// ¥«¥Æ¥´¥ê¶èÀÚ¤êÊ¸»ú
+define ("SEPA_CATLIST", " | ");	// ¥«¥Æ¥´¥ê¶èÀÚ¤êÊ¸»ú
+
+/* URL */
+define ("URL_SITE_TOP", "/index.php");					// ¥µ¥¤¥È¥È¥Ã¥×
+define ("URL_CART_TOP", "/cart/index.php");				// ¥«¡¼¥È¥È¥Ã¥×
+define ("URL_SHOP_CONFIRM", "/shopping/confirm.php");	// ¹ØÆþ³ÎÇ§¥Ú¡¼¥¸
+define ("URL_SHOP_PAYMENT", "/shopping/payment.php");	// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸
+define ("URL_SHOP_TOP", "/shopping/index.php");			// ²ñ°÷¾ðÊóÆþÎÏ
+define ("URL_SHOP_COMPLETE", "/shopping/complete.php");	// ¹ØÆþ´°Î»²èÌÌ
+define ("URL_SHOP_CREDIT", "/shopping/card.php");		// ¥«¡¼¥É·èºÑ²èÌÌ
+define ("URL_SHOP_LOAN", "/shopping/loan.php");			// ¥í¡¼¥ó·èºÑ²èÌÌ
+define ("URL_SHOP_CONVENIENCE", "/shopping/convenience.php");	// ¥³¥ó¥Ó¥Ë·èºÑ²èÌÌ
+define ("URL_PRODUCTS_TOP","/products/top.php");		// ¾¦ÉÊ¥È¥Ã¥×
+define ("LIST_P_HTML", "/products/list-p");				// ¾¦ÉÊ°ìÍ÷(HTML½ÐÎÏ)
+define ("LIST_C_HTML", "/products/list.php?mode=search&category_id=");				// ¾¦ÉÊ°ìÍ÷(HTML½ÐÎÏ)
+define ("DETAIL_P_HTML", "/products/detail.php?product_id=");			// ¾¦ÉÊ¾ÜºÙ(HTML½ÐÎÏ)
+
+/*
+ * ¥µ¥¤¥ÈÄêµÁÊÑ¿ô
+ */
+ 
+// ¥¢¥¯¥»¥¹¸¢¸Â
+// 0:´ÉÍý¼Ô¤Î¤ß¥¢¥¯¥»¥¹²ÄÇ½
+// 1:°ìÈÌ°Ê¾å¤¬¥¢¥¯¥»¥¹²ÄÇ½
+$arrPERMISSION[URL_SYSTEM_TOP] = 0;
+$arrPERMISSION["/admin/system/delete.php"] = 0;
+$arrPERMISSION["/admin/system/index.php"] = 0;
+$arrPERMISSION["/admin/system/input.php"] = 0;
+$arrPERMISSION["/admin/system/master.php"] = 0;
+$arrPERMISSION["/admin/system/master_delete.php"] = 0;
+$arrPERMISSION["/admin/system/master_rank.php"] = 0;
+$arrPERMISSION["/admin/system/mastercsv.php"] = 0;
+$arrPERMISSION["/admin/system/rank.php"] = 0;
+$arrPERMISSION["/admin/entry/index.php"] = 1;
+$arrPERMISSION["/admin/entry/delete.php"] = 1;
+$arrPERMISSION["/admin/entry/inputzip.php"] = 1;
+$arrPERMISSION["/admin/search/delete_note.php"] = 1;
+
+// ¥í¥°¥¢¥¦¥ÈÉÔ²Ä¥Ú¡¼¥¸
+$arrDISABLE_LOGOUT = array(
+	1 => "/shopping/deliv.php",
+	2 => "/shopping/payment.php",
+	3 => "/shopping/confirm.php",
+	4 => "/shopping/card.php",
+	5 => "/shopping/loan.php",
+);
+
+// ¥á¥ó¥Ð¡¼´ÉÍý-¸¢¸Â
+$arrAUTHORITY[0] = "´ÉÍý¼Ô";
+// $arrAUTHORITY[1] = "°ìÈÌ";
+// $arrAUTHORITY[2] = "±ÜÍ÷";
+
+// ¥á¥ó¥Ð¡¼´ÉÍý-²ÔÆ¯¾õ¶·
+$arrWORK[0] = "Èó²ÔÆ¯";
+$arrWORK[1] = "²ÔÆ¯";
+
+// ¾¦ÉÊÅÐÏ¿-É½¼¨
+$arrDISP[1] = "¸ø³«";
+$arrDISP[2] = "Èó¸ø³«";
+
+// ¾¦ÉÊÅÐÏ¿-µ¬³Ê
+$arrCLASS[1] = "µ¬³ÊÌµ¤·";
+$arrCLASS[2] = "µ¬³ÊÍ­¤ê";
+
+// ¸¡º÷¥é¥ó¥¯
+$arrSRANK[1] = 1;
+$arrSRANK[2] = 2;
+$arrSRANK[3] = 3;
+$arrSRANK[4] = 4;
+$arrSRANK[5] = 5;
+
+// ¾¦ÉÊÅÐÏ¿-¥¹¥Æ¡¼¥¿¥¹
+$arrSTATUS[1] = "NEW";
+$arrSTATUS[2] = "»Ä¤ê¤ï¤º¤«";
+$arrSTATUS[3] = "¥Ý¥¤¥ó¥È£²ÇÜ";
+$arrSTATUS[4] = "¥ª¥¹¥¹¥á";
+$arrSTATUS[5] = "¸ÂÄêÉÊ";
+
+// ¾¦ÉÊÅÐÏ¿-¥¹¥Æ¡¼¥¿¥¹²èÁü
+$arrSTATUS_IMAGE[1] = "/img/right_product/icon01.gif";
+$arrSTATUS_IMAGE[2] = "/img/right_product/icon02.gif";
+$arrSTATUS_IMAGE[3] = "/img/right_product/icon03.gif";
+$arrSTATUS_IMAGE[4] = "/img/right_product/icon04.gif";
+$arrSTATUS_IMAGE[5] = "/img/right_product/icon05.gif";
+
+// ÆþÎÏµö²Ä¤¹¤ë¥¿¥°
+$arrAllowedTag = array(
+	"table",
+	"tr",
+	"td",
+	"a",
+	"b",
+	"blink",
+	"br",
+	"center",
+	"font",
+	"h",
+	"hr",
+	"img",
+	"li",
+	"strong",
+	"p",
+	"div",
+	"i",
+	"u",
+	"s",
+	"/table",
+	"/tr",
+	"/td",
+	"/a",
+	"/b",
+	"/blink",
+	"/br",
+	"/center",
+	"/font",
+	"/h",
+	"/hr",
+	"/img",
+	"/li",
+	"/strong",
+	"/p",
+	"/div",
+	"/i",
+	"/u",
+	"/s"
+);
+
+// £±¥Ú¡¼¥¸É½¼¨¹Ô¿ô
+$arrPageMax = array(
+	10 => "10",
+	20 => "20",
+	30 => "30",
+	40 => "40",
+	50 => "50",
+	60 => "60",
+	70 => "70",
+	80 => "80",
+	90 => "90",
+	100 => "100",
+);	
+	
+// ¥á¥ë¥Þ¥¬¼ïÊÌ
+$arrMagazineType["1"] = "HTML";
+$arrMagazineType["2"] = "¥Æ¥­¥¹¥È";
+
+$arrMagazineTypeAll = $arrMagazineType;
+$arrMagazineTypeAll["3"] = "HTML¥Æ¥ó¥×¥ì¡¼¥È";
+
+
+/* ¥á¥ë¥Þ¥¬¼ïÊÌ */
+$arrMAILMAGATYPE = array(
+	1 => "HTML¥á¡¼¥ë",
+	2 => "¥Æ¥­¥¹¥È¥á¡¼¥ë",
+	3 => "´õË¾¤·¤Ê¤¤"
+);
+
+/* ¤ª¤¹¤¹¤á¥ì¥Ù¥ë */
+$arrRECOMMEND = array(
+	5 => "¡ú¡ú¡ú¡ú¡ú",
+	4 => "¡ú¡ú¡ú¡ú",
+	3 => "¡ú¡ú¡ú",
+	2 => "¡ú¡ú",
+	1 => "¡ú"
+);
+
+$arrTAXRULE = array(
+	1 => "»Í¼Î¸ÞÆþ",
+	2 => "ÀÚ¤ê¼Î¤Æ",
+	3 => "ÀÚ¤ê¾å¤²"
+);
+
+
+// ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¤Î¼ïÎà
+$arrMAILTEMPLATE = array(
+	 1 => "ÃíÊ¸¼õÉÕ¥á¡¼¥ë"
+	,2 => "ÃíÊ¸¥­¥ã¥ó¥»¥ë¼õÉÕ¥á¡¼¥ë"
+	,3 => "¼è¤ê´ó¤»³ÎÇ§¥á¡¼¥ë"
+);
+
+// ³Æ¥Æ¥ó¥×¥ì¡¼¥È¤Î¥Ñ¥¹
+$arrMAILTPLPATH = array(
+	1 => "mail_templates/order_mail.tpl",
+	2 => "mail_templates/order_mail.tpl",
+	3 => "mail_templates/order_mail.tpl",
+	4 => "mail_templates/contact_mail.tpl",
+);
+
+// ¼õÃí¥¹¥Æ¡¼¥¿¥¹ÊÑ¹¹¤ÎºÝ¤Ë¥Ý¥¤¥ó¥ÈÅù¤ò²Ã»»¤¹¤ë¥¹¥Æ¡¼¥¿¥¹ÈÖ¹æ¡ÊÈ¯Á÷ºÑ¤ß¡Ë
+define("ODERSTATUS_COMMIT", 5);
+
+/* ÅÔÆ»ÉÜ¸©ÇÛÎó */
+$arrPref = array(
+					1 => "ËÌ³¤Æ»",
+					2 => "ÀÄ¿¹¸©",
+					3 => "´ä¼ê¸©",
+					4 => "µÜ¾ë¸©",
+					5 => "½©ÅÄ¸©",
+					6 => "»³·Á¸©",
+					7 => "Ê¡Åç¸©",
+					8 => "°ñ¾ë¸©",
+					9 => "ÆÊÌÚ¸©",
+					10 => "·²ÇÏ¸©",
+					11 => "ºë¶Ì¸©",
+					12 => "ÀéÍÕ¸©",
+					13 => "ÅìµþÅÔ",
+					14 => "¿ÀÆàÀî¸©",
+					15 => "¿·³ã¸©",
+					16 => "ÉÙ»³¸©",
+					17 => "ÀÐÀî¸©",
+					18 => "Ê¡°æ¸©",
+					19 => "»³Íü¸©",
+					20 => "Ä¹Ìî¸©",
+					21 => "´ôÉì¸©",
+					22 => "ÀÅ²¬¸©",
+					23 => "°¦ÃÎ¸©",
+					24 => "»°½Å¸©",
+					25 => "¼¢²ì¸©",
+					26 => "µþÅÔÉÜ",
+					27 => "ÂçºåÉÜ",
+					28 => "Ê¼¸Ë¸©",
+					29 => "ÆàÎÉ¸©",
+					30 => "ÏÂ²Î»³¸©",
+					31 => "Ä»¼è¸©",
+					32 => "Åçº¬¸©",
+					33 => "²¬»³¸©",
+					34 => "¹­Åç¸©",
+					35 => "»³¸ý¸©",
+					36 => "ÆÁÅç¸©",
+					37 => "¹áÀî¸©",
+					38 => "°¦É²¸©",
+					39 => "¹âÃÎ¸©",
+					40 => "Ê¡²¬¸©",
+					41 => "º´²ì¸©",
+					42 => "Ä¹ºê¸©",
+					43 => "·§ËÜ¸©",
+					44 => "ÂçÊ¬¸©",
+					45 => "µÜºê¸©",
+					46 => "¼¯»ùÅç¸©",
+					47 => "²­Æì¸©"
+				);
+				
+/* ¿¦¶ÈÇÛÎó */
+$arrJob = array(
+					1 => "²ñ¼Ò°÷",
+					2 => "¶µ¿¦",
+					3 => "¸øÌ³°÷",
+					4 => "ÀìÌç¶È¡¦µ»½Ñ¿¦",
+					5 => "¥µ¡¼¥Ó¥¹¶È",
+					6 => "¼«±Ä¶È",
+					7 => "³ØÀ¸",
+					8 => "¼çÉØ",
+					9 => "¤½¤ÎÂ¾"
+				);
+
+/* ¥Ñ¥¹¥ï¡¼¥É¤ÎÅú¤¨ÇÛÎó */
+$arrReminder = array(
+						1 => "Êì¿Æ¤ÎµìÀ«¤Ï¡©",
+						2 => "¤ªµ¤¤ËÆþ¤ê¤Î¥Þ¥ó¥¬¤Ï¡©",
+						3 => "Âç¹¥¤­¤Ê¥Ú¥Ã¥È¤ÎÌ¾Á°¤Ï¡©",
+						4 => "½éÎø¤Î¿Í¤ÎÌ¾Á°¤Ï¡©",
+						5 => "ÌÌÇò¤«¤Ã¤¿±Ç²è¤Ï¡©",
+						6 => "Âº·É¤·¤Æ¤¤¤¿ÀèÀ¸¤ÎÌ¾Á°¤Ï¡©",
+						7 => "¹¥¤­¤Ê¿©¤ÙÊª¤Ï¡©"
+					);
+/*¡¡À­ÊÌÇÛÎó¡¡*/
+$arrSex = array(
+					1 => "ÃËÀ­",
+					2 => "½÷À­"
+				);
+
+/*¡¡1¹Ô¿ô¡¡*/		
+$arrPageRows = array(
+						10 => 10,
+						20 => 20,
+						30 => 30,
+						40 => 40,
+						50 => 50,
+						60 => 60,
+						70 => 70,
+						80 => 80,
+						90 => 90,
+						100 => 100,
+					);
+		
+/* ¼õÃí¥¹¥Æ¡¼¥¿¥¹ */
+$arrORDERSTATUS = array(
+	1 => "¿·µ¬¼õÉÕ",
+	2 => "Æþ¶âÂÔ¤Á",
+	3 => "¥­¥ã¥ó¥»¥ë",
+	4 => "¼è¤ê´ó¤»Ãæ",
+	5 => "È¯Á÷ºÑ¤ß"
+);
+
+// ¼õÃí¥¹¥Æ¡¼¥¿¥¹ÊÑ¹¹¤ÎºÝ¤Ë¥Ý¥¤¥ó¥ÈÅù¤ò²Ã»»¤¹¤ë¥¹¥Æ¡¼¥¿¥¹ÈÖ¹æ¡ÊÈ¯Á÷ºÑ¤ß¡Ë
+define("ODERSTATUS_COMMIT", 5);
+
+/* ¾¦ÉÊ¼ïÊÌ¤ÎÉ½¼¨¿§ */
+$arrPRODUCTSTATUS_COLOR = array(
+	1 => "#FFFFFF",
+	2 => "#DDDDDD",
+	3 => "#DDE6F2"
+);
+
+$arrORDERSTATUS_COLOR = array(
+	1 => "#FFFFFF",
+	2 => "#FFFFB3",
+	3 => "#AAAAAA",
+	4 => "#EEC1FD",
+	5 => "#DBFDE3"
+);
+
+// ÍËÆü
+$arrWDAY = array(
+	0 => "Æü",
+	1 => "·î",
+	2 => "²Ð",
+	3 => "¿å",
+	4 => "ÌÚ",
+	5 => "¶â",
+	6 => "ÅÚ"
+);			
+		
+/* ¿·Ãå¾ðÊó´ÉÍý²èÌÌ */
+define ("ADMIN_NEWS_STARTYEAR", 2005);	// ³«»ÏÇ¯(À¾Îñ)
+
+/* ²ñ°÷ÅÐÏ¿ */
+define("ENTRY_CUSTOMER_TEMP_SUBJECT", "²ñ°÷²¾ÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£");
+define("ENTRY_CUSTOMER_REGIST_SUBJECT", "ËÜ²ñ°÷ÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£");
+define("ENTRY_LIMIT_HOUR", 1);		//ºÆÆþ²ñÀ©¸Â»þ´Ö¡ÊÃ±°Ì: »þ´Ö)
+
+// ¥ª¥¹¥¹¥á¾¦ÉÊÉ½¼¨¿ô
+define("RECOMMEND_NUM", 8);			// ¥ª¥¹¥¹¥á¾¦ÉÊ
+define ("BEST_MAX", 5);				// ¥Ù¥¹¥È¾¦ÉÊ¤ÎºÇÂçÅÐÏ¿¿ô
+define ("BEST_MIN", 3);				// ¥Ù¥¹¥È¾¦ÉÊ¤ÎºÇ¾®ÅÐÏ¿¿ô¡ÊÅÐÏ¿¿ô¤¬Ëþ¤¿¤Ê¤¤¾ì¹ç¤ÏÉ½¼¨¤·¤Ê¤¤¡£)
+
+//È¯Á÷ÆüÌÜ°Â
+$arrDELIVERYDATE = array(
+	1 => "Â¨Æü",
+	2 => "1¡Á2Æü¸å",
+	3 => "3¡Á4Æü¸å",
+	4 => "1½µ´Ö°Ê¹ß",
+	5 => "2½µ´Ö°Ê¹ß",
+	6 => "3½µ´Ö°Ê¹ß",
+	7 => "1¥ö·î°Ê¹ß",
+	8 => "2¥ö·î°Ê¹ß",
+	9 => "¤ª¼è¤ê´ó¤»(¾¦ÉÊÆþ²Ù¸å)"
+);
+
+/* ÇÛÃ£²ÄÇ½¤ÊÆüÉÕ°Ê¹ß¤Î¥×¥ë¥À¥¦¥óÉ½¼¨ºÇÂçÆü¿ô */
+define("DELIV_DATE_END_MAX", 21);
+
+/* ¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿ */
+define("PURCHASE_CUSTOMER_REGIST", 0);	//1:Í­¸ú¡¡0:Ìµ¸ú
+
+/* ¾¦ÉÊ¥ê¥¹¥ÈÉ½¼¨·ï¿ô */
+$arrPRODUCTLISTMAX = array(
+	15 => '15·ï',
+	30 => '30·ï',
+	50 => '50·ï'
+);
+
+/* ¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹¡¡É½¼¨·ï¿ô */
+define("RELATED_PRODUCTS_MAX", 3);
+
+/*--------- ¢§¥³¥ó¥Ó¥Ë·èºÑÍÑ ---------*/
+
+//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+$arrCONVENIENCE = array(
+	1 => '¥»¥Ö¥ó¥¤¥ì¥Ö¥ó',
+	2 => '¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È',
+	3 => '¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹',
+	4 => '¥í¡¼¥½¥ó¡¦¥»¥¤¥³¡¼¥Þ¡¼¥È',
+	5 => '¥ß¥Ë¥¹¥È¥Ã¥×¡¦¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¦¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢',
+);
+
+//³Æ¼ï¥³¥ó¥Ó¥ËÍÑ¥á¥Ã¥»¡¼¥¸
+$arrCONVENIMESSAGE = array(
+	1 => "¾åµ­URL¤«¤é¿¶¹þÉ¼¤ò°õºþ¡¢¤â¤·¤¯¤Ï¿¶¹þÉ¼ÈÖ¹æ¤ò»æ¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥»¥Ö¥ó¥¤¥ì¥Ö¥ó¤Ë¤Æ¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£",
+	2 => "´ë¶È¥³¡¼¥É¡¢¼õÉÕÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È¤Ë¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£",
+	3 => "¾åµ­URL¤«¤é¿¶¹þÉ¼¤ò°õºþ¡¢¤â¤·¤¯¤Ï¥±¡¼¥¿¥¤·èºÑÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹¤Ë¤Æ¤ª»ÙÊ§¤¯¤À¤µ¤¤¡£",
+	4 => "¿¶¹þÉ¼ÈÖ¹æ¤ò»æ¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥í¡¼¥½¥ó¤Þ¤¿¤Ï¥»¥¤¥³¡¼¥Þ¡¼¥È¤Ë¤Æ¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£",
+	5 => "¾åµ­URL¤«¤é¿¶¹þÉ¼¤ò°õºþ¤·¡¢Á´¹ñ¤Î¥ß¥Ë¥¹¥È¥Ã¥×¡¦¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¦¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢¤Ë¤Æ¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£"
+);
+
+//»ÙÊ§´ü¸Â
+define("CV_PAYMENT_LIMIT", 14);
+
+/*--------- ¢¥¥³¥ó¥Ó¥Ë·èºÑÍÑ ---------*/
+
+//¥­¥ã¥ó¥Ú¡¼¥óÅÐÏ¿ºÇÂç¿ô
+define("CAMPAIGN_REGIST_MAX", 20);
+
+//DB¤Î¼ïÎà
+$arrDB = array(
+	1 => 'PostgreSQL',
+	2 => 'MySQL'
+);
+
+// ¥Æ¥ó¥×¥ì¡¼¥È
+$arrTemplate = array(
+	1 => array(
+			"TopImage" 		 	=> "/img/template/top_l1.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top1.tpl",
+			"ProdImage" 		=> "/img/template/prod_l1.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product1.tpl",
+			"DetailImage" 		=> "/img/template/detail_l1.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail1.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l1.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage1.tpl"
+		),
+	2 => array(
+			"TopImage" 			=> "/img/template/top_l2.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top2.tpl",
+			"ProdImage" 		=> "/img/template/prod_l2.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product2.tpl",
+			"DetailImage"  		=> "/img/template/detail_l2.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail2.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l2.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage2.tpl"
+		),
+	3 => array(
+			"TopImage" 			=> "/img/template/top_l3.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top3.tpl",
+			"ProdImage" 		=> "/img/template/prod_l3.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product3.tpl",
+			"DetailImage" 		=> "/img/template/detail_l3.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail3.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l3.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage3.tpl"
+		),
+	4 => array(
+			"TopImage" 			=> "/img/template/top_l4.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top4.tpl",
+			"ProdImage" 		=> "/img/template/prod_l4.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product4.tpl",
+			"DetailImage" 		=> "/img/template/detail_l4.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail4.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l4.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage4.tpl"
+		),
+	5 => array(
+			"TopImage" 			=> "/img/template/top_l5.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top5.tpl",
+			"ProdImage" 		=> "/img/template/prod_l5.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product5.tpl",
+			"DetailImage" 		=> "/img/template/detail_l5.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail5.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l5.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage5.tpl"
+		),
+	6 => array(
+			"TopImage" 			=> "/img/template/top_l6.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top6.tpl",
+			"ProdImage" 		=> "/img/template/prod_l6.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product6.tpl",
+			"DetailImage" 		=> "/img/template/detail_l6.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail6.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l6.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage6.tpl"
+		)
+);
+
+// ¥Ö¥í¥Ã¥¯ÇÛÃÖ
+$arrTarget = array(
+	1 => "LeftNavi",
+	2 => "MainHead",
+	3 => "RightNavi",
+	4 => "MainFoot",
+	5 => "Unused"
+);
+
+?>
Index: /temp/trunk/data/conf/core.php
===================================================================
--- /temp/trunk/data/conf/core.php	(revision 1328)
+++ /temp/trunk/data/conf/core.php	(revision 1328)
@@ -0,0 +1,37 @@
+<?php
+
+///////////////////////////////////////////////////////////
+/*
+	¥µ¥¤¥È¤´¤È¤ËÉ¬¤ºÊÑ¹¹¤¹¤ëÀßÄê
+*/
+///////////////////////////////////////////////////////////
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("USER_DIR", "html/user_data/");
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("INCLUDE_DIR", USER_DIR."include/");
+
+// ¥Ö¥í¥Ã¥¯¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("BLOC_DIR", "html/user_data/include/bloc/");
+
+// ¥æ¡¼¥¶¡¼ºîÀ®²èÌÌ¤Î¥Ç¥Õ¥©¥ë¥ÈPHP¥Õ¥¡¥¤¥ë
+define("USER_DEF_PHP", ROOT_DIR.USER_DIR."__default.php");
+
+// ¤½¤ÎÂ¾²èÌÌ¤Î¥Ç¥Õ¥©¥ë¥È¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È
+define("DEF_LAYOUT", "products/list.php");
+
+// DB¥¨¥é¡¼¥á¡¼¥ëÁ÷¿®Àè
+define ("DB_ERROR_MAIL_TO", "error-ml@lockon.co.jp");
+
+// DB¥¨¥é¡¼¥á¡¼¥ë·ïÌ¾
+define ("DB_ERROR_MAIL_SUBJECT", "OS_TEST_ERROR");
+
+// ¥µ¥¤¥ÈÍÑDB
+define ("DEFAULT_DSN", "pgsql://" . DB_USER . ":" . DB_PASSWORD . "@" . DB_SERVER . "/" . DB_NAME);
+
+// Í¹ÊØÈÖ¹æÀìÍÑDB
+define ("ZIP_DSN", DEFAULT_DSN);
+
+define ("USER_URL", SITE_URL."user_data/");					// ¥æ¡¼¥¶¡¼ºîÀ®¥Ú¡¼¥¸Åù	
+?>
Index: /temp/trunk/data/module/DB.php
===================================================================
--- /temp/trunk/data/module/DB.php	(revision 1328)
+++ /temp/trunk/data/module/DB.php	(revision 1328)
@@ -0,0 +1,1388 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Database independent query interface
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the PEAR class so it can be extended from
+ */
+require_once 'PEAR.php';
+
+
+// {{{ constants
+// {{{ error codes
+
+/**#@+
+ * One of PEAR DB's portable error codes.
+ * @see DB_common::errorCode(), DB::errorMessage()
+ *
+ * {@internal If you add an error code here, make sure you also add a textual
+ * version of it in DB::errorMessage().}}
+ */
+
+/**
+ * The code returned by many methods upon success
+ */
+define('DB_OK', 1);
+
+/**
+ * Unkown error
+ */
+define('DB_ERROR', -1);
+
+/**
+ * Syntax error
+ */
+define('DB_ERROR_SYNTAX', -2);
+
+/**
+ * Tried to insert a duplicate value into a primary or unique index
+ */
+define('DB_ERROR_CONSTRAINT', -3);
+
+/**
+ * An identifier in the query refers to a non-existant object
+ */
+define('DB_ERROR_NOT_FOUND', -4);
+
+/**
+ * Tried to create a duplicate object
+ */
+define('DB_ERROR_ALREADY_EXISTS', -5);
+
+/**
+ * The current driver does not support the action you attempted
+ */
+define('DB_ERROR_UNSUPPORTED', -6);
+
+/**
+ * The number of parameters does not match the number of placeholders
+ */
+define('DB_ERROR_MISMATCH', -7);
+
+/**
+ * A literal submitted did not match the data type expected
+ */
+define('DB_ERROR_INVALID', -8);
+
+/**
+ * The current DBMS does not support the action you attempted
+ */
+define('DB_ERROR_NOT_CAPABLE', -9);
+
+/**
+ * A literal submitted was too long so the end of it was removed
+ */
+define('DB_ERROR_TRUNCATED', -10);
+
+/**
+ * A literal number submitted did not match the data type expected
+ */
+define('DB_ERROR_INVALID_NUMBER', -11);
+
+/**
+ * A literal date submitted did not match the data type expected
+ */
+define('DB_ERROR_INVALID_DATE', -12);
+
+/**
+ * Attempt to divide something by zero
+ */
+define('DB_ERROR_DIVZERO', -13);
+
+/**
+ * A database needs to be selected
+ */
+define('DB_ERROR_NODBSELECTED', -14);
+
+/**
+ * Could not create the object requested
+ */
+define('DB_ERROR_CANNOT_CREATE', -15);
+
+/**
+ * Could not drop the database requested because it does not exist
+ */
+define('DB_ERROR_CANNOT_DROP', -17);
+
+/**
+ * An identifier in the query refers to a non-existant table
+ */
+define('DB_ERROR_NOSUCHTABLE', -18);
+
+/**
+ * An identifier in the query refers to a non-existant column
+ */
+define('DB_ERROR_NOSUCHFIELD', -19);
+
+/**
+ * The data submitted to the method was inappropriate
+ */
+define('DB_ERROR_NEED_MORE_DATA', -20);
+
+/**
+ * The attempt to lock the table failed
+ */
+define('DB_ERROR_NOT_LOCKED', -21);
+
+/**
+ * The number of columns doesn't match the number of values
+ */
+define('DB_ERROR_VALUE_COUNT_ON_ROW', -22);
+
+/**
+ * The DSN submitted has problems
+ */
+define('DB_ERROR_INVALID_DSN', -23);
+
+/**
+ * Could not connect to the database
+ */
+define('DB_ERROR_CONNECT_FAILED', -24);
+
+/**
+ * The PHP extension needed for this DBMS could not be found
+ */
+define('DB_ERROR_EXTENSION_NOT_FOUND',-25);
+
+/**
+ * The present user has inadequate permissions to perform the task requestd
+ */
+define('DB_ERROR_ACCESS_VIOLATION', -26);
+
+/**
+ * The database requested does not exist
+ */
+define('DB_ERROR_NOSUCHDB', -27);
+
+/**
+ * Tried to insert a null value into a column that doesn't allow nulls
+ */
+define('DB_ERROR_CONSTRAINT_NOT_NULL',-29);
+/**#@-*/
+
+
+// }}}
+// {{{ prepared statement-related
+
+
+/**#@+
+ * Identifiers for the placeholders used in prepared statements.
+ * @see DB_common::prepare()
+ */
+
+/**
+ * Indicates a scalar (<kbd>?</kbd>) placeholder was used
+ *
+ * Quote and escape the value as necessary.
+ */
+define('DB_PARAM_SCALAR', 1);
+
+/**
+ * Indicates an opaque (<kbd>&</kbd>) placeholder was used
+ *
+ * The value presented is a file name.  Extract the contents of that file
+ * and place them in this column.
+ */
+define('DB_PARAM_OPAQUE', 2);
+
+/**
+ * Indicates a misc (<kbd>!</kbd>) placeholder was used
+ *
+ * The value should not be quoted or escaped.
+ */
+define('DB_PARAM_MISC',   3);
+/**#@-*/
+
+
+// }}}
+// {{{ binary data-related
+
+
+/**#@+
+ * The different ways of returning binary data from queries.
+ */
+
+/**
+ * Sends the fetched data straight through to output
+ */
+define('DB_BINMODE_PASSTHRU', 1);
+
+/**
+ * Lets you return data as usual
+ */
+define('DB_BINMODE_RETURN', 2);
+
+/**
+ * Converts the data to hex format before returning it
+ *
+ * For example the string "123" would become "313233".
+ */
+define('DB_BINMODE_CONVERT', 3);
+/**#@-*/
+
+
+// }}}
+// {{{ fetch modes
+
+
+/**#@+
+ * Fetch Modes.
+ * @see DB_common::setFetchMode()
+ */
+
+/**
+ * Indicates the current default fetch mode should be used
+ * @see DB_common::$fetchmode
+ */
+define('DB_FETCHMODE_DEFAULT', 0);
+
+/**
+ * Column data indexed by numbers, ordered from 0 and up
+ */
+define('DB_FETCHMODE_ORDERED', 1);
+
+/**
+ * Column data indexed by column names
+ */
+define('DB_FETCHMODE_ASSOC', 2);
+
+/**
+ * Column data as object properties
+ */
+define('DB_FETCHMODE_OBJECT', 3);
+
+/**
+ * For multi-dimensional results, make the column name the first level
+ * of the array and put the row number in the second level of the array
+ *
+ * This is flipped from the normal behavior, which puts the row numbers
+ * in the first level of the array and the column names in the second level.
+ */
+define('DB_FETCHMODE_FLIPPED', 4);
+/**#@-*/
+
+/**#@+
+ * Old fetch modes.  Left here for compatibility.
+ */
+define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
+define('DB_GETMODE_ASSOC',   DB_FETCHMODE_ASSOC);
+define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
+/**#@-*/
+
+
+// }}}
+// {{{ tableInfo() && autoPrepare()-related
+
+
+/**#@+
+ * The type of information to return from the tableInfo() method.
+ *
+ * Bitwised constants, so they can be combined using <kbd>|</kbd>
+ * and removed using <kbd>^</kbd>.
+ *
+ * @see DB_common::tableInfo()
+ *
+ * {@internal Since the TABLEINFO constants are bitwised, if more of them are
+ * added in the future, make sure to adjust DB_TABLEINFO_FULL accordingly.}}
+ */
+define('DB_TABLEINFO_ORDER', 1);
+define('DB_TABLEINFO_ORDERTABLE', 2);
+define('DB_TABLEINFO_FULL', 3);
+/**#@-*/
+
+
+/**#@+
+ * The type of query to create with the automatic query building methods.
+ * @see DB_common::autoPrepare(), DB_common::autoExecute()
+ */
+define('DB_AUTOQUERY_INSERT', 1);
+define('DB_AUTOQUERY_UPDATE', 2);
+/**#@-*/
+
+
+// }}}
+// {{{ portability modes
+
+
+/**#@+
+ * Portability Modes.
+ *
+ * Bitwised constants, so they can be combined using <kbd>|</kbd>
+ * and removed using <kbd>^</kbd>.
+ *
+ * @see DB_common::setOption()
+ *
+ * {@internal Since the PORTABILITY constants are bitwised, if more of them are
+ * added in the future, make sure to adjust DB_PORTABILITY_ALL accordingly.}}
+ */
+
+/**
+ * Turn off all portability features
+ */
+define('DB_PORTABILITY_NONE', 0);
+
+/**
+ * Convert names of tables and fields to lower case
+ * when using the get*(), fetch*() and tableInfo() methods
+ */
+define('DB_PORTABILITY_LOWERCASE', 1);
+
+/**
+ * Right trim the data output by get*() and fetch*()
+ */
+define('DB_PORTABILITY_RTRIM', 2);
+
+/**
+ * Force reporting the number of rows deleted
+ */
+define('DB_PORTABILITY_DELETE_COUNT', 4);
+
+/**
+ * Enable hack that makes numRows() work in Oracle
+ */
+define('DB_PORTABILITY_NUMROWS', 8);
+
+/**
+ * Makes certain error messages in certain drivers compatible
+ * with those from other DBMS's
+ *
+ * + mysql, mysqli:  change unique/primary key constraints
+ *   DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
+ *
+ * + odbc(access):  MS's ODBC driver reports 'no such field' as code
+ *   07001, which means 'too few parameters.'  When this option is on
+ *   that code gets mapped to DB_ERROR_NOSUCHFIELD.
+ */
+define('DB_PORTABILITY_ERRORS', 16);
+
+/**
+ * Convert null values to empty strings in data output by
+ * get*() and fetch*()
+ */
+define('DB_PORTABILITY_NULL_TO_EMPTY', 32);
+
+/**
+ * Turn on all portability features
+ */
+define('DB_PORTABILITY_ALL', 63);
+/**#@-*/
+
+// }}}
+
+
+// }}}
+// {{{ class DB
+
+/**
+ * Database independent query interface
+ *
+ * The main "DB" class is simply a container class with some static
+ * methods for creating DB objects as well as some utility functions
+ * common to all parts of DB.
+ *
+ * The object model of DB is as follows (indentation means inheritance):
+ * <pre>
+ * DB           The main DB class.  This is simply a utility class
+ *              with some "static" methods for creating DB objects as
+ *              well as common utility functions for other DB classes.
+ *
+ * DB_common    The base for each DB implementation.  Provides default
+ * |            implementations (in OO lingo virtual methods) for
+ * |            the actual DB implementations as well as a bunch of
+ * |            query utility functions.
+ * |
+ * +-DB_mysql   The DB implementation for MySQL.  Inherits DB_common.
+ *              When calling DB::factory or DB::connect for MySQL
+ *              connections, the object returned is an instance of this
+ *              class.
+ * </pre>
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB
+{
+    // {{{ &factory()
+
+    /**
+     * Create a new DB object for the specified database type but don't
+     * connect to the database
+     *
+     * @param string $type     the database type (eg "mysql")
+     * @param array  $options  an associative array of option names and values
+     *
+     * @return object  a new DB object.  A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function &factory($type, $options = false)
+    {
+        if (!is_array($options)) {
+            $options = array('persistent' => $options);
+        }
+
+        if (isset($options['debug']) && $options['debug'] >= 2) {
+            // expose php errors with sufficient debug level
+            include_once "DB/{$type}.php";
+        } else {
+            @include_once "DB/{$type}.php";
+        }
+
+        $classname = "DB_${type}";
+
+        if (!class_exists($classname)) {
+            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
+                                    "Unable to include the DB/{$type}.php"
+                                    . " file for '$dsn'",
+                                    'DB_Error', true);
+            return $tmp;
+        }
+
+        @$obj =& new $classname;
+
+        foreach ($options as $option => $value) {
+            $test = $obj->setOption($option, $value);
+            if (DB::isError($test)) {
+                return $test;
+            }
+        }
+
+        return $obj;
+    }
+
+    // }}}
+    // {{{ &connect()
+
+    /**
+     * Create a new DB object including a connection to the specified database
+     *
+     * Example 1.
+     * <code>
+     * require_once 'DB.php';
+     *
+     * $dsn = 'pgsql://user:password@host/database';
+     * $options = array(
+     *     'debug'       => 2,
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     *
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param mixed $dsn      the string "data source name" or array in the
+     *                         format returned by DB::parseDSN()
+     * @param array $options  an associative array of option names and values
+     *
+     * @return object  a new DB object.  A DB_Error object on failure.
+     *
+     * @uses DB_dbase::connect(), DB_fbsql::connect(), DB_ibase::connect(),
+     *       DB_ifx::connect(), DB_msql::connect(), DB_mssql::connect(),
+     *       DB_mysql::connect(), DB_mysqli::connect(), DB_oci8::connect(),
+     *       DB_odbc::connect(), DB_pgsql::connect(), DB_sqlite::connect(),
+     *       DB_sybase::connect()
+     *
+     * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
+     */
+    function &connect($dsn, $options = array())
+    {
+        $dsninfo = DB::parseDSN($dsn);
+        $type = $dsninfo['phptype'];
+
+        if (!is_array($options)) {
+            /*
+             * For backwards compatibility.  $options used to be boolean,
+             * indicating whether the connection should be persistent.
+             */
+            $options = array('persistent' => $options);
+        }
+
+        if (isset($options['debug']) && $options['debug'] >= 2) {
+            // expose php errors with sufficient debug level
+            include_once "DB/${type}.php";
+        } else {
+            @include_once "DB/${type}.php";
+        }
+
+        $classname = "DB_${type}";
+        if (!class_exists($classname)) {
+            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
+                                    "Unable to include the DB/{$type}.php"
+                                    . " file for '$dsn'",
+                                    'DB_Error', true);
+            return $tmp;
+        }
+
+        @$obj =& new $classname;
+
+        foreach ($options as $option => $value) {
+            $test = $obj->setOption($option, $value);
+            if (DB::isError($test)) {
+                return $test;
+            }
+        }
+
+        $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
+        if (DB::isError($err)) {
+            $err->addUserInfo($dsn);
+            return $err;
+        }
+
+        return $obj;
+    }
+
+    // }}}
+    // {{{ apiVersion()
+
+    /**
+     * Return the DB API version
+     *
+     * @return string  the DB API version number
+     */
+    function apiVersion()
+    {
+        return '@package_version@';
+    }
+
+    // }}}
+    // {{{ isError()
+
+    /**
+     * Determines if a variable is a DB_Error object
+     *
+     * @param mixed $value  the variable to check
+     *
+     * @return bool  whether $value is DB_Error object
+     */
+    function isError($value)
+    {
+        return is_a($value, 'DB_Error');
+    }
+
+    // }}}
+    // {{{ isConnection()
+
+    /**
+     * Determines if a value is a DB_<driver> object
+     *
+     * @param mixed $value  the value to test
+     *
+     * @return bool  whether $value is a DB_<driver> object
+     */
+    function isConnection($value)
+    {
+        return (is_object($value) &&
+                is_subclass_of($value, 'db_common') &&
+                method_exists($value, 'simpleQuery'));
+    }
+
+    // }}}
+    // {{{ isManip()
+
+    /**
+     * Tell whether a query is a data manipulation or data definition query
+     *
+     * Examples of data manipulation queries are INSERT, UPDATE and DELETE.
+     * Examples of data definition queries are CREATE, DROP, ALTER, GRANT,
+     * REVOKE.
+     *
+     * @param string $query  the query
+     *
+     * @return boolean  whether $query is a data manipulation query
+     */
+    function isManip($query)
+    {
+        $manips = 'INSERT|UPDATE|DELETE|REPLACE|'
+                . 'CREATE|DROP|'
+                . 'LOAD DATA|SELECT .* INTO|COPY|'
+                . 'ALTER|GRANT|REVOKE|'
+                . 'LOCK|UNLOCK';
+        if (preg_match('/^\s*"?(' . $manips . ')\s+/i', $query)) {
+            return true;
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ errorMessage()
+
+    /**
+     * Return a textual error message for a DB error code
+     *
+     * @param integer $value  the DB error code
+     *
+     * @return string  the error message or false if the error code was
+     *                  not recognized
+     */
+    function errorMessage($value)
+    {
+        static $errorMessages;
+        if (!isset($errorMessages)) {
+            $errorMessages = array(
+                DB_ERROR                    => 'unknown error',
+                DB_ERROR_ACCESS_VIOLATION   => 'insufficient permissions',
+                DB_ERROR_ALREADY_EXISTS     => 'already exists',
+                DB_ERROR_CANNOT_CREATE      => 'can not create',
+                DB_ERROR_CANNOT_DROP        => 'can not drop',
+                DB_ERROR_CONNECT_FAILED     => 'connect failed',
+                DB_ERROR_CONSTRAINT         => 'constraint violation',
+                DB_ERROR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
+                DB_ERROR_DIVZERO            => 'division by zero',
+                DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found',
+                DB_ERROR_INVALID            => 'invalid',
+                DB_ERROR_INVALID_DATE       => 'invalid date or time',
+                DB_ERROR_INVALID_DSN        => 'invalid DSN',
+                DB_ERROR_INVALID_NUMBER     => 'invalid number',
+                DB_ERROR_MISMATCH           => 'mismatch',
+                DB_ERROR_NEED_MORE_DATA     => 'insufficient data supplied',
+                DB_ERROR_NODBSELECTED       => 'no database selected',
+                DB_ERROR_NOSUCHDB           => 'no such database',
+                DB_ERROR_NOSUCHFIELD        => 'no such field',
+                DB_ERROR_NOSUCHTABLE        => 'no such table',
+                DB_ERROR_NOT_CAPABLE        => 'DB backend not capable',
+                DB_ERROR_NOT_FOUND          => 'not found',
+                DB_ERROR_NOT_LOCKED         => 'not locked',
+                DB_ERROR_SYNTAX             => 'syntax error',
+                DB_ERROR_UNSUPPORTED        => 'not supported',
+                DB_ERROR_TRUNCATED          => 'truncated',
+                DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
+                DB_OK                       => 'no error',
+            );
+        }
+
+        if (DB::isError($value)) {
+            $value = $value->getCode();
+        }
+
+        return isset($errorMessages[$value]) ? $errorMessages[$value]
+                     : $errorMessages[DB_ERROR];
+    }
+
+    // }}}
+    // {{{ parseDSN()
+
+    /**
+     * Parse a data source name
+     *
+     * Additional keys can be added by appending a URI query string to the
+     * end of the DSN.
+     *
+     * The format of the supplied DSN is in its fullest form:
+     * <code>
+     *  phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
+     * </code>
+     *
+     * Most variations are allowed:
+     * <code>
+     *  phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
+     *  phptype://username:password@hostspec/database_name
+     *  phptype://username:password@hostspec
+     *  phptype://username@hostspec
+     *  phptype://hostspec/database
+     *  phptype://hostspec
+     *  phptype(dbsyntax)
+     *  phptype
+     * </code>
+     *
+     * @param string $dsn Data Source Name to be parsed
+     *
+     * @return array an associative array with the following keys:
+     *  + phptype:  Database backend used in PHP (mysql, odbc etc.)
+     *  + dbsyntax: Database used with regards to SQL syntax etc.
+     *  + protocol: Communication protocol to use (tcp, unix etc.)
+     *  + hostspec: Host specification (hostname[:port])
+     *  + database: Database to use on the DBMS server
+     *  + username: User name for login
+     *  + password: Password for login
+     */
+    function parseDSN($dsn)
+    {
+        $parsed = array(
+            'phptype'  => false,
+            'dbsyntax' => false,
+            'username' => false,
+            'password' => false,
+            'protocol' => false,
+            'hostspec' => false,
+            'port'     => false,
+            'socket'   => false,
+            'database' => false,
+        );
+
+        if (is_array($dsn)) {
+            $dsn = array_merge($parsed, $dsn);
+            if (!$dsn['dbsyntax']) {
+                $dsn['dbsyntax'] = $dsn['phptype'];
+            }
+            return $dsn;
+        }
+
+        // Find phptype and dbsyntax
+        if (($pos = strpos($dsn, '://')) !== false) {
+            $str = substr($dsn, 0, $pos);
+            $dsn = substr($dsn, $pos + 3);
+        } else {
+            $str = $dsn;
+            $dsn = null;
+        }
+
+        // Get phptype and dbsyntax
+        // $str => phptype(dbsyntax)
+        if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
+            $parsed['phptype']  = $arr[1];
+            $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
+        } else {
+            $parsed['phptype']  = $str;
+            $parsed['dbsyntax'] = $str;
+        }
+
+        if (!count($dsn)) {
+            return $parsed;
+        }
+
+        // Get (if found): username and password
+        // $dsn => username:password@protocol+hostspec/database
+        if (($at = strrpos($dsn,'@')) !== false) {
+            $str = substr($dsn, 0, $at);
+            $dsn = substr($dsn, $at + 1);
+            if (($pos = strpos($str, ':')) !== false) {
+                $parsed['username'] = rawurldecode(substr($str, 0, $pos));
+                $parsed['password'] = rawurldecode(substr($str, $pos + 1));
+            } else {
+                $parsed['username'] = rawurldecode($str);
+            }
+        }
+
+        // Find protocol and hostspec
+
+        if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
+            // $dsn => proto(proto_opts)/database
+            $proto       = $match[1];
+            $proto_opts  = $match[2] ? $match[2] : false;
+            $dsn         = $match[3];
+
+        } else {
+            // $dsn => protocol+hostspec/database (old format)
+            if (strpos($dsn, '+') !== false) {
+                list($proto, $dsn) = explode('+', $dsn, 2);
+            }
+            if (strpos($dsn, '/') !== false) {
+                list($proto_opts, $dsn) = explode('/', $dsn, 2);
+            } else {
+                $proto_opts = $dsn;
+                $dsn = null;
+            }
+        }
+
+        // process the different protocol options
+        $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
+        $proto_opts = rawurldecode($proto_opts);
+        if ($parsed['protocol'] == 'tcp') {
+            if (strpos($proto_opts, ':') !== false) {
+                list($parsed['hostspec'],
+                     $parsed['port']) = explode(':', $proto_opts);
+            } else {
+                $parsed['hostspec'] = $proto_opts;
+            }
+        } elseif ($parsed['protocol'] == 'unix') {
+            $parsed['socket'] = $proto_opts;
+        }
+
+        // Get dabase if any
+        // $dsn => database
+        if ($dsn) {
+            if (($pos = strpos($dsn, '?')) === false) {
+                // /database
+                $parsed['database'] = rawurldecode($dsn);
+            } else {
+                // /database?param1=value1&param2=value2
+                $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
+                $dsn = substr($dsn, $pos + 1);
+                if (strpos($dsn, '&') !== false) {
+                    $opts = explode('&', $dsn);
+                } else { // database?param1=value1
+                    $opts = array($dsn);
+                }
+                foreach ($opts as $opt) {
+                    list($key, $value) = explode('=', $opt);
+                    if (!isset($parsed[$key])) {
+                        // don't allow params overwrite
+                        $parsed[$key] = rawurldecode($value);
+                    }
+                }
+            }
+        }
+
+        return $parsed;
+    }
+
+    // }}}
+}
+
+// }}}
+// {{{ class DB_Error
+
+/**
+ * DB_Error implements a class for reporting portable database error
+ * messages
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_Error extends PEAR_Error
+{
+    // {{{ constructor
+
+    /**
+     * DB_Error constructor
+     *
+     * @param mixed $code       DB error code, or string with error message
+     * @param int   $mode       what "error mode" to operate in
+     * @param int   $level      what error level to use for $mode &
+     *                           PEAR_ERROR_TRIGGER
+     * @param mixed $debuginfo  additional debug info, such as the last query
+     *
+     * @see PEAR_Error
+     */
+    function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
+                      $level = E_USER_NOTICE, $debuginfo = null)
+    {
+        if (is_int($code)) {
+            $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,
+                              $mode, $level, $debuginfo);
+        } else {
+            $this->PEAR_Error("DB Error: $code", DB_ERROR,
+                              $mode, $level, $debuginfo);
+        }
+    }
+
+    // }}}
+}
+
+// }}}
+// {{{ class DB_result
+
+/**
+ * This class implements a wrapper for a DB result set
+ *
+ * A new instance of this class will be returned by the DB implementation
+ * after processing a query that returns data.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_result
+{
+    // {{{ properties
+
+    /**
+     * Should results be freed automatically when there are no more rows?
+     * @var boolean
+     * @see DB_common::$options
+     */
+    var $autofree;
+
+    /**
+     * A reference to the DB_<driver> object
+     * @var object
+     */
+    var $dbh;
+
+    /**
+     * The current default fetch mode
+     * @var integer
+     * @see DB_common::$fetchmode
+     */
+    var $fetchmode;
+
+    /**
+     * The name of the class into which results should be fetched when
+     * DB_FETCHMODE_OBJECT is in effect
+     *
+     * @var string
+     * @see DB_common::$fetchmode_object_class
+     */
+    var $fetchmode_object_class;
+
+    /**
+     * The number of rows to fetch from a limit query
+     * @var integer
+     */
+    var $limit_count = null;
+
+    /**
+     * The row to start fetching from in limit queries
+     * @var integer
+     */
+    var $limit_from = null;
+
+    /**
+     * The execute parameters that created this result
+     * @var array
+     * @since Property available since Release 1.7.0
+     */
+    var $parameters;
+
+    /**
+     * The query string that created this result
+     *
+     * Copied here incase it changes in $dbh, which is referenced
+     *
+     * @var string
+     * @since Property available since Release 1.7.0
+     */
+    var $query;
+
+    /**
+     * The query result resource id created by PHP
+     * @var resource
+     */
+    var $result;
+
+    /**
+     * The present row being dealt with
+     * @var integer
+     */
+    var $row_counter = null;
+
+    /**
+     * The prepared statement resource id created by PHP in $dbh
+     *
+     * This resource is only available when the result set was created using
+     * a driver's native execute() method, not PEAR DB's emulated one.
+     *
+     * Copied here incase it changes in $dbh, which is referenced
+     *
+     * {@internal  Mainly here because the InterBase/Firebird API is only
+     * able to retrieve data from result sets if the statemnt handle is
+     * still in scope.}}
+     *
+     * @var resource
+     * @since Property available since Release 1.7.0
+     */
+    var $statement;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor sets the object's properties
+     *
+     * @param object   &$dbh     the DB object reference
+     * @param resource $result   the result resource id
+     * @param array    $options  an associative array with result options
+     *
+     * @return void
+     */
+    function DB_result(&$dbh, $result, $options = array())
+    {
+        $this->autofree    = $dbh->options['autofree'];
+        $this->dbh         = &$dbh;
+        $this->fetchmode   = $dbh->fetchmode;
+        $this->fetchmode_object_class = $dbh->fetchmode_object_class;
+        $this->parameters  = $dbh->last_parameters;
+        $this->query       = $dbh->last_query;
+        $this->result      = $result;
+        $this->statement   = empty($dbh->last_stmt) ? null : $dbh->last_stmt;
+        foreach ($options as $key => $value) {
+            $this->setOption($key, $value);
+        }
+    }
+
+    /**
+     * Set options for the DB_result object
+     *
+     * @param string $key    the option to set
+     * @param mixed  $value  the value to set the option to
+     *
+     * @return void
+     */
+    function setOption($key, $value = null)
+    {
+        switch ($key) {
+            case 'limit_from':
+                $this->limit_from = $value;
+                break;
+            case 'limit_count':
+                $this->limit_count = $value;
+        }
+    }
+
+    // }}}
+    // {{{ fetchRow()
+
+    /**
+     * Fetch a row of data and return it by reference into an array
+     *
+     * The type of array returned can be controlled either by setting this
+     * method's <var>$fetchmode</var> parameter or by changing the default
+     * fetch mode setFetchMode() before calling this method.
+     *
+     * There are two options for standardizing the information returned
+     * from databases, ensuring their values are consistent when changing
+     * DBMS's.  These portability options can be turned on when creating a
+     * new DB object or by using setOption().
+     *
+     *   + <var>DB_PORTABILITY_LOWERCASE</var>
+     *     convert names of fields to lower case
+     *
+     *   + <var>DB_PORTABILITY_RTRIM</var>
+     *     right trim the data
+     *
+     * @param int $fetchmode  the constant indicating how to format the data
+     * @param int $rownum     the row number to fetch (index starts at 0)
+     *
+     * @return mixed  an array or object containing the row's data,
+     *                 NULL when the end of the result set is reached
+     *                 or a DB_Error object on failure.
+     *
+     * @see DB_common::setOption(), DB_common::setFetchMode()
+     */
+    function &fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
+    {
+        if ($fetchmode === DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->fetchmode;
+        }
+        if ($fetchmode === DB_FETCHMODE_OBJECT) {
+            $fetchmode = DB_FETCHMODE_ASSOC;
+            $object_class = $this->fetchmode_object_class;
+        }
+        if ($this->limit_from !== null) {
+            if ($this->row_counter === null) {
+                $this->row_counter = $this->limit_from;
+                // Skip rows
+                if ($this->dbh->features['limit'] === false) {
+                    $i = 0;
+                    while ($i++ < $this->limit_from) {
+                        $this->dbh->fetchInto($this->result, $arr, $fetchmode);
+                    }
+                }
+            }
+            if ($this->row_counter >= ($this->limit_from + $this->limit_count))
+            {
+                if ($this->autofree) {
+                    $this->free();
+                }
+                $tmp = null;
+                return $tmp;
+            }
+            if ($this->dbh->features['limit'] === 'emulate') {
+                $rownum = $this->row_counter;
+            }
+            $this->row_counter++;
+        }
+        $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
+        if ($res === DB_OK) {
+            if (isset($object_class)) {
+                // The default mode is specified in the
+                // DB_common::fetchmode_object_class property
+                if ($object_class == 'stdClass') {
+                    $arr = (object) $arr;
+                } else {
+                    $arr = &new $object_class($arr);
+                }
+            }
+            return $arr;
+        }
+        if ($res == null && $this->autofree) {
+            $this->free();
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Fetch a row of data into an array which is passed by reference
+     *
+     * The type of array returned can be controlled either by setting this
+     * method's <var>$fetchmode</var> parameter or by changing the default
+     * fetch mode setFetchMode() before calling this method.
+     *
+     * There are two options for standardizing the information returned
+     * from databases, ensuring their values are consistent when changing
+     * DBMS's.  These portability options can be turned on when creating a
+     * new DB object or by using setOption().
+     *
+     *   + <var>DB_PORTABILITY_LOWERCASE</var>
+     *     convert names of fields to lower case
+     *
+     *   + <var>DB_PORTABILITY_RTRIM</var>
+     *     right trim the data
+     *
+     * @param array &$arr       the variable where the data should be placed
+     * @param int   $fetchmode  the constant indicating how to format the data
+     * @param int   $rownum     the row number to fetch (index starts at 0)
+     *
+     * @return mixed  DB_OK if a row is processed, NULL when the end of the
+     *                 result set is reached or a DB_Error object on failure
+     *
+     * @see DB_common::setOption(), DB_common::setFetchMode()
+     */
+    function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
+    {
+        if ($fetchmode === DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->fetchmode;
+        }
+        if ($fetchmode === DB_FETCHMODE_OBJECT) {
+            $fetchmode = DB_FETCHMODE_ASSOC;
+            $object_class = $this->fetchmode_object_class;
+        }
+        if ($this->limit_from !== null) {
+            if ($this->row_counter === null) {
+                $this->row_counter = $this->limit_from;
+                // Skip rows
+                if ($this->dbh->features['limit'] === false) {
+                    $i = 0;
+                    while ($i++ < $this->limit_from) {
+                        $this->dbh->fetchInto($this->result, $arr, $fetchmode);
+                    }
+                }
+            }
+            if ($this->row_counter >= (
+                    $this->limit_from + $this->limit_count))
+            {
+                if ($this->autofree) {
+                    $this->free();
+                }
+                return null;
+            }
+            if ($this->dbh->features['limit'] === 'emulate') {
+                $rownum = $this->row_counter;
+            }
+
+            $this->row_counter++;
+        }
+        $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
+        if ($res === DB_OK) {
+            if (isset($object_class)) {
+                // default mode specified in the
+                // DB_common::fetchmode_object_class property
+                if ($object_class == 'stdClass') {
+                    $arr = (object) $arr;
+                } else {
+                    $arr = new $object_class($arr);
+                }
+            }
+            return DB_OK;
+        }
+        if ($res == null && $this->autofree) {
+            $this->free();
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Get the the number of columns in a result set
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     */
+    function numCols()
+    {
+        return $this->dbh->numCols($this->result);
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Get the number of rows in a result set
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function numRows()
+    {
+        if ($this->dbh->features['numrows'] === 'emulate'
+            && $this->dbh->options['portability'] & DB_PORTABILITY_NUMROWS)
+        {
+            if ($this->dbh->features['prepare']) {
+                $res = $this->dbh->query($this->query, $this->parameters);
+            } else {
+                $res = $this->dbh->query($this->query);
+            }
+            if (DB::isError($res)) {
+                return $res;
+            }
+            $i = 0;
+            while ($res->fetchInto($tmp, DB_FETCHMODE_ORDERED)) {
+                $i++;
+            }
+            return $i;
+        } else {
+            return $this->dbh->numRows($this->result);
+        }
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Get the next result if a batch of queries was executed
+     *
+     * @return bool  true if a new result is available or false if not
+     */
+    function nextResult()
+    {
+        return $this->dbh->nextResult($this->result);
+    }
+
+    // }}}
+    // {{{ free()
+
+    /**
+     * Frees the resources allocated for this result set
+     *
+     * @return bool  true on success.  A DB_Error object on failure.
+     */
+    function free()
+    {
+        $err = $this->dbh->freeResult($this->result);
+        if (DB::isError($err)) {
+            return $err;
+        }
+        $this->result = false;
+        $this->statement = false;
+        return true;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * @see DB_common::tableInfo()
+     * @deprecated Method deprecated some time before Release 1.2
+     */
+    function tableInfo($mode = null)
+    {
+        if (is_string($mode)) {
+            return $this->dbh->raiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+        return $this->dbh->tableInfo($this, $mode);
+    }
+
+    // }}}
+    // {{{ getQuery()
+
+    /**
+     * Determine the query string that created this result
+     *
+     * @return string  the query string
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function getQuery()
+    {
+        return $this->query;
+    }
+
+    // }}}
+    // {{{ getRowCounter()
+
+    /**
+     * Tells which row number is currently being processed
+     *
+     * @return integer  the current row being looked at.  Starts at 1.
+     */
+    function getRowCounter()
+    {
+        return $this->row_counter;
+    }
+
+    // }}}
+}
+
+// }}}
+// {{{ class DB_row
+
+/**
+ * PEAR DB Row Object
+ *
+ * The object contains a row of data from a result set.  Each column's data
+ * is placed in a property named for the column.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @see        DB_common::setFetchMode()
+ */
+class DB_row
+{
+    // {{{ constructor
+
+    /**
+     * The constructor places a row's data into properties of this object
+     *
+     * @param array  the array containing the row's data
+     *
+     * @return void
+     */
+    function DB_row(&$arr)
+    {
+        foreach ($arr as $key => $value) {
+            $this->$key = &$arr[$key];
+        }
+    }
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/Smarty/demo/index.php
===================================================================
--- /temp/trunk/data/module/Smarty/demo/index.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/demo/index.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+require '../libs/Smarty.class.php';
+
+$smarty = new Smarty;
+
+$smarty->compile_check = true;
+$smarty->debugging = true;
+
+$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
+$smarty->assign("FirstName",array("John","Mary","James","Henry"));
+$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
+$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
+	  array("I", "J", "K", "L"), array("M", "N", "O", "P")));
+
+$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
+	  array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
+
+$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
+$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
+$smarty->assign("option_selected", "NE");
+
+$smarty->display('index.tpl');
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.assign_smarty_interface.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.assign_smarty_interface.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.assign_smarty_interface.php	(revision 1328)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty assign_smarty_interface core plugin
+ *
+ * Type:     core<br>
+ * Name:     assign_smarty_interface<br>
+ * Purpose:  assign the $smarty interface variable
+ * @param array Format: null
+ * @param Smarty
+ */
+function smarty_core_assign_smarty_interface($params, &$smarty)
+{
+        if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) {
+            return;
+        }
+
+        $_globals_map = array('g'  => 'HTTP_GET_VARS',
+                             'p'  => 'HTTP_POST_VARS',
+                             'c'  => 'HTTP_COOKIE_VARS',
+                             's'  => 'HTTP_SERVER_VARS',
+                             'e'  => 'HTTP_ENV_VARS');
+
+        $_smarty_vars_request  = array();
+
+        foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) {
+            if (isset($_globals_map[$_c])) {
+                $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]);
+            }
+        }
+        $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']);
+
+        $smarty->_smarty_vars['request'] = $_smarty_vars_request;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.load_resource_plugin.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.load_resource_plugin.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.load_resource_plugin.php	(revision 1328)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * load a resource plugin
+ *
+ * @param string $type
+ */
+
+// $type
+
+function smarty_core_load_resource_plugin($params, &$smarty)
+{
+    /*
+     * Resource plugins are not quite like the other ones, so they are
+     * handled differently. The first element of plugin info is the array of
+     * functions provided by the plugin, the second one indicates whether
+     * all of them exist or not.
+     */
+
+    $_plugin = &$smarty->_plugins['resource'][$params['type']];
+    if (isset($_plugin)) {
+        if (!$_plugin[1] && count($_plugin[0])) {
+            $_plugin[1] = true;
+            foreach ($_plugin[0] as $_plugin_func) {
+                if (!is_callable($_plugin_func)) {
+                    $_plugin[1] = false;
+                    break;
+                }
+            }
+        }
+
+        if (!$_plugin[1]) {
+            $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);
+        }
+
+        return;
+    }
+
+    $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);
+    $_found = ($_plugin_file != false);
+
+    if ($_found) {            /*
+         * If the plugin file is found, it -must- provide the properly named
+         * plugin functions.
+         */
+        include_once($_plugin_file);
+
+        /*
+         * Locate functions that we require the plugin to provide.
+         */
+        $_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
+        $_resource_funcs = array();
+        foreach ($_resource_ops as $_op) {
+            $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
+            if (!function_exists($_plugin_func)) {
+                $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);
+                return;
+            } else {
+                $_resource_funcs[] = $_plugin_func;
+            }
+        }
+
+        $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.rm_auto.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.rm_auto.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.rm_auto.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * delete an automagically created file by name and id
+ *
+ * @param string $auto_base
+ * @param string $auto_source
+ * @param string $auto_id
+ * @param integer $exp_time
+ * @return boolean
+ */
+
+// $auto_base, $auto_source = null, $auto_id = null, $exp_time = null
+
+function smarty_core_rm_auto($params, &$smarty)
+{
+    if (!@is_dir($params['auto_base']))
+      return false;
+
+    if(!isset($params['auto_id']) && !isset($params['auto_source'])) {
+        $_params = array(
+            'dirname' => $params['auto_base'],
+            'level' => 0,
+            'exp_time' => $params['exp_time']
+        );
+        require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
+        $_res = smarty_core_rmdir($_params, $smarty);
+    } else {
+        $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);
+
+        if(isset($params['auto_source'])) {
+            if (isset($params['extensions'])) {
+                $_res = false;
+                foreach ((array)$params['extensions'] as $_extension)
+                    $_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']);
+            } else {
+                $_res = $smarty->_unlink($_tname, $params['exp_time']);
+            }
+        } elseif ($smarty->use_sub_dirs) {
+            $_params = array(
+                'dirname' => $_tname,
+                'level' => 1,
+                'exp_time' => $params['exp_time']
+            );
+            require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
+            $_res = smarty_core_rmdir($_params, $smarty);
+        } else {
+            // remove matching file names
+            $_handle = opendir($params['auto_base']);
+            $_res = true;
+            while (false !== ($_filename = readdir($_handle))) {
+                if($_filename == '.' || $_filename == '..') {
+                    continue;
+                } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) {
+                    $_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']);
+                }
+            }
+        }
+    }
+
+    return $_res;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.write_compiled_include.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.write_compiled_include.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.write_compiled_include.php	(revision 1328)
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Extract non-cacheable parts out of compiled template and write it
+ *
+ * @param string $compile_path
+ * @param string $template_compiled
+ * @return boolean
+ */
+
+function smarty_core_write_compiled_include($params, &$smarty)
+{
+    $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; \};';
+    $_tag_end   = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\'; \};';
+
+    preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us',
+                   $params['compiled_content'], $_match_source, PREG_SET_ORDER);
+
+    // no nocache-parts found: done
+    if (count($_match_source)==0) return;
+
+    // convert the matched php-code to functions
+    $_include_compiled =  "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
+    $_include_compiled .= "         compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n";
+
+    $_compile_path = $params['include_file_path'];
+
+    $smarty->_cache_serials[$_compile_path] = $params['cache_serial'];
+    $_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>";
+
+    $_include_compiled .= $params['plugins_code'];
+    $_include_compiled .= "<?php";
+
+    $this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this';
+    for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) {
+        $_match =& $_match_source[$_i];
+        $source = $_match[4];
+        if ($this_varname == '_smarty') {
+            /* rename $this to $_smarty in the sourcecode */
+            $tokens = token_get_all('<?php ' . $_match[4]);
+
+            /* remove trailing <?php */
+            $open_tag = '';
+            while ($tokens) {
+                $token = array_shift($tokens);
+                if (is_array($token)) {
+                    $open_tag .= $token[1];
+                } else {
+                    $open_tag .= $token;
+                }
+                if ($open_tag == '<?php ') break;
+            }
+
+            for ($i=0, $count = count($tokens); $i < $count; $i++) {
+                if (is_array($tokens[$i])) {
+                    if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {
+                        $tokens[$i] = '$' . $this_varname;
+                    } else {
+                        $tokens[$i] = $tokens[$i][1];
+                    }                   
+                }
+            }
+            $source = implode('', $tokens);
+        }
+
+        /* add function to compiled include */
+        $_include_compiled .= "
+function _smarty_tplfunc_$_match[2]_$_match[3](&\$$this_varname)
+{
+$source
+}
+
+";
+    }
+    $_include_compiled .= "\n\n?>\n";
+
+    $_params = array('filename' => $_compile_path,
+                     'contents' => $_include_compiled, 'create_dirs' => true);
+
+    require_once(SMARTY_CORE_DIR . 'core.write_file.php');
+    smarty_core_write_file($_params, $smarty);
+    return true;
+}
+
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.write_cache_file.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.write_cache_file.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.write_cache_file.php	(revision 1328)
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Prepend the cache information to the cache file
+ * and write it
+ *
+ * @param string $tpl_file
+ * @param string $cache_id
+ * @param string $compile_id
+ * @param string $results
+ * @return true|null
+ */
+
+ // $tpl_file, $cache_id, $compile_id, $results
+
+function smarty_core_write_cache_file($params, &$smarty)
+{
+
+    // put timestamp in cache header
+    $smarty->_cache_info['timestamp'] = time();
+    if ($smarty->cache_lifetime > -1){
+        // expiration set
+        $smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime;
+    } else {
+        // cache will never expire
+        $smarty->_cache_info['expires'] = -1;
+    }
+
+    // collapse nocache.../nocache-tags
+    if (preg_match_all('!\{(/?)nocache\:[0-9a-f]{32}#\d+\}!', $params['results'], $match, PREG_PATTERN_ORDER)) {
+        // remove everything between every pair of outermost noache.../nocache-tags
+        // and replace it by a single nocache-tag
+        // this new nocache-tag will be replaced by dynamic contents in
+        // smarty_core_process_compiled_includes() on a cache-read
+        
+        $match_count = count($match[0]);
+        $results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE);
+        
+        $level = 0;
+        $j = 0;
+        for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) {
+            if ($results[$i] == $match[0][$j]) {
+                // nocache tag
+                if ($match[1][$j]) { // closing tag
+                    $level--;
+                    unset($results[$i]);
+                } else { // opening tag
+                    if ($level++ > 0) unset($results[$i]);
+                }
+                $j++;
+            } elseif ($level > 0) {
+                unset($results[$i]);
+            }
+        }
+        $params['results'] = implode('', $results);
+    }
+    $smarty->_cache_info['cache_serials'] = $smarty->_cache_serials;
+
+    // prepend the cache header info into cache file
+    $_cache_info = serialize($smarty->_cache_info);
+    $params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results'];
+
+    if (!empty($smarty->cache_handler_func)) {
+        // use cache_handler function
+        call_user_func_array($smarty->cache_handler_func,
+                             array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null));
+    } else {
+        // use local cache file
+
+        if(!@is_writable($smarty->cache_dir)) {
+            // cache_dir not writable, see if it exists
+            if(!@is_dir($smarty->cache_dir)) {
+                $smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
+                return false;
+            }
+            $smarty->trigger_error('unable to write to $cache_dir \'' . realpath($smarty->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR);
+            return false;
+        }
+
+        $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
+        $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
+        $_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true);
+        require_once(SMARTY_CORE_DIR . 'core.write_file.php');
+        smarty_core_write_file($_params, $smarty);
+        return true;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.process_cached_inserts.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.process_cached_inserts.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.process_cached_inserts.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Replace cached inserts with the actual results
+ *
+ * @param string $results
+ * @return string
+ */
+function smarty_core_process_cached_inserts($params, &$smarty)
+{
+    preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
+                   $params['results'], $match);
+    list($cached_inserts, $insert_args) = $match;
+
+    for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $debug_start_time = smarty_core_get_microtime($_params, $smarty);
+        }
+
+        $args = unserialize($insert_args[$i]);
+        $name = $args['name'];
+
+        if (isset($args['script'])) {
+            $_params = array('resource_name' => $smarty->_dequote($args['script']));
+            require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
+            if(!smarty_core_get_php_resource($_params, $smarty)) {
+                return false;
+            }
+            $resource_type = $_params['resource_type'];
+            $php_resource = $_params['php_resource'];
+
+
+            if ($resource_type == 'file') {
+                $smarty->_include($php_resource, true);
+            } else {
+                $smarty->_eval($php_resource);
+            }
+        }
+
+        $function_name = $smarty->_plugins['insert'][$name][0];
+        if (empty($args['assign'])) {
+            $replace = $function_name($args, $smarty);
+        } else {
+            $smarty->assign($args['assign'], $function_name($args, $smarty));
+            $replace = '';
+        }
+
+        $params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i]));
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[] = array('type'      => 'insert',
+                                                'filename'  => 'insert_'.$name,
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
+        }
+    }
+
+    return $params['results'];
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.write_compiled_resource.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.write_compiled_resource.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.write_compiled_resource.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * write the compiled resource
+ *
+ * @param string $compile_path
+ * @param string $compiled_content
+ * @return true
+ */
+function smarty_core_write_compiled_resource($params, &$smarty)
+{
+    if(!@is_writable($smarty->compile_dir)) {
+        // compile_dir not writable, see if it exists
+        if(!@is_dir($smarty->compile_dir)) {
+            $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
+            return false;
+        }
+        $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
+        return false;
+    }
+
+    $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
+    require_once(SMARTY_CORE_DIR . 'core.write_file.php');
+    smarty_core_write_file($_params, $smarty);
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.rmdir.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.rmdir.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.rmdir.php	(revision 1328)
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * delete a dir recursively (level=0 -> keep root)
+ * WARNING: no tests, it will try to remove what you tell it!
+ *
+ * @param string $dirname
+ * @param integer $level
+ * @param integer $exp_time
+ * @return boolean
+ */
+
+//  $dirname, $level = 1, $exp_time = null
+
+function smarty_core_rmdir($params, &$smarty)
+{
+   if(!isset($params['level'])) { $params['level'] = 1; }
+   if(!isset($params['exp_time'])) { $params['exp_time'] = null; }
+
+   if($_handle = @opendir($params['dirname'])) {
+
+        while (false !== ($_entry = readdir($_handle))) {
+            if ($_entry != '.' && $_entry != '..') {
+                if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
+                    $_params = array(
+                        'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry,
+                        'level' => $params['level'] + 1,
+                        'exp_time' => $params['exp_time']
+                    );
+                    smarty_core_rmdir($_params, $smarty);
+                }
+                else {
+                    $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
+                }
+            }
+        }
+        closedir($_handle);
+   }
+
+   if ($params['level']) {
+       return @rmdir($params['dirname']);
+   }
+   return (bool)$_handle;
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.load_plugins.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.load_plugins.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.load_plugins.php	(revision 1328)
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Load requested plugins
+ *
+ * @param array $plugins
+ */
+
+// $plugins
+
+function smarty_core_load_plugins($params, &$smarty)
+{
+
+    foreach ($params['plugins'] as $_plugin_info) {
+        list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
+        $_plugin = &$smarty->_plugins[$_type][$_name];
+
+        /*
+         * We do not load plugin more than once for each instance of Smarty.
+         * The following code checks for that. The plugin can also be
+         * registered dynamically at runtime, in which case template file
+         * and line number will be unknown, so we fill them in.
+         *
+         * The final element of the info array is a flag that indicates
+         * whether the dynamically registered plugin function has been
+         * checked for existence yet or not.
+         */
+        if (isset($_plugin)) {
+            if (empty($_plugin[3])) {
+                if (!is_callable($_plugin[0])) {
+                    $smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
+                } else {
+                    $_plugin[1] = $_tpl_file;
+                    $_plugin[2] = $_tpl_line;
+                    $_plugin[3] = true;
+                    if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */
+                }
+            }
+            continue;
+        } else if ($_type == 'insert') {
+            /*
+             * For backwards compatibility, we check for insert functions in
+             * the symbol table before trying to load them as a plugin.
+             */
+            $_plugin_func = 'insert_' . $_name;
+            if (function_exists($_plugin_func)) {
+                $_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false);
+                continue;
+            }
+        }
+
+        $_plugin_file = $smarty->_get_plugin_filepath($_type, $_name);
+
+        if (! $_found = ($_plugin_file != false)) {
+            $_message = "could not load plugin file '$_type.$_name.php'\n";
+        }
+
+        /*
+         * If plugin file is found, it -must- provide the properly named
+         * plugin function. In case it doesn't, simply output the error and
+         * do not fall back on any other method.
+         */
+        if ($_found) {
+            include_once $_plugin_file;
+
+            $_plugin_func = 'smarty_' . $_type . '_' . $_name;
+            if (!function_exists($_plugin_func)) {
+                $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
+                continue;
+            }
+        }
+        /*
+         * In case of insert plugins, their code may be loaded later via
+         * 'script' attribute.
+         */
+        else if ($_type == 'insert' && $_delayed_loading) {
+            $_plugin_func = 'smarty_' . $_type . '_' . $_name;
+            $_found = true;
+        }
+
+        /*
+         * Plugin specific processing and error checking.
+         */
+        if (!$_found) {
+            if ($_type == 'modifier') {
+                /*
+                 * In case modifier falls back on using PHP functions
+                 * directly, we only allow those specified in the security
+                 * context.
+                 */
+                if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) {
+                    $_message = "(secure mode) modifier '$_name' is not allowed";
+                } else {
+                    if (!function_exists($_name)) {
+                        $_message = "modifier '$_name' is not implemented";
+                    } else {
+                        $_plugin_func = $_name;
+                        $_found = true;
+                    }
+                }
+            } else if ($_type == 'function') {
+                /*
+                 * This is a catch-all situation.
+                 */
+                $_message = "unknown tag - '$_name'";
+            }
+        }
+
+        if ($_found) {
+            $smarty->_plugins[$_type][$_name] = array($_plugin_func, $_tpl_file, $_tpl_line, true, true);
+        } else {
+            // output error
+            $smarty->_trigger_fatal_error('[plugin] ' . $_message, $_tpl_file, $_tpl_line, __FILE__, __LINE__);
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.create_dir_structure.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.create_dir_structure.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.create_dir_structure.php	(revision 1328)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * create full directory structure
+ *
+ * @param string $dir
+ */
+
+// $dir
+
+function smarty_core_create_dir_structure($params, &$smarty)
+{
+    if (!file_exists($params['dir'])) {
+        $_open_basedir_ini = ini_get('open_basedir');
+
+        if (DIRECTORY_SEPARATOR=='/') {
+            /* unix-style paths */
+            $_dir = $params['dir'];
+            $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
+            $_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/';
+            if($_use_open_basedir = !empty($_open_basedir_ini)) {
+                $_open_basedirs = explode(':', $_open_basedir_ini);
+            }
+
+        } else {
+            /* other-style paths */
+            $_dir = str_replace('\\','/', $params['dir']);
+            $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
+            if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) {
+                /* leading "//" for network volume, or "[letter]:/" for full path */
+                $_new_dir = $_root_dir[1];
+                /* remove drive-letter from _dir_parts */
+                if (isset($_root_dir[3])) array_shift($_dir_parts);
+
+            } else {
+                $_new_dir = str_replace('\\', '/', getcwd()).'/';
+
+            }
+
+            if($_use_open_basedir = !empty($_open_basedir_ini)) {
+                $_open_basedirs = explode(';', str_replace('\\', '/', $_open_basedir_ini));
+            }
+
+        }
+
+        /* all paths use "/" only from here */
+        foreach ($_dir_parts as $_dir_part) {
+            $_new_dir .= $_dir_part;
+
+            if ($_use_open_basedir) {
+                // do not attempt to test or make directories outside of open_basedir
+                $_make_new_dir = false;
+                foreach ($_open_basedirs as $_open_basedir) {
+                    if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) {
+                        $_make_new_dir = true;
+                        break;
+                    }
+                }
+            } else {
+                $_make_new_dir = true;
+            }
+
+            if ($_make_new_dir && !file_exists($_new_dir) && !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) {
+                $smarty->trigger_error("problem creating directory '" . $_new_dir . "'");
+                return false;
+            }
+            $_new_dir .= '/';
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.is_secure.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.is_secure.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.is_secure.php	(revision 1328)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * determines if a resource is secure or not.
+ *
+ * @param string $resource_type
+ * @param string $resource_name
+ * @return boolean
+ */
+
+//  $resource_type, $resource_name
+
+function smarty_core_is_secure($params, &$smarty)
+{
+    if (!$smarty->security || $smarty->security_settings['INCLUDE_ANY']) {
+        return true;
+    }
+
+    if ($params['resource_type'] == 'file') {
+        $_rp = realpath($params['resource_name']);
+        if (isset($params['resource_base_path'])) {
+            foreach ((array)$params['resource_base_path'] as $curr_dir) {
+                if ( ($_cd = realpath($curr_dir)) !== false &&
+                     strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                     substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
+                    return true;
+                }
+            }
+        }
+        if (!empty($smarty->secure_dir)) {
+            foreach ((array)$smarty->secure_dir as $curr_dir) {
+                if ( ($_cd = realpath($curr_dir)) !== false) {
+                    if($_cd == $_rp) {
+                        return true;
+                    } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                        substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
+                        return true;
+                    }
+                }
+            }
+        }
+    } else {
+        // resource is not on local file system
+        return call_user_func_array(
+            $smarty->_plugins['resource'][$params['resource_type']][0][2],
+            array($params['resource_name'], &$smarty));
+    }
+
+    return false;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.run_insert_handler.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.run_insert_handler.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.run_insert_handler.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Handle insert tags
+ *
+ * @param array $args
+ * @return string
+ */
+function smarty_core_run_insert_handler($params, &$smarty)
+{
+
+    require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+    if ($smarty->debugging) {
+        $_params = array();
+        $_debug_start_time = smarty_core_get_microtime($_params, $smarty);
+    }
+
+    if ($smarty->caching) {
+        $_arg_string = serialize($params['args']);
+        $_name = $params['args']['name'];
+        if (!isset($smarty->_cache_info['insert_tags'][$_name])) {
+            $smarty->_cache_info['insert_tags'][$_name] = array('insert',
+                                                             $_name,
+                                                             $smarty->_plugins['insert'][$_name][1],
+                                                             $smarty->_plugins['insert'][$_name][2],
+                                                             !empty($params['args']['script']) ? true : false);
+        }
+        return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;
+    } else {
+        if (isset($params['args']['script'])) {
+            $_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
+            require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
+            if(!smarty_core_get_php_resource($_params, $smarty)) {
+                return false;
+            }
+
+            if ($_params['resource_type'] == 'file') {
+                $smarty->_include($_params['php_resource'], true);
+            } else {
+                $smarty->_eval($_params['php_resource']);
+            }
+            unset($params['args']['script']);
+        }
+
+        $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];
+        $_content = $_funcname($params['args'], $smarty);
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[] = array('type'      => 'insert',
+                                                'filename'  => 'insert_'.$params['args']['name'],
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
+        }
+
+        if (!empty($params['args']["assign"])) {
+            $smarty->assign($params['args']["assign"], $_content);
+        } else {
+            return $_content;
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php	(revision 1328)
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * assemble filepath of requested plugin
+ *
+ * @param string $type
+ * @param string $name
+ * @return string|false
+ */
+function smarty_core_assemble_plugin_filepath($params, &$smarty)
+{
+    static $_filepaths_cache = array();
+
+    $_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
+    if (isset($_filepaths_cache[$_plugin_filename])) {
+        return $_filepaths_cache[$_plugin_filename];
+    }
+    $_return = false;
+
+    foreach ((array)$smarty->plugins_dir as $_plugin_dir) {
+
+        $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
+
+        // see if path is relative
+        if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
+            $_relative_paths[] = $_plugin_dir;
+            // relative path, see if it is in the SMARTY_DIR
+            if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
+                $_return = SMARTY_DIR . $_plugin_filepath;
+                break;
+            }
+        }
+        // try relative to cwd (or absolute)
+        if (@is_readable($_plugin_filepath)) {
+            $_return = $_plugin_filepath;
+            break;
+        }
+    }
+
+    if($_return === false) {
+        // still not found, try PHP include_path
+        if(isset($_relative_paths)) {
+            foreach ((array)$_relative_paths as $_plugin_dir) {
+
+                $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
+
+                $_params = array('file_path' => $_plugin_filepath);
+                require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
+                if(smarty_core_get_include_path($_params, $smarty)) {
+                    $_return = $_params['new_file_path'];
+                    break;
+                }
+            }
+        }
+    }
+    $_filepaths_cache[$_plugin_filename] = $_return;
+    return $_return;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.is_trusted.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.is_trusted.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.is_trusted.php	(revision 1328)
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * determines if a resource is trusted or not
+ *
+ * @param string $resource_type
+ * @param string $resource_name
+ * @return boolean
+ */
+
+ // $resource_type, $resource_name
+
+function smarty_core_is_trusted($params, &$smarty)
+{
+    $_smarty_trusted = false;
+    if ($params['resource_type'] == 'file') {
+        if (!empty($smarty->trusted_dir)) {
+            $_rp = realpath($params['resource_name']);
+            foreach ((array)$smarty->trusted_dir as $curr_dir) {
+                if (!empty($curr_dir) && is_readable ($curr_dir)) {
+                    $_cd = realpath($curr_dir);
+                    if (strncmp($_rp, $_cd, strlen($_cd)) == 0
+                        && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
+                        $_smarty_trusted = true;
+                        break;
+                    }
+                }
+            }
+        }
+
+    } else {
+        // resource is not on local file system
+        $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
+                                                array($params['resource_name'], $smarty));
+    }
+
+    return $_smarty_trusted;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.get_microtime.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.get_microtime.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.get_microtime.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Get seconds and microseconds
+ * @return double
+ */
+function smarty_core_get_microtime($params, &$smarty)
+{
+    $mtime = microtime();
+    $mtime = explode(" ", $mtime);
+    $mtime = (double)($mtime[1]) + (double)($mtime[0]);
+    return ($mtime);
+}
+
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.smarty_include_php.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.smarty_include_php.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.smarty_include_php.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * called for included php files within templates
+ *
+ * @param string $smarty_file
+ * @param string $smarty_assign variable to assign the included template's
+ *               output into
+ * @param boolean $smarty_once uses include_once if this is true
+ * @param array $smarty_include_vars associative array of vars from
+ *              {include file="blah" var=$var}
+ */
+
+//  $file, $assign, $once, $_smarty_include_vars
+
+function smarty_core_smarty_include_php($params, &$smarty)
+{
+    $_params = array('resource_name' => $params['smarty_file']);
+    require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
+    smarty_core_get_php_resource($_params, $smarty);
+    $_smarty_resource_type = $_params['resource_type'];
+    $_smarty_php_resource = $_params['php_resource'];
+
+    if (!empty($params['smarty_assign'])) {
+        ob_start();
+        if ($_smarty_resource_type == 'file') {
+            $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
+        } else {
+            $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
+        }
+        $smarty->assign($params['smarty_assign'], ob_get_contents());
+        ob_end_clean();
+    } else {
+        if ($_smarty_resource_type == 'file') {
+            $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
+        } else {
+            $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
+        }
+    }
+}
+
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.write_file.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.write_file.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.write_file.php	(revision 1328)
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * write out a file to disk
+ *
+ * @param string $filename
+ * @param string $contents
+ * @param boolean $create_dirs
+ * @return boolean
+ */
+function smarty_core_write_file($params, &$smarty)
+{
+    $_dirname = dirname($params['filename']);
+
+    if ($params['create_dirs']) {
+        $_params = array('dir' => $_dirname);
+        require_once(SMARTY_CORE_DIR . 'core.create_dir_structure.php');
+        smarty_core_create_dir_structure($_params, $smarty);
+    }
+
+    // write to tmp file, then rename it to avoid
+    // file locking race condition
+    $_tmp_file = tempnam($_dirname, 'wrt');
+
+    if (!($fd = @fopen($_tmp_file, 'wb'))) {
+        $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt');
+        if (!($fd = @fopen($_tmp_file, 'wb'))) {
+            $smarty->trigger_error("problem writing temporary file '$_tmp_file'");
+            return false;
+        }
+    }
+
+    fwrite($fd, $params['contents']);
+    fclose($fd);
+
+    // Delete the file if it allready exists (this is needed on Win,
+    // because it cannot overwrite files with rename()
+    if (file_exists($params['filename'])) {
+        @unlink($params['filename']);
+    }
+    @rename($_tmp_file, $params['filename']);
+    @chmod($params['filename'], $smarty->_file_perms);
+
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.read_cache_file.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.read_cache_file.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.read_cache_file.php	(revision 1328)
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * read a cache file, determine if it needs to be
+ * regenerated or not
+ *
+ * @param string $tpl_file
+ * @param string $cache_id
+ * @param string $compile_id
+ * @param string $results
+ * @return boolean
+ */
+
+//  $tpl_file, $cache_id, $compile_id, &$results
+
+function smarty_core_read_cache_file(&$params, &$smarty)
+{
+    static  $content_cache = array();
+
+    if ($smarty->force_compile) {
+        // force compile enabled, always regenerate
+        return false;
+    }
+
+    if (isset($content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']])) {
+        list($params['results'], $smarty->_cache_info) = $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']];
+        return true;
+    }
+
+    if (!empty($smarty->cache_handler_func)) {
+        // use cache_handler function
+        call_user_func_array($smarty->cache_handler_func,
+                             array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null));
+    } else {
+        // use local cache file
+        $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
+        $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
+        $params['results'] = $smarty->_read_file($_cache_file);
+    }
+
+    if (empty($params['results'])) {
+        // nothing to parse (error?), regenerate cache
+        return false;
+    }
+
+    $_contents = $params['results'];
+    $_info_start = strpos($_contents, "\n") + 1;
+    $_info_len = (int)substr($_contents, 0, $_info_start - 1);
+    $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len));
+    $params['results'] = substr($_contents, $_info_start + $_info_len);
+
+    if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
+        // caching by expiration time
+        if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) {
+            // cache expired, regenerate
+            return false;
+        }
+    } else {
+        // caching by lifetime
+        if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) {
+            // cache expired, regenerate
+            return false;
+        }
+    }
+
+    if ($smarty->compile_check) {
+        $_params = array('get_source' => false, 'quiet'=>true);
+        foreach (array_keys($_cache_info['template']) as $_template_dep) {
+            $_params['resource_name'] = $_template_dep;
+            if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
+                // template file has changed, regenerate cache
+                return false;
+            }
+        }
+
+        if (isset($_cache_info['config'])) {
+            $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true);
+            foreach (array_keys($_cache_info['config']) as $_config_dep) {
+                $_params['resource_name'] = $_config_dep;
+                if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
+                    // config file has changed, regenerate cache
+                    return false;
+                }
+            }
+        }
+    }
+
+    $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info);
+
+    $smarty->_cache_info = $_cache_info;
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.process_compiled_include.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.process_compiled_include.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.process_compiled_include.php	(revision 1328)
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Replace nocache-tags by results of the corresponding non-cacheable
+ * functions and return it
+ *
+ * @param string $compiled_tpl
+ * @param string $cached_source
+ * @return string
+ */
+
+function smarty_core_process_compiled_include($params, &$smarty)
+{
+    $_cache_including = $smarty->_cache_including;
+    $smarty->_cache_including = true;
+
+    $_return = $params['results'];
+
+    foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
+        $smarty->_include($_include_file_path, true);
+    }
+
+    foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) {
+        $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
+                                         array(&$smarty, '_process_compiled_include_callback'),
+                                         $_return);
+    }
+    $smarty->_cache_including = $_cache_including;
+    return $_return;
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.get_php_resource.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.get_php_resource.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.get_php_resource.php	(revision 1328)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Retrieves PHP script resource
+ *
+ * sets $php_resource to the returned resource
+ * @param string $resource
+ * @param string $resource_type
+ * @param  $php_resource
+ * @return boolean
+ */
+
+function smarty_core_get_php_resource(&$params, &$smarty)
+{
+
+    $params['resource_base_path'] = $smarty->trusted_dir;
+    $smarty->_parse_resource_name($params, $smarty);
+
+    /*
+     * Find out if the resource exists.
+     */
+
+    if ($params['resource_type'] == 'file') {
+        $_readable = false;
+        if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) {
+            $_readable = true;
+        } else {
+            // test for file in include_path
+            $_params = array('file_path' => $params['resource_name']);
+            require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
+            if(smarty_core_get_include_path($_params, $smarty)) {
+                $_include_path = $_params['new_file_path'];
+                $_readable = true;
+            }
+        }
+    } else if ($params['resource_type'] != 'file') {
+        $_template_source = null;
+        $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])
+            && call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
+                                    array($params['resource_name'], &$_template_source, &$smarty));
+    }
+
+    /*
+     * Set the error function, depending on which class calls us.
+     */
+    if (method_exists($smarty, '_syntax_error')) {
+        $_error_funcc = '_syntax_error';
+    } else {
+        $_error_funcc = 'trigger_error';
+    }
+
+    if ($_readable) {
+        if ($smarty->security) {
+            require_once(SMARTY_CORE_DIR . 'core.is_trusted.php');
+            if (!smarty_core_is_trusted($params, $smarty)) {
+                $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
+                return false;
+            }
+        }
+    } else {
+        $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');
+        return false;
+    }
+
+    if ($params['resource_type'] == 'file') {
+        $params['php_resource'] = $params['resource_name'];
+    } else {
+        $params['php_resource'] = $_template_source;
+    }
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.display_debug_console.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.display_debug_console.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.display_debug_console.php	(revision 1328)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty debug_console function plugin
+ *
+ * Type:     core<br>
+ * Name:     display_debug_console<br>
+ * Purpose:  display the javascript debug console window
+ * @param array Format: null
+ * @param Smarty
+ */
+function smarty_core_display_debug_console($params, &$smarty)
+{
+    // we must force compile the debug template in case the environment
+    // changed between separate applications.
+
+    if(empty($smarty->debug_tpl)) {
+        // set path to debug template from SMARTY_DIR
+        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
+        if($smarty->security && is_file($smarty->debug_tpl)) {
+            $smarty->secure_dir[] = realpath($smarty->debug_tpl);
+        }
+        $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
+    }
+
+    $_ldelim_orig = $smarty->left_delimiter;
+    $_rdelim_orig = $smarty->right_delimiter;
+
+    $smarty->left_delimiter = '{';
+    $smarty->right_delimiter = '}';
+
+    $_compile_id_orig = $smarty->_compile_id;
+    $smarty->_compile_id = null;
+
+    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
+    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
+    {
+        ob_start();
+        $smarty->_include($_compile_path);
+        $_results = ob_get_contents();
+        ob_end_clean();
+    } else {
+        $_results = '';
+    }
+
+    $smarty->_compile_id = $_compile_id_orig;
+
+    $smarty->left_delimiter = $_ldelim_orig;
+    $smarty->right_delimiter = $_rdelim_orig;
+
+    return $_results;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/internals/core.get_include_path.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/internals/core.get_include_path.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/internals/core.get_include_path.php	(revision 1328)
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Get path to file from include_path
+ *
+ * @param string $file_path
+ * @param string $new_file_path
+ * @return boolean
+ * @staticvar array|null
+ */
+
+//  $file_path, &$new_file_path
+
+function smarty_core_get_include_path(&$params, &$smarty)
+{
+    static $_path_array = null;
+
+    if(!isset($_path_array)) {
+        $_ini_include_path = ini_get('include_path');
+
+        if(strstr($_ini_include_path,';')) {
+            // windows pathnames
+            $_path_array = explode(';',$_ini_include_path);
+        } else {
+            $_path_array = explode(':',$_ini_include_path);
+        }
+    }
+    foreach ($_path_array as $_include_path) {
+        if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
+               $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
+            return true;
+        }
+    }
+    return false;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.default.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.default.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.default.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty default modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     default<br>
+ * Purpose:  designate default value for empty variables
+ * @link http://smarty.php.net/manual/en/language.modifier.default.php
+ *          default (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_default($string, $default = '')
+{
+    if (!isset($string) || $string === '')
+        return $default;
+    else
+        return $string;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.capitalize.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.capitalize.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.capitalize.php	(revision 1328)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty capitalize modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     capitalize<br>
+ * Purpose:  capitalize words in the string
+ * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
+ *      capitalize (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_capitalize($string, $uc_digits = false)
+{
+    smarty_modifier_capitalize_ucfirst(null, $uc_digits);
+    return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string);
+}
+
+function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
+{
+    static $_uc_digits = false;
+    
+    if(isset($uc_digits)) {
+        $_uc_digits = $uc_digits;
+        return;
+    }
+    
+    if(!preg_match('!\d!',$string[0]) || $_uc_digits)
+        return ucfirst($string[0]);
+    else
+        return $string[0];
+}
+
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.date_format.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.date_format.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.date_format.php	(revision 1328)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Include the {@link shared.make_timestamp.php} plugin
+ */
+require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
+/**
+ * Smarty date_format modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     date_format<br>
+ * Purpose:  format datestamps via strftime<br>
+ * Input:<br>
+ *         - string: input date string
+ *         - format: strftime format for output
+ *         - default_date: default date if $string is empty
+ * @link http://smarty.php.net/manual/en/language.modifier.date.format.php
+ *          date_format (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @param string
+ * @return string|void
+ * @uses smarty_make_timestamp()
+ */
+function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
+{
+    if (substr(PHP_OS,0,3) == 'WIN') {
+           $_win_from = array ('%e',  '%T',       '%D');
+           $_win_to   = array ('%#d', '%H:%M:%S', '%m/%d/%y');
+           $format = str_replace($_win_from, $_win_to, $format);
+    }
+    if($string != '') {
+        return strftime($format, smarty_make_timestamp($string));
+    } elseif (isset($default_date) && $default_date != '') {
+        return strftime($format, smarty_make_timestamp($default_date));
+    } else {
+        return;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.cycle.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.cycle.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.cycle.php	(revision 1328)
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {cycle} function plugin
+ *
+ * Type:     function<br>
+ * Name:     cycle<br>
+ * Date:     May 3, 2002<br>
+ * Purpose:  cycle through given values<br>
+ * Input:
+ *         - name = name of cycle (optional)
+ *         - values = comma separated list of values to cycle,
+ *                    or an array of values to cycle
+ *                    (this can be left out for subsequent calls)
+ *         - reset = boolean - resets given var to true
+ *         - print = boolean - print var or not. default is true
+ *         - advance = boolean - whether or not to advance the cycle
+ *         - delimiter = the value delimiter, default is ","
+ *         - assign = boolean, assigns to template var instead of
+ *                    printed.
+ *
+ * Examples:<br>
+ * <pre>
+ * {cycle values="#eeeeee,#d0d0d0d"}
+ * {cycle name=row values="one,two,three" reset=true}
+ * {cycle name=row}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credit to Mark Priatel <mpriatel@rogers.com>
+ * @author credit to Gerard <gerard@interfold.com>
+ * @author credit to Jason Sweat <jsweat_php@yahoo.com>
+ * @version  1.3
+ * @param array
+ * @param Smarty
+ * @return string|null
+ */
+function smarty_function_cycle($params, &$smarty)
+{
+    static $cycle_vars;
+    
+    $name = (empty($params['name'])) ? 'default' : $params['name'];
+    $print = (isset($params['print'])) ? (bool)$params['print'] : true;
+    $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true;
+    $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;
+            
+    if (!in_array('values', array_keys($params))) {
+        if(!isset($cycle_vars[$name]['values'])) {
+            $smarty->trigger_error("cycle: missing 'values' parameter");
+            return;
+        }
+    } else {
+        if(isset($cycle_vars[$name]['values'])
+            && $cycle_vars[$name]['values'] != $params['values'] ) {
+            $cycle_vars[$name]['index'] = 0;
+        }
+        $cycle_vars[$name]['values'] = $params['values'];
+    }
+
+    $cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ',';
+    
+    if(is_array($cycle_vars[$name]['values'])) {
+        $cycle_array = $cycle_vars[$name]['values'];
+    } else {
+        $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);
+    }
+    
+    if(!isset($cycle_vars[$name]['index']) || $reset ) {
+        $cycle_vars[$name]['index'] = 0;
+    }
+    
+    if (isset($params['assign'])) {
+        $print = false;
+        $smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
+    }
+        
+    if($print) {
+        $retval = $cycle_array[$cycle_vars[$name]['index']];
+    } else {
+        $retval = null;
+    }
+
+    if($advance) {
+        if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
+            $cycle_vars[$name]['index'] = 0;
+        } else {
+            $cycle_vars[$name]['index']++;
+        }
+    }
+    
+    return $retval;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_characters.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_characters.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_characters.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_characters modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_characteres<br>
+ * Purpose:  count the number of characters in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php
+ *          count_characters (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param boolean include whitespace in the character count
+ * @return integer
+ */
+function smarty_modifier_count_characters($string, $include_spaces = false)
+{
+    if ($include_spaces)
+       return(strlen($string));
+
+    return preg_match_all("/[^\s]/",$string, $match);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.lower.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.lower.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.lower.php	(revision 1328)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty lower modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     lower<br>
+ * Purpose:  convert string to lowercase
+ * @link http://smarty.php.net/manual/en/language.modifier.lower.php
+ *          lower (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_lower($string)
+{
+    return strtolower($string);
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/block.textformat.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/block.textformat.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/block.textformat.php	(revision 1328)
@@ -0,0 +1,103 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {textformat}{/textformat} block plugin
+ *
+ * Type:     block function<br>
+ * Name:     textformat<br>
+ * Purpose:  format text a certain way with preset styles
+ *           or custom wrap/indent settings<br>
+ * @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat}
+ *       (Smarty online manual)
+ * @param array
+ * <pre>
+ * Params:   style: string (email)
+ *           indent: integer (0)
+ *           wrap: integer (80)
+ *           wrap_char string ("\n")
+ *           indent_char: string (" ")
+ *           wrap_boundary: boolean (true)
+ * </pre>
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param string contents of the block
+ * @param Smarty clever simulation of a method
+ * @return string string $content re-formatted
+ */
+function smarty_block_textformat($params, $content, &$smarty)
+{
+    if (is_null($content)) {
+        return;
+    }
+
+    $style = null;
+    $indent = 0;
+    $indent_first = 0;
+    $indent_char = ' ';
+    $wrap = 80;
+    $wrap_char = "\n";
+    $wrap_cut = false;
+    $assign = null;
+    
+    foreach ($params as $_key => $_val) {
+        switch ($_key) {
+            case 'style':
+            case 'indent_char':
+            case 'wrap_char':
+            case 'assign':
+                $$_key = (string)$_val;
+                break;
+
+            case 'indent':
+            case 'indent_first':
+            case 'wrap':
+                $$_key = (int)$_val;
+                break;
+
+            case 'wrap_cut':
+                $$_key = (bool)$_val;
+                break;
+
+            default:
+                $smarty->trigger_error("textformat: unknown attribute '$_key'");
+        }
+    }
+
+    if ($style == 'email') {
+        $wrap = 72;
+    }
+
+    // split into paragraphs
+    $_paragraphs = preg_split('![\r\n][\r\n]!',$content);
+    $_output = '';
+
+    for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
+        if ($_paragraphs[$_x] == '') {
+            continue;
+        }
+        // convert mult. spaces & special chars to single space
+        $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]);
+        // indent first line
+        if($indent_first > 0) {
+            $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x];
+        }
+        // wordwrap sentences
+        $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut);
+        // indent lines
+        if($indent > 0) {
+            $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]);
+        }
+    }
+    $_output = implode($wrap_char . $wrap_char, $_paragraphs);
+
+    return $assign ? $smarty->assign($assign, $_output) : $_output;
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.popup.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.popup.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.popup.php	(revision 1328)
@@ -0,0 +1,119 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {popup} function plugin
+ *
+ * Type:     function<br>
+ * Name:     popup<br>
+ * Purpose:  make text pop up in windows via overlib
+ * @link http://smarty.php.net/manual/en/language.function.popup.php {popup}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_popup($params, &$smarty)
+{
+    $append = '';
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'text':
+            case 'trigger':
+            case 'function':
+            case 'inarray':
+                $$_key = (string)$_value;
+                if ($_key == 'function' || $_key == 'inarray')
+                    $append .= ',' . strtoupper($_key) . ",'$_value'";
+                break;
+
+            case 'caption':
+            case 'closetext':
+            case 'status':
+                $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
+                break;
+
+            case 'fgcolor':
+            case 'bgcolor':
+            case 'textcolor':
+            case 'capcolor':
+            case 'closecolor':
+            case 'textfont':
+            case 'captionfont':
+            case 'closefont':
+            case 'fgbackground':
+            case 'bgbackground':
+            case 'caparray':
+            case 'capicon':
+            case 'background':
+            case 'frame':
+                $append .= ',' . strtoupper($_key) . ",'$_value'";
+                break;
+
+            case 'textsize':
+            case 'captionsize':
+            case 'closesize':
+            case 'width':
+            case 'height':
+            case 'border':
+            case 'offsetx':
+            case 'offsety':
+            case 'snapx':
+            case 'snapy':
+            case 'fixx':
+            case 'fixy':
+            case 'padx':
+            case 'pady':
+            case 'timeout':
+            case 'delay':
+                $append .= ',' . strtoupper($_key) . ",$_value";
+                break;
+
+            case 'sticky':
+            case 'left':
+            case 'right':
+            case 'center':
+            case 'above':
+            case 'below':
+            case 'noclose':
+            case 'autostatus':
+            case 'autostatuscap':
+            case 'fullhtml':
+            case 'hauto':
+            case 'vauto':
+            case 'mouseoff':
+            case 'followmouse':
+            case 'closeclick':
+                if ($_value) $append .= ',' . strtoupper($_key);
+                break;
+
+            default:
+                $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
+        }
+    }
+
+    if (empty($text) && !isset($inarray) && empty($function)) {
+        $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
+        return false;
+    }
+
+    if (empty($trigger)) { $trigger = "onmouseover"; }
+
+    $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
+    $retval .= $append . ');"';
+    if ($trigger == 'onmouseover')
+       $retval .= ' onmouseout="nd();"';
+
+
+    return $retval;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.assign_debug_info.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.assign_debug_info.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.assign_debug_info.php	(revision 1328)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {assign_debug_info} function plugin
+ *
+ * Type:     function<br>
+ * Name:     assign_debug_info<br>
+ * Purpose:  assign debug info to the template<br>
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array unused in this plugin, this plugin uses {@link Smarty::$_config},
+ *              {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info}
+ * @param Smarty
+ */
+function smarty_function_assign_debug_info($params, &$smarty)
+{
+    $assigned_vars = $smarty->_tpl_vars;
+    ksort($assigned_vars);
+    if (@is_array($smarty->_config[0])) {
+        $config_vars = $smarty->_config[0];
+        ksort($config_vars);
+        $smarty->assign("_debug_config_keys", array_keys($config_vars));
+        $smarty->assign("_debug_config_vals", array_values($config_vars));
+    }
+    
+    $included_templates = $smarty->_smarty_debug_info;
+    
+    $smarty->assign("_debug_keys", array_keys($assigned_vars));
+    $smarty->assign("_debug_vals", array_values($assigned_vars));
+    
+    $smarty->assign("_debug_tpls", $included_templates);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_radios.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_radios.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_radios.php	(revision 1328)
@@ -0,0 +1,156 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_radios} function plugin
+ *
+ * File:       function.html_radios.php<br>
+ * Type:       function<br>
+ * Name:       html_radios<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of radio input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "radio"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each radio button
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_radios values=$ids output=$names}
+ * {html_radios values=$ids name='box' separator='<br>' output=$names}
+ * {html_radios values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_radios($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+   
+    $name = 'radio';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $label_ids = false;
+    $output = null;
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+            case 'separator':
+                $$_key = (string)$_val;
+                break;
+
+            case 'checked':
+            case 'selected':
+                if(is_array($_val)) {
+                    $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
+                } else {
+                    $selected = (string)$_val;
+                }
+                break;
+
+            case 'labels':
+            case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'radios':
+                $smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
+
+    } else {
+
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
+    $_output = '';
+    if ($labels) {
+      if($label_ids) {
+          $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+          $_output .= '<label for="' . $_id . '">';
+      } else {
+          $_output .= '<label>';           
+      }
+   }
+   $_output .= '<input type="radio" name="'
+        . smarty_function_escape_special_chars($name) . '" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+
+   if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
+
+    if ((string)$value==$selected) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />' . $output;
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php	(revision 1328)
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty trimwhitespace outputfilter plugin
+ *
+ * File:     outputfilter.trimwhitespace.php<br>
+ * Type:     outputfilter<br>
+ * Name:     trimwhitespace<br>
+ * Date:     Jan 25, 2003<br>
+ * Purpose:  trim leading white space and blank lines from
+ *           template source after it gets interpreted, cleaning
+ *           up code and saving bandwidth. Does not affect
+ *           <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br>
+ * Install:  Drop into the plugin directory, call
+ *           <code>$smarty->load_filter('output','trimwhitespace');</code>
+ *           from application.
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
+ * @version  1.3
+ * @param string
+ * @param Smarty
+ */
+function smarty_outputfilter_trimwhitespace($source, &$smarty)
+{
+    // Pull out the script blocks
+    preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match);
+    $_script_blocks = $match[0];
+    $source = preg_replace("!<script[^>]+>.*?</script>!is",
+                           '@@@SMARTY:TRIM:SCRIPT@@@', $source);
+
+    // Pull out the pre blocks
+    preg_match_all("!<pre>.*?</pre>!is", $source, $match);
+    $_pre_blocks = $match[0];
+    $source = preg_replace("!<pre>.*?</pre>!is",
+                           '@@@SMARTY:TRIM:PRE@@@', $source);
+
+    // Pull out the textarea blocks
+    preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $source, $match);
+    $_textarea_blocks = $match[0];
+    $source = preg_replace("!<textarea[^>]+>.*?</textarea>!is",
+                           '@@@SMARTY:TRIM:TEXTAREA@@@', $source);
+
+    // remove all leading spaces, tabs and carriage returns NOT
+    // preceeded by a php close tag.
+    $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
+
+    // replace script blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
+
+    // replace pre blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
+
+    // replace textarea blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
+
+    return $source;
+}
+
+function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) {
+    $_len = strlen($search_str);
+    $_pos = 0;
+    for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
+        if (($_pos=strpos($subject, $search_str, $_pos))!==false)
+            $subject = substr_replace($subject, $replace[$_i], $_pos, $_len);
+        else
+            break;
+
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_table.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_table.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_table.php	(revision 1328)
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_table} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_table<br>
+ * Date:     Feb 17, 2003<br>
+ * Purpose:  make an html table from an array of data<br>
+ * Input:<br>
+ *         - loop = array to loop through
+ *         - cols = number of columns
+ *         - rows = number of rows
+ *         - table_attr = table attributes
+ *         - tr_attr = table row attributes (arrays are cycled)
+ *         - td_attr = table cell attributes (arrays are cycled)
+ *         - trailpad = value to pad trailing cells with
+ *         - vdir = vertical direction (default: "down", means top-to-bottom)
+ *         - hdir = horizontal direction (default: "right", means left-to-right)
+ *         - inner = inner loop (default "cols": print $loop line by line,
+ *                   $loop will be printed column by column otherwise)
+ *
+ *
+ * Examples:
+ * <pre>
+ * {table loop=$data}
+ * {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
+ * {table loop=$data cols=4 tr_attr=$colors}
+ * </pre>
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version  1.0
+ * @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
+ *          (Smarty online manual)
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_html_table($params, &$smarty)
+{
+    $table_attr = 'border="1"';
+    $tr_attr = '';
+    $td_attr = '';
+    $cols = 3;
+    $rows = 3;
+    $trailpad = '&nbsp;';
+    $vdir = 'down';
+    $hdir = 'right';
+    $inner = 'cols';
+
+    if (!isset($params['loop'])) {
+        $smarty->trigger_error("html_table: missing 'loop' parameter");
+        return;
+    }
+
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'loop':
+                $$_key = (array)$_value;
+                break;
+
+            case 'cols':
+            case 'rows':
+                $$_key = (int)$_value;
+                break;
+
+            case 'table_attr':
+            case 'trailpad':
+            case 'hdir':
+            case 'vdir':
+            case 'inner':
+                $$_key = (string)$_value;
+                break;
+
+            case 'tr_attr':
+            case 'td_attr':
+                $$_key = $_value;
+                break;
+        }
+    }
+
+    $loop_count = count($loop);
+    if (empty($params['rows'])) {
+        /* no rows specified */
+        $rows = ceil($loop_count/$cols);
+    } elseif (empty($params['cols'])) {
+        if (!empty($params['rows'])) {
+            /* no cols specified, but rows */
+            $cols = ceil($loop_count/$rows);
+        }
+    }
+
+    $output = "<table $table_attr>\n";
+
+    for ($r=0; $r<$rows; $r++) {
+        $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
+        $rx =  ($vdir == 'down') ? $r*$cols : ($rows-1-$r)*$cols;
+
+        for ($c=0; $c<$cols; $c++) {
+            $x =  ($hdir == 'right') ? $rx+$c : $rx+$cols-1-$c;
+            if ($inner!='cols') {
+                /* shuffle x to loop over rows*/
+                $x = floor($x/$cols) + ($x%$cols)*$rows;
+            }
+
+            if ($x<$loop_count) {
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n";
+            } else {
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
+            }
+        }
+        $output .= "</tr>\n";
+    }
+    $output .= "</table>\n";
+    
+    return $output;
+}
+
+function smarty_function_html_table_cycle($name, $var, $no) {
+    if(!is_array($var)) {
+        $ret = $var;
+    } else {
+        $ret = $var[$no % count($var)];
+    }
+    
+    return ($ret) ? ' '.$ret : '';
+}
+
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.wordwrap.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.wordwrap.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.wordwrap.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty wordwrap modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     wordwrap<br>
+ * Purpose:  wrap a string of text at a given length
+ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php
+ *          wordwrap (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
+{
+    return wordwrap($string,$length,$break,$cut);
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.regex_replace.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.regex_replace.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.regex_replace.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty regex_replace modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     regex_replace<br>
+ * Purpose:  regular expression search/replace
+ * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
+ *          regex_replace (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string|array
+ * @param string|array
+ * @return string
+ */
+function smarty_modifier_regex_replace($string, $search, $replace)
+{
+    if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
+        /* remove eval-modifier from $search */
+        $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
+    }
+       
+    return preg_replace($search, $replace, $string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.counter.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.counter.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.counter.php	(revision 1328)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {counter} function plugin
+ *
+ * Type:     function<br>
+ * Name:     counter<br>
+ * Purpose:  print out a counter value
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @link http://smarty.php.net/manual/en/language.function.counter.php {counter}
+ *       (Smarty online manual)
+ * @param array parameters
+ * @param Smarty
+ * @return string|null
+ */
+function smarty_function_counter($params, &$smarty)
+{
+    static $counters = array();
+
+    $name = (isset($params['name'])) ? $params['name'] : 'default';
+    if (!isset($counters[$name])) {
+        $counters[$name] = array(
+            'start'=>1,
+            'skip'=>1,
+            'direction'=>'up',
+            'count'=>1
+            );
+    }
+    $counter =& $counters[$name];
+
+    if (isset($params['start'])) {
+        $counter['start'] = $counter['count'] = (int)$params['start'];
+    }
+
+    if (!empty($params['assign'])) {
+        $counter['assign'] = $params['assign'];
+    }
+
+    if (isset($counter['assign'])) {
+        $smarty->assign($counter['assign'], $counter['count']);
+    }
+    
+    if (isset($params['print'])) {
+        $print = (bool)$params['print'];
+    } else {
+        $print = empty($counter['assign']);
+    }
+
+    if ($print) {
+        $retval = $counter['count'];
+    } else {
+        $retval = null;
+    }
+
+    if (isset($params['skip'])) {
+        $counter['skip'] = $params['skip'];
+    }
+    
+    if (isset($params['direction'])) {
+        $counter['direction'] = $params['direction'];
+    }
+
+    if ($counter['direction'] == "down")
+        $counter['count'] -= $counter['skip'];
+    else
+        $counter['count'] += $counter['skip'];
+    
+    return $retval;
+    
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_options.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_options.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_options.php	(revision 1328)
@@ -0,0 +1,122 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_options} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_options<br>
+ * Input:<br>
+ *           - name       (optional) - string default "select"
+ *           - values     (required if no options supplied) - array
+ *           - options    (required if no values supplied) - associative array
+ *           - selected   (optional) - string default not set
+ *           - output     (required if not options supplied) - array
+ * Purpose:  Prints the list of <option> tags generated from
+ *           the passed parameters
+ * @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
+ *      (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_options($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    
+    $name = null;
+    $values = null;
+    $options = null;
+    $selected = array();
+    $output = null;
+    
+    $extra = '';
+    
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+                $$_key = (string)$_val;
+                break;
+            
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+                
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'selected':
+                $$_key = array_map('strval', array_values((array)$_val));
+                break;
+                
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = '';
+
+    if (isset($options)) {
+        
+        foreach ($options as $_key=>$_val)
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+
+    } else {
+        
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+        }
+
+    }
+
+    if(!empty($name)) {
+        $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
+    }
+
+    return $_html_result;
+
+}
+
+function smarty_function_html_options_optoutput($key, $value, $selected) {
+    if(!is_array($value)) {
+        $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
+            smarty_function_escape_special_chars($key) . '"';
+        if (in_array((string)$key, $selected))
+            $_html_result .= ' selected="selected"';
+        $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
+    } else {
+        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
+    }
+    return $_html_result;
+}
+
+function smarty_function_html_options_optgroup($key, $values, $selected) {
+    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
+    foreach ($values as $key => $value) {
+        $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
+    }
+    $optgroup_html .= "</optgroup>\n";
+    return $optgroup_html;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_select_time.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_select_time.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_select_time.php	(revision 1328)
@@ -0,0 +1,194 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_select_time} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_select_time<br>
+ * Purpose:  Prints the dropdowns for time selection
+ * @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
+ *          (Smarty online manual)
+ * @author Roberto Berto <roberto@berto.net>
+ * @credits Monte Ohrt <monte AT ohrt DOT com>
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_make_timestamp()
+ */
+function smarty_function_html_select_time($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
+    require_once $smarty->_get_plugin_filepath('function','html_options');
+    /* Default values. */
+    $prefix             = "Time_";
+    $time               = time();
+    $display_hours      = true;
+    $display_minutes    = true;
+    $display_seconds    = true;
+    $display_meridian   = true;
+    $use_24_hours       = true;
+    $minute_interval    = 1;
+    $second_interval    = 1;
+    /* Should the select boxes be part of an array when returned from PHP?
+       e.g. setting it to "birthday", would create "birthday[Hour]",
+       "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
+       Can be combined with prefix. */
+    $field_array        = null;
+    $all_extra          = null;
+    $hour_extra         = null;
+    $minute_extra       = null;
+    $second_extra       = null;
+    $meridian_extra     = null;
+
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'prefix':
+            case 'time':
+            case 'field_array':
+            case 'all_extra':
+            case 'hour_extra':
+            case 'minute_extra':
+            case 'second_extra':
+            case 'meridian_extra':
+                $$_key = (string)$_value;
+                break;
+
+            case 'display_hours':
+            case 'display_minutes':
+            case 'display_seconds':
+            case 'display_meridian':
+            case 'use_24_hours':
+                $$_key = (bool)$_value;
+                break;
+
+            case 'minute_interval':
+            case 'second_interval':
+                $$_key = (int)$_value;
+                break;
+
+            default:
+                $smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING);
+        }
+    }
+
+    $time = smarty_make_timestamp($time);
+
+    $html_result = '';
+
+    if ($display_hours) {
+        $hours       = $use_24_hours ? range(0, 23) : range(1, 12);
+        $hour_fmt = $use_24_hours ? '%H' : '%I';
+        for ($i = 0, $for_max = count($hours); $i < $for_max; $i++)
+            $hours[$i] = sprintf('%02d', $hours[$i]);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Hour"';
+        }
+        if (null !== $hour_extra){
+            $html_result .= ' ' . $hour_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        $html_result .= smarty_function_html_options(array('output'          => $hours,
+                                                           'values'          => $hours,
+                                                           'selected'      => strftime($hour_fmt, $time),
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    if ($display_minutes) {
+        $all_minutes = range(0, 59);
+        for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval)
+            $minutes[] = sprintf('%02d', $all_minutes[$i]);
+        $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Minute"';
+        }
+        if (null !== $minute_extra){
+            $html_result .= ' ' . $minute_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        
+        $html_result .= smarty_function_html_options(array('output'          => $minutes,
+                                                           'values'          => $minutes,
+                                                           'selected'      => $selected,
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    if ($display_seconds) {
+        $all_seconds = range(0, 59);
+        for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval)
+            $seconds[] = sprintf('%02d', $all_seconds[$i]);
+        $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Second"';
+        }
+        
+        if (null !== $second_extra){
+            $html_result .= ' ' . $second_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        
+        $html_result .= smarty_function_html_options(array('output'          => $seconds,
+                                                           'values'          => $seconds,
+                                                           'selected'      => $selected,
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    if ($display_meridian && !$use_24_hours) {
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Meridian"';
+        }
+        
+        if (null !== $meridian_extra){
+            $html_result .= ' ' . $meridian_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        
+        $html_result .= smarty_function_html_options(array('output'          => array('AM', 'PM'),
+                                                           'values'          => array('am', 'pm'),
+                                                           'selected'      => strtolower(strftime('%p', $time)),
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    return $html_result;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/shared.make_timestamp.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/shared.make_timestamp.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/shared.make_timestamp.php	(revision 1328)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Smarty shared plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Function: smarty_make_timestamp<br>
+ * Purpose:  used by other smarty functions to make a timestamp
+ *           from a string.
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_make_timestamp($string)
+{
+    if(empty($string)) {
+        // use "now":
+        $time = time();
+
+    } elseif (preg_match('/^\d{14}$/', $string)) {
+        // it is mysql timestamp format of YYYYMMDDHHMMSS?            
+        $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),
+                       substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
+        
+    } elseif (is_numeric($string)) {
+        // it is a numeric string, we handle it as timestamp
+        $time = (int)$string;
+        
+    } else {
+        // strtotime should handle it
+        $time = strtotime($string);
+        if ($time == -1 || $time === false) {
+            // strtotime() was not able to parse $string, use "now":
+            $time = time();
+        }
+    }
+    return $time;
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.mailto.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.mailto.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.mailto.php	(revision 1328)
@@ -0,0 +1,163 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {mailto} function plugin
+ *
+ * Type:     function<br>
+ * Name:     mailto<br>
+ * Date:     May 21, 2002
+ * Purpose:  automate mailto address link creation, and optionally
+ *           encode them.<br>
+ * Input:<br>
+ *         - address = e-mail address
+ *         - text = (optional) text to display, default is address
+ *         - encode = (optional) can be one of:
+ *                * none : no encoding (default)
+ *                * javascript : encode with javascript
+ *                * javascript_charcode : encode with javascript charcode
+ *                * hex : encode with hexidecimal (no javascript)
+ *         - cc = (optional) address(es) to carbon copy
+ *         - bcc = (optional) address(es) to blind carbon copy
+ *         - subject = (optional) e-mail subject
+ *         - newsgroups = (optional) newsgroup(s) to post to
+ *         - followupto = (optional) address(es) to follow up to
+ *         - extra = (optional) extra tags for the href link
+ *
+ * Examples:
+ * <pre>
+ * {mailto address="me@domain.com"}
+ * {mailto address="me@domain.com" encode="javascript"}
+ * {mailto address="me@domain.com" encode="hex"}
+ * {mailto address="me@domain.com" subject="Hello to you!"}
+ * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
+ * {mailto address="me@domain.com" extra='class="mailto"'}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto}
+ *          (Smarty online manual)
+ * @version  1.2
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author   credits to Jason Sweat (added cc, bcc and subject functionality)
+ * @param    array
+ * @param    Smarty
+ * @return   string
+ */
+function smarty_function_mailto($params, &$smarty)
+{
+    $extra = '';
+
+    if (empty($params['address'])) {
+        $smarty->trigger_error("mailto: missing 'address' parameter");
+        return;
+    } else {
+        $address = $params['address'];
+    }
+
+    $text = $address;
+
+    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
+    // so, don't encode it.
+    $mail_parms = array();
+    foreach ($params as $var=>$value) {
+        switch ($var) {
+            case 'cc':
+            case 'bcc':
+            case 'followupto':
+                if (!empty($value))
+                    $mail_parms[] = $var.'='.str_replace('%40','@',rawurlencode($value));
+                break;
+                
+            case 'subject':
+            case 'newsgroups':
+                $mail_parms[] = $var.'='.rawurlencode($value);
+                break;
+
+            case 'extra':
+            case 'text':
+                $$var = $value;
+
+            default:
+        }
+    }
+
+    $mail_parm_vals = '';
+    for ($i=0; $i<count($mail_parms); $i++) {
+        $mail_parm_vals .= (0==$i) ? '?' : '&';
+        $mail_parm_vals .= $mail_parms[$i];
+    }
+    $address .= $mail_parm_vals;
+
+    $encode = (empty($params['encode'])) ? 'none' : $params['encode'];
+    if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) {
+        $smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex");
+        return;
+    }
+
+    if ($encode == 'javascript' ) {
+        $string = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');';
+
+        $js_encode = '';
+        for ($x=0; $x < strlen($string); $x++) {
+            $js_encode .= '%' . bin2hex($string[$x]);
+        }
+
+        return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>';
+
+    } elseif ($encode == 'javascript_charcode' ) {
+        $string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
+
+        for($x = 0, $y = strlen($string); $x < $y; $x++ ) {
+            $ord[] = ord($string[$x]);   
+        }
+
+        $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n";
+        $_ret .= "<!--\n";
+        $_ret .= "{document.write(String.fromCharCode(";
+        $_ret .= implode(',',$ord);
+        $_ret .= "))";
+        $_ret .= "}\n";
+        $_ret .= "//-->\n";
+        $_ret .= "</script>\n";
+        
+        return $_ret;
+        
+        
+    } elseif ($encode == 'hex') {
+
+        preg_match('!^(.*)(\?.*)$!',$address,$match);
+        if(!empty($match[2])) {
+            $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.");
+            return;
+        }
+        $address_encode = '';
+        for ($x=0; $x < strlen($address); $x++) {
+            if(preg_match('!\w!',$address[$x])) {
+                $address_encode .= '%' . bin2hex($address[$x]);
+            } else {
+                $address_encode .= $address[$x];
+            }
+        }
+        $text_encode = '';
+        for ($x=0; $x < strlen($text); $x++) {
+            $text_encode .= '&#x' . bin2hex($text[$x]).';';
+        }
+
+        $mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
+        return '<a href="'.$mailto.$address_encode.'" '.$extra.'>'.$text_encode.'</a>';
+
+    } else {
+        // no encoding
+        return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
+
+    }
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.debug.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.debug.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.debug.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {debug} function plugin
+ *
+ * Type:     function<br>
+ * Name:     debug<br>
+ * Date:     July 1, 2002<br>
+ * Purpose:  popup debug window
+ * @link http://smarty.php.net/manual/en/language.function.debug.php {debug}
+ *       (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version  1.0
+ * @param array
+ * @param Smarty
+ * @return string output from {@link Smarty::_generate_debug_output()}
+ */
+function smarty_function_debug($params, &$smarty)
+{
+    if (isset($params['output'])) {
+        $smarty->assign('_smarty_debug_output', $params['output']);
+    }
+    require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
+    return smarty_core_display_debug_console(null, $smarty);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.popup_init.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.popup_init.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.popup_init.php	(revision 1328)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {popup_init} function plugin
+ *
+ * Type:     function<br>
+ * Name:     popup_init<br>
+ * Purpose:  initialize overlib
+ * @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_popup_init($params, &$smarty)
+{
+    $zindex = 1000;
+    
+    if (!empty($params['zindex'])) {
+        $zindex = $params['zindex'];
+    }
+    
+    if (!empty($params['src'])) {
+        return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
+         . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n";
+    } else {
+        $smarty->trigger_error("popup_init: missing src parameter");
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.fetch.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.fetch.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.fetch.php	(revision 1328)
@@ -0,0 +1,221 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {fetch} plugin
+ *
+ * Type:     function<br>
+ * Name:     fetch<br>
+ * Purpose:  fetch file, web or ftp data and display results
+ * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string|null if the assign parameter is passed, Smarty assigns the
+ *                     result to a template variable
+ */
+function smarty_function_fetch($params, &$smarty)
+{
+    if (empty($params['file'])) {
+        $smarty->_trigger_fatal_error("[plugin] parameter 'file' cannot be empty");
+        return;
+    }
+
+    $content = '';
+    if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) {
+        $_params = array('resource_type' => 'file', 'resource_name' => $params['file']);
+        require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
+        if(!smarty_core_is_secure($_params, $smarty)) {
+            $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed');
+            return;
+        }
+        
+        // fetch the file
+        if($fp = @fopen($params['file'],'r')) {
+            while(!feof($fp)) {
+                $content .= fgets ($fp,4096);
+            }
+            fclose($fp);
+        } else {
+            $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\'');
+            return;
+        }
+    } else {
+        // not a local file
+        if(preg_match('!^http://!i',$params['file'])) {
+            // http fetch
+            if($uri_parts = parse_url($params['file'])) {
+                // set defaults
+                $host = $server_name = $uri_parts['host'];
+                $timeout = 30;
+                $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
+                $agent = "Smarty Template Engine ".$smarty->_version;
+                $referer = "";
+                $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
+                $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
+                $_is_proxy = false;
+                if(empty($uri_parts['port'])) {
+                    $port = 80;
+                } else {
+                    $port = $uri_parts['port'];
+                }
+                if(!empty($uri_parts['user'])) {
+                    $user = $uri_parts['user'];
+                }
+                if(!empty($uri_parts['pass'])) {
+                    $pass = $uri_parts['pass'];
+                }
+                // loop through parameters, setup headers
+                foreach($params as $param_key => $param_value) {
+                    switch($param_key) {
+                        case "file":
+                        case "assign":
+                        case "assign_headers":
+                            break;
+                        case "user":
+                            if(!empty($param_value)) {
+                                $user = $param_value;
+                            }
+                            break;
+                        case "pass":
+                            if(!empty($param_value)) {
+                                $pass = $param_value;
+                            }
+                            break;
+                        case "accept":
+                            if(!empty($param_value)) {
+                                $accept = $param_value;
+                            }
+                            break;
+                        case "header":
+                            if(!empty($param_value)) {
+                                if(!preg_match('![\w\d-]+: .+!',$param_value)) {
+                                    $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'");
+                                    return;
+                                } else {
+                                    $extra_headers[] = $param_value;
+                                }
+                            }
+                            break;
+                        case "proxy_host":
+                            if(!empty($param_value)) {
+                                $proxy_host = $param_value;
+                            }
+                            break;
+                        case "proxy_port":
+                            if(!preg_match('!\D!', $param_value)) {
+                                $proxy_port = (int) $param_value;
+                            } else {
+                                $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
+                                return;
+                            }
+                            break;
+                        case "agent":
+                            if(!empty($param_value)) {
+                                $agent = $param_value;
+                            }
+                            break;
+                        case "referer":
+                            if(!empty($param_value)) {
+                                $referer = $param_value;
+                            }
+                            break;
+                        case "timeout":
+                            if(!preg_match('!\D!', $param_value)) {
+                                $timeout = (int) $param_value;
+                            } else {
+                                $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
+                                return;
+                            }
+                            break;
+                        default:
+                            $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'");
+                            return;
+                    }
+                }
+                if(!empty($proxy_host) && !empty($proxy_port)) {
+                    $_is_proxy = true;
+                    $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
+                } else {
+                    $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
+                }
+
+                if(!$fp) {
+                    $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)");
+                    return;
+                } else {
+                    if($_is_proxy) {
+                        fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
+                    } else {
+                        fputs($fp, "GET $uri HTTP/1.0\r\n");
+                    }
+                    if(!empty($host)) {
+                        fputs($fp, "Host: $host\r\n");
+                    }
+                    if(!empty($accept)) {
+                        fputs($fp, "Accept: $accept\r\n");
+                    }
+                    if(!empty($agent)) {
+                        fputs($fp, "User-Agent: $agent\r\n");
+                    }
+                    if(!empty($referer)) {
+                        fputs($fp, "Referer: $referer\r\n");
+                    }
+                    if(isset($extra_headers) && is_array($extra_headers)) {
+                        foreach($extra_headers as $curr_header) {
+                            fputs($fp, $curr_header."\r\n");
+                        }
+                    }
+                    if(!empty($user) && !empty($pass)) {
+                        fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
+                    }
+
+                    fputs($fp, "\r\n");
+                    while(!feof($fp)) {
+                        $content .= fgets($fp,4096);
+                    }
+                    fclose($fp);
+                    $csplit = split("\r\n\r\n",$content,2);
+
+                    $content = $csplit[1];
+
+                    if(!empty($params['assign_headers'])) {
+                        $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
+                    }
+                }
+            } else {
+                $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax");
+                return;
+            }
+        } else {
+            // ftp fetch
+            if($fp = @fopen($params['file'],'r')) {
+                while(!feof($fp)) {
+                    $content .= fgets ($fp,4096);
+                }
+                fclose($fp);
+            } else {
+                $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'');
+                return;
+            }
+        }
+
+    }
+
+
+    if (!empty($params['assign'])) {
+        $smarty->assign($params['assign'],$content);
+    } else {
+        return $content;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.math.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.math.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.math.php	(revision 1328)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {math} function plugin
+ *
+ * Type:     function<br>
+ * Name:     math<br>
+ * Purpose:  handle math computations in template<br>
+ * @link http://smarty.php.net/manual/en/language.function.math.php {math}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_math($params, &$smarty)
+{
+    // be sure equation parameter is present
+    if (empty($params['equation'])) {
+        $smarty->trigger_error("math: missing equation parameter");
+        return;
+    }
+
+    $equation = $params['equation'];
+
+    // make sure parenthesis are balanced
+    if (substr_count($equation,"(") != substr_count($equation,")")) {
+        $smarty->trigger_error("math: unbalanced parenthesis");
+        return;
+    }
+
+    // match all vars in equation, make sure all are passed
+    preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
+    $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
+                           'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
+    
+    foreach($match[1] as $curr_var) {
+        if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
+            $smarty->trigger_error("math: function call $curr_var not allowed");
+            return;
+        }
+    }
+
+    foreach($params as $key => $val) {
+        if ($key != "equation" && $key != "format" && $key != "assign") {
+            // make sure value is not empty
+            if (strlen($val)==0) {
+                $smarty->trigger_error("math: parameter $key is empty");
+                return;
+            }
+            if (!is_numeric($val)) {
+                $smarty->trigger_error("math: parameter $key: is not numeric");
+                return;
+            }
+            $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
+        }
+    }
+
+    eval("\$smarty_math_result = ".$equation.";");
+
+    if (empty($params['format'])) {
+        if (empty($params['assign'])) {
+            return $smarty_math_result;
+        } else {
+            $smarty->assign($params['assign'],$smarty_math_result);
+        }
+    } else {
+        if (empty($params['assign'])){
+            printf($params['format'],$smarty_math_result);
+        } else {
+            $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.indent.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.indent.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.indent.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty indent modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     indent<br>
+ * Purpose:  indent lines of text
+ * @link http://smarty.php.net/manual/en/language.modifier.indent.php
+ *          indent (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @return string
+ */
+function smarty_modifier_indent($string,$chars=4,$char=" ")
+{
+    return preg_replace('!^!m',str_repeat($char,$chars),$string);
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.truncate.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.truncate.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.truncate.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty truncate modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     truncate<br>
+ * Purpose:  Truncate a string to a certain length if necessary,
+ *           optionally splitting in the middle of a word, and
+ *           appending the $etc string or inserting $etc into the middle.
+ * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
+ *          truncate (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @param boolean
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+                                  $break_words = false, $middle = false)
+{
+    if ($length == 0)
+        return '';
+
+    if (strlen($string) > $length) {
+        $length -= strlen($etc);
+        if (!$break_words && !$middle) {
+            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
+        }
+        if(!$middle) {
+            return substr($string, 0, $length).$etc;
+        } else {
+            return substr($string, 0, $length/2) . $etc . substr($string, -$length/2);
+        }
+    } else {
+        return $string;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_select_date.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_select_date.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_select_date.php	(revision 1328)
@@ -0,0 +1,323 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {html_select_date} plugin
+ *
+ * Type:     function<br>
+ * Name:     html_select_date<br>
+ * Purpose:  Prints the dropdowns for date selection.
+ *
+ * ChangeLog:<br>
+ *           - 1.0 initial release
+ *           - 1.1 added support for +/- N syntax for begin
+ *                and end year values. (Monte)
+ *           - 1.2 added support for yyyy-mm-dd syntax for
+ *                time value. (Jan Rosier)
+ *           - 1.3 added support for choosing format for
+ *                month values (Gary Loescher)
+ *           - 1.3.1 added support for choosing format for
+ *                day values (Marcus Bointon)
+ *           - 1.3.2 suppport negative timestamps, force year
+ *             dropdown to include given date unless explicitly set (Monte)
+ * @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
+ *      (Smarty online manual)
+ * @version 1.3.2
+ * @author Andrei Zmievski
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_html_select_date($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
+    require_once $smarty->_get_plugin_filepath('function','html_options');
+    /* Default values. */
+    $prefix          = "Date_";
+    $start_year      = strftime("%Y");
+    $end_year        = $start_year;
+    $display_days    = true;
+    $display_months  = true;
+    $display_years   = true;
+    $month_format    = "%B";
+    /* Write months as numbers by default  GL */
+    $month_value_format = "%m";
+    $day_format      = "%02d";
+    /* Write day values using this format MB */
+    $day_value_format = "%d";
+    $year_as_text    = false;
+    /* Display years in reverse order? Ie. 2000,1999,.... */
+    $reverse_years   = false;
+    /* Should the select boxes be part of an array when returned from PHP?
+       e.g. setting it to "birthday", would create "birthday[Day]",
+       "birthday[Month]" & "birthday[Year]". Can be combined with prefix */
+    $field_array     = null;
+    /* <select size>'s of the different <select> tags.
+       If not set, uses default dropdown. */
+    $day_size        = null;
+    $month_size      = null;
+    $year_size       = null;
+    /* Unparsed attributes common to *ALL* the <select>/<input> tags.
+       An example might be in the template: all_extra ='class ="foo"'. */
+    $all_extra       = null;
+    /* Separate attributes for the tags. */
+    $day_extra       = null;
+    $month_extra     = null;
+    $year_extra      = null;
+    /* Order in which to display the fields.
+       "D" -> day, "M" -> month, "Y" -> year. */
+    $field_order     = 'MDY';
+    /* String printed between the different fields. */
+    $field_separator = "\n";
+    $time = time();
+    $all_empty       = null;
+    $day_empty       = null;
+    $month_empty     = null;
+    $year_empty      = null;
+    $extra_attrs     = '';
+
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'prefix':
+            case 'time':
+            case 'start_year':
+            case 'end_year':
+            case 'month_format':
+            case 'day_format':
+            case 'day_value_format':
+            case 'field_array':
+            case 'day_size':
+            case 'month_size':
+            case 'year_size':
+            case 'all_extra':
+            case 'day_extra':
+            case 'month_extra':
+            case 'year_extra':
+            case 'field_order':
+            case 'field_separator':
+            case 'month_value_format':
+            case 'month_empty':
+            case 'day_empty':
+            case 'year_empty':
+                $$_key = (string)$_value;
+                break;
+
+            case 'all_empty':
+                $$_key = (string)$_value;
+                $day_empty = $month_empty = $year_empty = $all_empty;
+                break;
+
+            case 'display_days':
+            case 'display_months':
+            case 'display_years':
+            case 'year_as_text':
+            case 'reverse_years':
+                $$_key = (bool)$_value;
+                break;
+
+            default:
+                if(!is_array($_value)) {
+                    $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
+                } else {
+                    $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if(preg_match('!^-\d+$!',$time)) {
+        // negative timestamp, use date()
+        $time = date('Y-m-d',$time);
+    }
+    // If $time is not in format yyyy-mm-dd
+    if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
+        // use smarty_make_timestamp to get an unix timestamp and
+        // strftime to make yyyy-mm-dd
+        $time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
+    }
+    // Now split this in pieces, which later can be used to set the select
+    $time = explode("-", $time);
+    
+    // make syntax "+N" or "-N" work with start_year and end_year
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
+        if ($match[1] == '+') {
+            $end_year = strftime('%Y') + $match[2];
+        } else {
+            $end_year = strftime('%Y') - $match[2];
+        }
+    }
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
+        if ($match[1] == '+') {
+            $start_year = strftime('%Y') + $match[2];
+        } else {
+            $start_year = strftime('%Y') - $match[2];
+        }
+    }
+    if (strlen($time[0]) > 0) { 
+        if ($start_year > $time[0] && !isset($params['start_year'])) {
+            // force start year to include given date if not explicitly set
+            $start_year = $time[0];
+        }
+        if($end_year < $time[0] && !isset($params['end_year'])) {
+            // force end year to include given date if not explicitly set
+            $end_year = $time[0];
+        }
+    }
+
+    $field_order = strtoupper($field_order);
+
+    $html_result = $month_result = $day_result = $year_result = "";
+
+    if ($display_months) {
+        $month_names = array();
+        $month_values = array();
+        if(isset($month_empty)) {
+            $month_names[''] = $month_empty;
+            $month_values[''] = '';
+        }
+        for ($i = 1; $i <= 12; $i++) {
+            $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
+            $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
+        }
+
+        $month_result .= '<select name=';
+        if (null !== $field_array){
+            $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
+        } else {
+            $month_result .= '"' . $prefix . 'Month"';
+        }
+        if (null !== $month_size){
+            $month_result .= ' size="' . $month_size . '"';
+        }
+        if (null !== $month_extra){
+            $month_result .= ' ' . $month_extra;
+        }
+        if (null !== $all_extra){
+            $month_result .= ' ' . $all_extra;
+        }
+        $month_result .= $extra_attrs . '>'."\n";
+
+        $month_result .= smarty_function_html_options(array('output'     => $month_names,
+                                                            'values'     => $month_values,
+                                                            'selected'   => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
+                                                            'print_result' => false),
+                                                      $smarty);
+        $month_result .= '</select>';
+    }
+
+    if ($display_days) {
+        $days = array();
+        if (isset($day_empty)) {
+            $days[''] = $day_empty;
+            $day_values[''] = '';
+        }
+        for ($i = 1; $i <= 31; $i++) {
+            $days[] = sprintf($day_format, $i);
+            $day_values[] = sprintf($day_value_format, $i);
+        }
+
+        $day_result .= '<select name=';
+        if (null !== $field_array){
+            $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
+        } else {
+            $day_result .= '"' . $prefix . 'Day"';
+        }
+        if (null !== $day_size){
+            $day_result .= ' size="' . $day_size . '"';
+        }
+        if (null !== $all_extra){
+            $day_result .= ' ' . $all_extra;
+        }
+        if (null !== $day_extra){
+            $day_result .= ' ' . $day_extra;
+        }
+        $day_result .= $extra_attrs . '>'."\n";
+        $day_result .= smarty_function_html_options(array('output'     => $days,
+                                                          'values'     => $day_values,
+                                                          'selected'   => $time[2],
+                                                          'print_result' => false),
+                                                    $smarty);
+        $day_result .= '</select>';
+    }
+
+    if ($display_years) {
+        if (null !== $field_array){
+            $year_name = $field_array . '[' . $prefix . 'Year]';
+        } else {
+            $year_name = $prefix . 'Year';
+        }
+        if ($year_as_text) {
+            $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"';
+            if (null !== $all_extra){
+                $year_result .= ' ' . $all_extra;
+            }
+            if (null !== $year_extra){
+                $year_result .= ' ' . $year_extra;
+            }
+            $year_result .= ' />';
+        } else {
+            $years = range((int)$start_year, (int)$end_year);
+            if ($reverse_years) {
+                rsort($years, SORT_NUMERIC);
+            } else {
+                sort($years, SORT_NUMERIC);
+            }
+            $yearvals = $years;
+            if(isset($year_empty)) {
+                array_unshift($years, $year_empty);
+                array_unshift($yearvals, '');
+            }
+            $year_result .= '<select name="' . $year_name . '"';
+            if (null !== $year_size){
+                $year_result .= ' size="' . $year_size . '"';
+            }
+            if (null !== $all_extra){
+                $year_result .= ' ' . $all_extra;
+            }
+            if (null !== $year_extra){
+                $year_result .= ' ' . $year_extra;
+            }
+            $year_result .= $extra_attrs . '>'."\n";
+            $year_result .= smarty_function_html_options(array('output' => $years,
+                                                               'values' => $yearvals,
+                                                               'selected'   => $time[0],
+                                                               'print_result' => false),
+                                                         $smarty);
+            $year_result .= '</select>';
+        }
+    }
+
+    // Loop thru the field_order field
+    for ($i = 0; $i <= 2; $i++){
+        $c = substr($field_order, $i, 1);
+        switch ($c){
+            case 'D':
+                $html_result .= $day_result;
+                break;
+
+            case 'M':
+                $html_result .= $month_result;
+                break;
+
+            case 'Y':
+                $html_result .= $year_result;
+                break;
+        }
+        // Add the field seperator
+        if($i != 2) {
+            $html_result .= $field_separator;
+        }
+    }
+
+    return $html_result;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/shared.escape_special_chars.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/shared.escape_special_chars.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/shared.escape_special_chars.php	(revision 1328)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Smarty shared plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * escape_special_chars common function
+ *
+ * Function: smarty_function_escape_special_chars<br>
+ * Purpose:  used by other smarty functions to escape
+ *           special chars except for already escaped ones
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_function_escape_special_chars($string)
+{
+    if(!is_array($string)) {
+        $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
+        $string = htmlspecialchars($string);
+        $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
+    }
+    return $string;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_checkboxes.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_checkboxes.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_checkboxes.php	(revision 1328)
@@ -0,0 +1,143 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_checkboxes} function plugin
+ *
+ * File:       function.html_checkboxes.php<br>
+ * Type:       function<br>
+ * Name:       html_checkboxes<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of checkbox input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "checkbox"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each checkbox
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_checkboxes values=$ids output=$names}
+ * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
+ * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_checkboxes($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+
+    $name = 'checkbox';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $output = null;
+
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+            case 'separator':
+                $$_key = $_val;
+                break;
+
+            case 'labels':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'checked':
+            case 'selected':
+                $selected = array_map('strval', array_values((array)$_val));
+                break;
+
+            case 'checkboxes':
+                $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    settype($selected, 'array');
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+
+
+    } else {
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) {
+    $_output = '';
+    if ($labels) $_output .= '<label>';
+    $_output .= '<input type="checkbox" name="'
+        . smarty_function_escape_special_chars($name) . '[]" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+
+    if (in_array((string)$value, $selected)) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />' . $output;
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.upper.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.upper.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.upper.php	(revision 1328)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty upper modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     upper<br>
+ * Purpose:  convert string to uppercase
+ * @link http://smarty.php.net/manual/en/language.modifier.upper.php
+ *          upper (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_upper($string)
+{
+    return strtoupper($string);
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.config_load.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.config_load.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.config_load.php	(revision 1328)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {config_load} function plugin
+ *
+ * Type:     function<br>
+ * Name:     config_load<br>
+ * Purpose:  load config file vars
+ * @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author messju mohr <messju at lammfellpuschen dot de> (added use of resources)
+ * @param array Format:
+ * <pre>
+ * array('file' => required config file name,
+ *       'section' => optional config file section to load
+ *       'scope' => local/parent/global
+ *       'global' => overrides scope, setting to parent if true)
+ * </pre>
+ * @param Smarty
+ */
+function smarty_function_config_load($params, &$smarty)
+{
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $_debug_start_time = smarty_core_get_microtime($_params, $smarty);
+        }
+
+        $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null;
+        $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null;
+        $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global';
+        $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false;
+
+        if (!isset($_file) || strlen($_file) == 0) {
+            $smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        if (isset($_scope)) {
+            if ($_scope != 'local' &&
+                $_scope != 'parent' &&
+                $_scope != 'global') {
+                $smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__);
+            }
+        } else {
+            if ($_global) {
+                $_scope = 'parent';
+            } else {
+                $_scope = 'local';
+            }
+        }
+
+        $_params = array('resource_name' => $_file,
+                         'resource_base_path' => $smarty->config_dir,
+                         'get_source' => false);
+        $smarty->_parse_resource_name($_params);
+        $_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
+        if (isset($_section))
+            $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section);
+        else
+            $_compile_file = $smarty->_get_compile_path($_file_path);
+
+        if($smarty->force_compile || !file_exists($_compile_file)) {
+            $_compile = true;
+        } elseif ($smarty->compile_check) {
+            $_params = array('resource_name' => $_file,
+                             'resource_base_path' => $smarty->config_dir,
+                             'get_source' => false);
+            $_compile = $smarty->_fetch_resource_info($_params) &&
+                $_params['resource_timestamp'] > filemtime($_compile_file);
+        } else {
+            $_compile = false;
+        }
+
+        if($_compile) {
+            // compile config file
+            if(!is_object($smarty->_conf_obj)) {
+                require_once SMARTY_DIR . $smarty->config_class . '.class.php';
+                $smarty->_conf_obj = new $smarty->config_class();
+                $smarty->_conf_obj->overwrite = $smarty->config_overwrite;
+                $smarty->_conf_obj->booleanize = $smarty->config_booleanize;
+                $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
+                $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
+            }
+
+            $_params = array('resource_name' => $_file,
+                             'resource_base_path' => $smarty->config_dir,
+                             $_params['get_source'] = true);
+            if (!$smarty->_fetch_resource_info($_params)) {
+                return;
+            }
+            $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']);
+            $_config_vars = array_merge($smarty->_conf_obj->get($_file),
+                    $smarty->_conf_obj->get($_file, $_section));
+            if(function_exists('var_export')) {
+                $_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>';
+            } else {
+                $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
+            }
+            $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']));
+            require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
+            smarty_core_write_compiled_resource($_params, $smarty);
+        } else {
+            include($_compile_file);
+        }
+
+        if ($smarty->caching) {
+            $smarty->_cache_info['config'][$_file] = true;
+        }
+
+        $smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars);
+        $smarty->_config[0]['files'][$_file] = true;
+
+        if ($_scope == 'parent') {
+                $smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars);
+                $smarty->_config[1]['files'][$_file] = true;
+        } else if ($_scope == 'global') {
+            for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) {
+                $smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars);
+                $smarty->_config[$i]['files'][$_file] = true;
+            }
+        }
+
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[] = array('type'      => 'config',
+                                                'filename'  => $_file.' ['.$_section.'] '.$_scope,
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
+        }
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.html_image.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.html_image.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.html_image.php	(revision 1328)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_image} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_image<br>
+ * Date:     Feb 24, 2003<br>
+ * Purpose:  format HTML tags for the image<br>
+ * Input:<br>
+ *         - file = file (and path) of image (required)
+ *         - height = image height (optional, default actual height)
+ *         - width = image width (optional, default actual width)
+ *         - basedir = base directory for absolute paths, default
+ *                     is environment variable DOCUMENT_ROOT
+ *         - path_prefix = prefix for path output (optional, default empty)
+ *
+ * Examples: {html_image file="/images/masthead.gif"}
+ * Output:   <img src="/images/masthead.gif" width=400 height=23>
+ * @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
+ *      (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author credits to Duda <duda@big.hu> - wrote first image function
+ *           in repository, helped with lots of functionality
+ * @version  1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_image($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    
+    $alt = '';
+    $file = '';
+    $height = '';
+    $width = '';
+    $extra = '';
+    $prefix = '';
+    $suffix = '';
+    $path_prefix = '';
+    $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+    $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'file':
+            case 'height':
+            case 'width':
+            case 'dpi':
+            case 'path_prefix':
+            case 'basedir':
+                $$_key = $_val;
+                break;
+
+            case 'alt':
+                if(!is_array($_val)) {
+                    $$_key = smarty_function_escape_special_chars($_val);
+                } else {
+                    $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+
+            case 'link':
+            case 'href':
+                $prefix = '<a href="' . $_val . '">';
+                $suffix = '</a>';
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (empty($file)) {
+        $smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
+        return;
+    }
+
+    if (substr($file,0,1) == '/') {
+        $_image_path = $basedir . $file;
+    } else {
+        $_image_path = $file;
+    }
+    
+    if(!isset($params['width']) || !isset($params['height'])) {
+        if(!$_image_data = @getimagesize($_image_path)) {
+            if(!file_exists($_image_path)) {
+                $smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
+                return;
+            } else if(!is_readable($_image_path)) {
+                $smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
+                return;
+            } else {
+                $smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
+                return;
+            }
+        }
+        if ($smarty->security &&
+            ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) &&
+            (require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) &&
+            (!smarty_core_is_secure($_params, $smarty)) ) {
+            $smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE);
+        }        
+        
+        if(!isset($params['width'])) {
+            $width = $_image_data[0];
+        }
+        if(!isset($params['height'])) {
+            $height = $_image_data[1];
+        }
+
+    }
+
+    if(isset($params['dpi'])) {
+        if(strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) {
+            $dpi_default = 72;
+        } else {
+            $dpi_default = 96;
+        }
+        $_resize = $dpi_default/$params['dpi'];
+        $width = round($width * $_resize);
+        $height = round($height * $_resize);
+    }
+
+    return $prefix . '<img src="'.$path_prefix.$file.'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.spacify.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.spacify.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.spacify.php	(revision 1328)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty spacify modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     spacify<br>
+ * Purpose:  add spaces between characters in a string
+ * @link http://smarty.php.net/manual/en/language.modifier.spacify.php
+ *          spacify (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_spacify($string, $spacify_char = ' ')
+{
+    return implode($spacify_char,
+                   preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY));
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_sentences.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_sentences.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_sentences.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_sentences modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_sentences
+ * Purpose:  count the number of sentences in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *          count_sentences (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_sentences($string)
+{
+    // find periods with a word before but not after.
+    return preg_match_all('/[^\s]\.(?!\w)/', $string, $match);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.escape.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.escape.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.escape.php	(revision 1328)
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty escape modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     escape<br>
+ * Purpose:  Escape the string according to escapement type
+ * @link http://smarty.php.net/manual/en/language.modifier.escape.php
+ *          escape (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param html|htmlall|url|quotes|hex|hexentity|javascript
+ * @return string
+ */
+function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-8859-1')
+{
+    switch ($esc_type) {
+        case 'html':
+            return htmlspecialchars($string, ENT_QUOTES, $char_set);
+
+        case 'htmlall':
+            return htmlentities($string, ENT_QUOTES, $char_set);
+
+        case 'url':
+            return rawurlencode($string);
+
+        case 'urlpathinfo':
+            return str_replace('%2F','/',rawurlencode($string));
+            
+        case 'quotes':
+            // escape unescaped single quotes
+            return preg_replace("%(?<!\\\\)'%", "\\'", $string);
+
+        case 'hex':
+            // escape every character into hex
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '%' . bin2hex($string[$x]);
+            }
+            return $return;
+            
+        case 'hexentity':
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '&#x' . bin2hex($string[$x]) . ';';
+            }
+            return $return;
+
+        case 'decentity':
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '&#' . ord($string[$x]) . ';';
+            }
+            return $return;
+
+        case 'javascript':
+            // escape quotes and backslashes, newlines, etc.
+            return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
+            
+        case 'mail':
+            // safe way to display e-mail address on a web page
+            return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string);
+            
+        case 'nonstd':
+           // escape non-standard chars, such as ms document quotes
+           $_res = '';
+           for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
+               $_ord = ord(substr($string, $_i, 1));
+               // non-standard char, escape it
+               if($_ord >= 126){
+                   $_res .= '&#' . $_ord . ';';
+               }
+               else {
+                   $_res .= substr($string, $_i, 1);
+               }
+           }
+           return $_res;
+
+        default:
+            return $string;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_paragraphs modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_paragraphs<br>
+ * Purpose:  count the number of paragraphs in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *          count_paragraphs (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_paragraphs($string)
+{
+    // count \r or \n characters
+    return count(preg_split('/[\r\n]+/', $string));
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/compiler.assign.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/compiler.assign.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/compiler.assign.php	(revision 1328)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {assign} compiler function plugin
+ *
+ * Type:     compiler function<br>
+ * Name:     assign<br>
+ * Purpose:  assign a value to a template variable
+ * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com> (initial author)
+ * @auther messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
+ * @param string containing var-attribute and value-attribute
+ * @param Smarty_Compiler
+ */
+function smarty_compiler_assign($tag_attrs, &$compiler)
+{
+    $_params = $compiler->_parse_attrs($tag_attrs);
+
+    if (!isset($_params['var'])) {
+        $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING);
+        return;
+    }
+
+    if (!isset($_params['value'])) {
+        $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING);
+        return;
+    }
+
+    return "\$this->assign({$_params['var']}, {$_params['value']});";
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.strip.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.strip.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.strip.php	(revision 1328)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty strip modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     strip<br>
+ * Purpose:  Replace all repeated spaces, newlines, tabs
+ *           with a single space or supplied replacement string.<br>
+ * Example:  {$var|strip} {$var|strip:"&nbsp;"}
+ * Date:     September 25th, 2002
+ * @link http://smarty.php.net/manual/en/language.modifier.strip.php
+ *          strip (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version  1.0
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_strip($text, $replace = ' ')
+{
+    return preg_replace('!\s+!', $replace, $text);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_words.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_words.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.count_words.php	(revision 1328)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_words modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_words<br>
+ * Purpose:  count the number of words in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.words.php
+ *          count_words (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_words($string)
+{
+    // split text by ' ',\r,\n,\f,\t
+    $split_array = preg_split('/\s+/',$string);
+    // count matches that contain alphanumerics
+    $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array);
+
+    return count($word_count);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.cat.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.cat.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.cat.php	(revision 1328)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty cat modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     cat<br>
+ * Date:     Feb 24, 2003
+ * Purpose:  catenate a value to a variable
+ * Input:    string to catenate
+ * Example:  {$var|cat:"foo"}
+ * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version 1.0
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_cat($string, $cat)
+{
+    return $string . $cat;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.debug_print_var.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.debug_print_var.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.debug_print_var.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty debug_print_var modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     debug_print_var<br>
+ * Purpose:  formats variable contents for display in the console
+ * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php
+ *          debug_print_var (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array|object
+ * @param integer
+ * @param integer
+ * @return string
+ */
+function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
+{
+    $_replace = array("\n"=>'<i>&#92;n</i>', "\r"=>'<i>&#92;r</i>', "\t"=>'<i>&#92;t</i>');
+    if (is_array($var)) {
+        $results = "<b>Array (".count($var).")</b>";
+        foreach ($var as $curr_key => $curr_val) {
+            $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
+            $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>".strtr($curr_key, $_replace)."</b> =&gt; $return";
+        }
+    } else if (is_object($var)) {
+        $object_vars = get_object_vars($var);
+        $results = "<b>".get_class($var)." Object (".count($object_vars).")</b>";
+        foreach ($object_vars as $curr_key => $curr_val) {
+            $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
+            $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>$curr_key</b> =&gt; $return";
+        }
+    } else if (is_resource($var)) {
+        $results = '<i>'.(string)$var.'</i>';
+    } else if (empty($var) && $var != "0") {
+        $results = '<i>empty</i>';
+    } else {
+        if (strlen($var) > $length ) {
+            $results = substr($var, 0, $length-3).'...';
+        } else {
+            $results = $var;
+        }
+        $results = htmlspecialchars($results);
+        $results = strtr($results, $_replace);
+    }
+    return $results;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.replace.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.replace.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.replace.php	(revision 1328)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty replace modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     replace<br>
+ * Purpose:  simple search/replace
+ * @link http://smarty.php.net/manual/en/language.modifier.replace.php
+ *          replace (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_replace($string, $search, $replace)
+{
+    return str_replace($search, $replace, $string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/function.eval.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/function.eval.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/function.eval.php	(revision 1328)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {eval} function plugin
+ *
+ * Type:     function<br>
+ * Name:     eval<br>
+ * Purpose:  evaluate a template variable as a template<br>
+ * @link http://smarty.php.net/manual/en/language.function.eval.php {eval}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ */
+function smarty_function_eval($params, &$smarty)
+{
+
+    if (!isset($params['var'])) {
+        $smarty->trigger_error("eval: missing 'var' parameter");
+        return;
+    }
+
+    if($params['var'] == '') {
+        return;
+    }
+
+    $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
+
+    ob_start();
+    $smarty->_eval('?>' . $_var_compiled);
+    $_contents = ob_get_contents();
+    ob_end_clean();
+
+    if (!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_contents);
+    } else {
+        return $_contents;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.string_format.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.string_format.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.string_format.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty string_format modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     string_format<br>
+ * Purpose:  format strings via sprintf
+ * @link http://smarty.php.net/manual/en/language.modifier.string.format.php
+ *          string_format (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_string_format($string, $format)
+{
+    return sprintf($format, $string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.strip_tags.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.strip_tags.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.strip_tags.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty strip_tags modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     strip_tags<br>
+ * Purpose:  strip html tags from text
+ * @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php
+ *          strip_tags (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_strip_tags($string, $replace_with_space = true)
+{
+    if ($replace_with_space)
+        return preg_replace('!<[^>]*?>!', ' ', $string);
+    else
+        return strip_tags($string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/plugins/modifier.nl2br.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/plugins/modifier.nl2br.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/plugins/modifier.nl2br.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty plugin
+ *
+ * Type:     modifier<br>
+ * Name:     nl2br<br>
+ * Date:     Feb 26, 2003
+ * Purpose:  convert \r\n, \r or \n to <<br>>
+ * Input:<br>
+ *         - contents = contents to replace
+ *         - preceed_test = if true, includes preceeding break tags
+ *           in replacement
+ * Example:  {$text|nl2br}
+ * @link http://smarty.php.net/manual/en/language.modifier.nl2br.php
+ *          nl2br (Smarty online manual)
+ * @version  1.0
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_nl2br($string)
+{
+    return nl2br($string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/Smarty_Compiler.class.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/Smarty_Compiler.class.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/Smarty_Compiler.class.php	(revision 1328)
@@ -0,0 +1,2313 @@
+<?php
+
+/**
+ * Project:     Smarty: the PHP compiling template engine
+ * File:        Smarty_Compiler.class.php
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @link http://smarty.php.net/
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Andrei Zmievski <andrei@php.net>
+ * @version 2.6.13
+ * @copyright 2001-2005 New Digital Group, Inc.
+ * @package Smarty
+ */
+
+/* $Id$ */
+
+/**
+ * Template compiling class
+ * @package Smarty
+ */
+class Smarty_Compiler extends Smarty {
+
+    // internal vars
+    /**#@+
+     * @access private
+     */
+    var $_folded_blocks         =   array();    // keeps folded template blocks
+    var $_current_file          =   null;       // the current template being compiled
+    var $_current_line_no       =   1;          // line number for error messages
+    var $_capture_stack         =   array();    // keeps track of nested capture buffers
+    var $_plugin_info           =   array();    // keeps track of plugins to load
+    var $_init_smarty_vars      =   false;
+    var $_permitted_tokens      =   array('true','false','yes','no','on','off','null');
+    var $_db_qstr_regexp        =   null;        // regexps are setup in the constructor
+    var $_si_qstr_regexp        =   null;
+    var $_qstr_regexp           =   null;
+    var $_func_regexp           =   null;
+    var $_reg_obj_regexp        =   null;
+    var $_var_bracket_regexp    =   null;
+    var $_num_const_regexp      =   null;
+    var $_dvar_guts_regexp      =   null;
+    var $_dvar_regexp           =   null;
+    var $_cvar_regexp           =   null;
+    var $_svar_regexp           =   null;
+    var $_avar_regexp           =   null;
+    var $_mod_regexp            =   null;
+    var $_var_regexp            =   null;
+    var $_parenth_param_regexp  =   null;
+    var $_func_call_regexp      =   null;
+    var $_obj_ext_regexp        =   null;
+    var $_obj_start_regexp      =   null;
+    var $_obj_params_regexp     =   null;
+    var $_obj_call_regexp       =   null;
+    var $_cacheable_state       =   0;
+    var $_cache_attrs_count     =   0;
+    var $_nocache_count         =   0;
+    var $_cache_serial          =   null;
+    var $_cache_include         =   null;
+
+    var $_strip_depth           =   0;
+    var $_additional_newline    =   "\n";
+
+    /**#@-*/
+    /**
+     * The class constructor.
+     */
+    function Smarty_Compiler()
+    {
+        // matches double quoted strings:
+        // "foobar"
+        // "foo\"bar"
+        $this->_db_qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
+
+        // matches single quoted strings:
+        // 'foobar'
+        // 'foo\'bar'
+        $this->_si_qstr_regexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
+
+        // matches single or double quoted strings
+        $this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')';
+
+        // matches bracket portion of vars
+        // [0]
+        // [foo]
+        // [$bar]
+        $this->_var_bracket_regexp = '\[\$?[\w\.]+\]';
+
+        // matches numerical constants
+        // 30
+        // -12
+        // 13.22
+        $this->_num_const_regexp = '(?:\-?\d+(?:\.\d+)?)';
+
+        // matches $ vars (not objects):
+        // $foo
+        // $foo.bar
+        // $foo.bar.foobar
+        // $foo[0]
+        // $foo[$bar]
+        // $foo[5][blah]
+        // $foo[5].bar[$foobar][4]
+        $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))';
+        $this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]';
+        $this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
+                . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?';
+        $this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp;
+
+        // matches config vars:
+        // #foo#
+        // #foobar123_foo#
+        $this->_cvar_regexp = '\#\w+\#';
+
+        // matches section vars:
+        // %foo.bar%
+        $this->_svar_regexp = '\%\w+\.\w+\%';
+
+        // matches all valid variables (no quotes, no modifiers)
+        $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|'
+           . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')';
+
+        // matches valid variable syntax:
+        // $foo
+        // $foo
+        // #foo#
+        // #foo#
+        // "text"
+        // "text"
+        $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')';
+
+        // matches valid object call (one level of object nesting allowed in parameters):
+        // $foo->bar
+        // $foo->bar()
+        // $foo->bar("text")
+        // $foo->bar($foo, $bar, "text")
+        // $foo->bar($foo, "foo")
+        // $foo->bar->foo()
+        // $foo->bar->foo->bar()
+        // $foo->bar($foo->bar)
+        // $foo->bar($foo->bar())
+        // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
+        $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
+        $this->_obj_restricted_param_regexp = '(?:'
+                . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
+                . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
+        $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
+                . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
+        $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
+                . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)';
+        $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
+        $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
+        
+        // matches valid modifier syntax:
+        // |foo
+        // |@foo
+        // |foo:"bar"
+        // |foo:$bar
+        // |foo:"bar":$foobar
+        // |foo|bar
+        // |foo:$foo->bar
+        $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|'
+           . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
+
+        // matches valid function name:
+        // foo123
+        // _foo_bar
+        $this->_func_regexp = '[a-zA-Z_]\w*';
+
+        // matches valid registered object:
+        // foo->bar
+        $this->_reg_obj_regexp = '[a-zA-Z_]\w*->[a-zA-Z_]\w*';
+
+        // matches valid parameter values:
+        // true
+        // $foo
+        // $foo|bar
+        // #foo#
+        // #foo#|bar
+        // "text"
+        // "text"|bar
+        // $foo->bar
+        $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|'
+           . $this->_var_regexp . '|' . $this->_num_const_regexp  . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
+
+        // matches valid parenthesised function parameters:
+        //
+        // "text"
+        //    $foo, $bar, "text"
+        // $foo|bar, "foo"|bar, $foo->bar($foo)|bar
+        $this->_parenth_param_regexp = '(?:\((?:\w+|'
+                . $this->_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
+                . $this->_param_regexp . ')))*)?\))';
+
+        // matches valid function call:
+        // foo()
+        // foo_bar($foo)
+        // _foo_bar($foo,"bar")
+        // foo123($foo,$foo->bar(),"foo")
+        $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:'
+           . $this->_parenth_param_regexp . '))';
+    }
+
+    /**
+     * compile a resource
+     *
+     * sets $compiled_content to the compiled source
+     * @param string $resource_name
+     * @param string $source_content
+     * @param string $compiled_content
+     * @return true
+     */
+    function _compile_file($resource_name, $source_content, &$compiled_content)
+    {
+
+        if ($this->security) {
+            // do not allow php syntax to be executed unless specified
+            if ($this->php_handling == SMARTY_PHP_ALLOW &&
+                !$this->security_settings['PHP_HANDLING']) {
+                $this->php_handling = SMARTY_PHP_PASSTHRU;
+            }
+        }
+
+        $this->_load_filters();
+
+        $this->_current_file = $resource_name;
+        $this->_current_line_no = 1;
+        $ldq = preg_quote($this->left_delimiter, '~');
+        $rdq = preg_quote($this->right_delimiter, '~');
+
+        // run template source through prefilter functions
+        if (count($this->_plugins['prefilter']) > 0) {
+            foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
+                if ($prefilter === false) continue;
+                if ($prefilter[3] || is_callable($prefilter[0])) {
+                    $source_content = call_user_func_array($prefilter[0],
+                                                            array($source_content, &$this));
+                    $this->_plugins['prefilter'][$filter_name][3] = true;
+                } else {
+                    $this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented");
+                }
+            }
+        }
+
+        /* fetch all special blocks */
+        $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s";
+
+        preg_match_all($search, $source_content, $match,  PREG_SET_ORDER);
+        $this->_folded_blocks = $match;
+        reset($this->_folded_blocks);
+
+        /* replace special blocks by "{php}" */
+        $source_content = preg_replace($search.'e', "'"
+                                       . $this->_quote_replace($this->left_delimiter) . 'php'
+                                       . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
+                                       . $this->_quote_replace($this->right_delimiter)
+                                       . "'"
+                                       , $source_content);
+
+        /* Gather all template tags. */
+        preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
+        $template_tags = $_match[1];
+        /* Split content by template tags to obtain non-template content. */
+        $text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content);
+
+        /* loop through text blocks */
+        for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) {
+            /* match anything resembling php tags */
+            if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?php[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) {
+                /* replace tags with placeholders to prevent recursive replacements */
+                $sp_match[1] = array_unique($sp_match[1]);
+                usort($sp_match[1], '_smarty_sort_length');
+                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
+                    $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]);
+                }
+                /* process each one */
+                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
+                    if ($this->php_handling == SMARTY_PHP_PASSTHRU) {
+                        /* echo php contents */
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]);
+                    } else if ($this->php_handling == SMARTY_PHP_QUOTE) {
+                        /* quote php tags */
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]);
+                    } else if ($this->php_handling == SMARTY_PHP_REMOVE) {
+                        /* remove php tags */
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]);
+                    } else {
+                        /* SMARTY_PHP_ALLOW, but echo non php starting tags */
+                        $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', '<?php echo \'\\1\'?>'."\n", $sp_match[1][$curr_sp]);
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]);
+                    }
+                }
+            }
+        }
+
+        /* Compile the template tags into PHP code. */
+        $compiled_tags = array();
+        for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) {
+            $this->_current_line_no += substr_count($text_blocks[$i], "\n");
+            $compiled_tags[] = $this->_compile_tag($template_tags[$i]);
+            $this->_current_line_no += substr_count($template_tags[$i], "\n");
+        }
+        if (count($this->_tag_stack)>0) {
+            list($_open_tag, $_line_no) = end($this->_tag_stack);
+            $this->_syntax_error("unclosed tag \{$_open_tag} (opened line $_line_no).", E_USER_ERROR, __FILE__, __LINE__);
+            return;
+        }
+
+        /* Reformat $text_blocks between 'strip' and '/strip' tags,
+           removing spaces, tabs and newlines. */
+        $strip = false;
+        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
+            if ($compiled_tags[$i] == '{strip}') {
+                $compiled_tags[$i] = '';
+                $strip = true;
+                /* remove leading whitespaces */
+                $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]);
+            }
+            if ($strip) {
+                /* strip all $text_blocks before the next '/strip' */
+                for ($j = $i + 1; $j < $for_max; $j++) {
+                    /* remove leading and trailing whitespaces of each line */
+                    $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]);
+                    if ($compiled_tags[$j] == '{/strip}') {                       
+                        /* remove trailing whitespaces from the last text_block */
+                        $text_blocks[$j] = rtrim($text_blocks[$j]);
+                    }
+                    $text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>";
+                    if ($compiled_tags[$j] == '{/strip}') {
+                        $compiled_tags[$j] = "\n"; /* slurped by php, but necessary
+                                    if a newline is following the closing strip-tag */
+                        $strip = false;
+                        $i = $j;
+                        break;
+                    }
+                }
+            }
+        }
+        $compiled_content = '';
+
+        /* Interleave the compiled contents and text blocks to get the final result. */
+        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
+            if ($compiled_tags[$i] == '') {
+                // tag result empty, remove first newline from following text block
+                $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]);
+            }
+            $compiled_content .= $text_blocks[$i].$compiled_tags[$i];
+        }
+        $compiled_content .= $text_blocks[$i];
+
+        // remove \n from the end of the file, if any
+        if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) {
+            $compiled_content = substr($compiled_content, 0, -1);
+        }
+
+        if (!empty($this->_cache_serial)) {
+            $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content;
+        }
+
+        // remove unnecessary close/open tags
+        $compiled_content = preg_replace('~\?>\n?<\?php~', '', $compiled_content);
+
+        // run compiled template through postfilter functions
+        if (count($this->_plugins['postfilter']) > 0) {
+            foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
+                if ($postfilter === false) continue;
+                if ($postfilter[3] || is_callable($postfilter[0])) {
+                    $compiled_content = call_user_func_array($postfilter[0],
+                                                              array($compiled_content, &$this));
+                    $this->_plugins['postfilter'][$filter_name][3] = true;
+                } else {
+                    $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented");
+                }
+            }
+        }
+
+        // put header at the top of the compiled template
+        $template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
+        $template_header .= "         compiled from ".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':'))." */ ?>\n";
+
+        /* Emit code to load needed plugins. */
+        $this->_plugins_code = '';
+        if (count($this->_plugin_info)) {
+            $_plugins_params = "array('plugins' => array(";
+            foreach ($this->_plugin_info as $plugin_type => $plugins) {
+                foreach ($plugins as $plugin_name => $plugin_info) {
+                    $_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], ";
+                    $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),';
+                }
+            }
+            $_plugins_params .= '))';
+            $plugins_code = "<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n";
+            $template_header .= $plugins_code;
+            $this->_plugin_info = array();
+            $this->_plugins_code = $plugins_code;
+        }
+
+        if ($this->_init_smarty_vars) {
+            $template_header .= "<?php require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n";
+            $this->_init_smarty_vars = false;
+        }
+
+        $compiled_content = $template_header . $compiled_content;
+        return true;
+    }
+
+    /**
+     * Compile a template tag
+     *
+     * @param string $template_tag
+     * @return string
+     */
+    function _compile_tag($template_tag)
+    {
+        /* Matched comment. */
+        if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*')
+            return '';
+        
+        /* Split tag into two three parts: command, command modifiers and the arguments. */
+        if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp
+                . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
+                      (?:\s+(.*))?$
+                    ~xs', $template_tag, $match)) {
+            $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+        
+        $tag_command = $match[1];
+        $tag_modifier = isset($match[2]) ? $match[2] : null;
+        $tag_args = isset($match[3]) ? $match[3] : null;
+
+        if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) {
+            /* tag name is a variable or object */
+            $_return = $this->_parse_var_props($tag_command . $tag_modifier);
+            return "<?php echo $_return; ?>" . $this->_additional_newline;
+        }
+
+        /* If the tag name is a registered object, we process it. */
+        if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) {
+            return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier);
+        }
+
+        switch ($tag_command) {
+            case 'include':
+                return $this->_compile_include_tag($tag_args);
+
+            case 'include_php':
+                return $this->_compile_include_php_tag($tag_args);
+
+            case 'if':
+                $this->_push_tag('if');
+                return $this->_compile_if_tag($tag_args);
+
+            case 'else':
+                list($_open_tag) = end($this->_tag_stack);
+                if ($_open_tag != 'if' && $_open_tag != 'elseif')
+                    $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__);
+                else
+                    $this->_push_tag('else');
+                return '<?php else: ?>';
+
+            case 'elseif':
+                list($_open_tag) = end($this->_tag_stack);
+                if ($_open_tag != 'if' && $_open_tag != 'elseif')
+                    $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__);
+                if ($_open_tag == 'if')
+                    $this->_push_tag('elseif');
+                return $this->_compile_if_tag($tag_args, true);
+
+            case '/if':
+                $this->_pop_tag('if');
+                return '<?php endif; ?>';
+
+            case 'capture':
+                return $this->_compile_capture_tag(true, $tag_args);
+
+            case '/capture':
+                return $this->_compile_capture_tag(false);
+
+            case 'ldelim':
+                return $this->left_delimiter;
+
+            case 'rdelim':
+                return $this->right_delimiter;
+
+            case 'section':
+                $this->_push_tag('section');
+                return $this->_compile_section_start($tag_args);
+
+            case 'sectionelse':
+                $this->_push_tag('sectionelse');
+                return "<?php endfor; else: ?>";
+                break;
+
+            case '/section':
+                $_open_tag = $this->_pop_tag('section');
+                if ($_open_tag == 'sectionelse')
+                    return "<?php endif; ?>";
+                else
+                    return "<?php endfor; endif; ?>";
+
+            case 'foreach':
+                $this->_push_tag('foreach');
+                return $this->_compile_foreach_start($tag_args);
+                break;
+
+            case 'foreachelse':
+                $this->_push_tag('foreachelse');
+                return "<?php endforeach; else: ?>";
+
+            case '/foreach':
+                $_open_tag = $this->_pop_tag('foreach');
+                if ($_open_tag == 'foreachelse')
+                    return "<?php endif; unset(\$_from); ?>";
+                else
+                    return "<?php endforeach; endif; unset(\$_from); ?>";
+                break;
+
+            case 'strip':
+            case '/strip':
+                if (substr($tag_command, 0, 1)=='/') {
+                    $this->_pop_tag('strip');
+                    if (--$this->_strip_depth==0) { /* outermost closing {/strip} */
+                        $this->_additional_newline = "\n";
+                        return '{' . $tag_command . '}';
+                    }
+                } else {
+                    $this->_push_tag('strip');
+                    if ($this->_strip_depth++==0) { /* outermost opening {strip} */
+                        $this->_additional_newline = "";
+                        return '{' . $tag_command . '}';
+                    }
+                }
+                return '';
+
+            case 'php':
+                /* handle folded tags replaced by {php} */
+                list(, $block) = each($this->_folded_blocks);
+                $this->_current_line_no += substr_count($block[0], "\n");
+                /* the number of matched elements in the regexp in _compile_file()
+                   determins the type of folded tag that was found */
+                switch (count($block)) {
+                    case 2: /* comment */
+                        return '';
+
+                    case 3: /* literal */
+                        return "<?php echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline;
+
+                    case 4: /* php */
+                        if ($this->security && !$this->security_settings['PHP_TAGS']) {
+                            $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__);
+                            return;
+                        }
+                        return '<?php ' . $block[3] .' ?>';
+                }
+                break;
+
+            case 'insert':
+                return $this->_compile_insert_tag($tag_args);
+
+            default:
+                if ($this->_compile_compiler_tag($tag_command, $tag_args, $output)) {
+                    return $output;
+                } else if ($this->_compile_block_tag($tag_command, $tag_args, $tag_modifier, $output)) {
+                    return $output;
+                } else if ($this->_compile_custom_tag($tag_command, $tag_args, $tag_modifier, $output)) {
+                    return $output;                    
+                } else {
+                    $this->_syntax_error("unrecognized tag '$tag_command'", E_USER_ERROR, __FILE__, __LINE__);
+                }
+
+        }
+    }
+
+
+    /**
+     * compile the custom compiler tag
+     *
+     * sets $output to the compiled custom compiler tag
+     * @param string $tag_command
+     * @param string $tag_args
+     * @param string $output
+     * @return boolean
+     */
+    function _compile_compiler_tag($tag_command, $tag_args, &$output)
+    {
+        $found = false;
+        $have_function = true;
+
+        /*
+         * First we check if the compiler function has already been registered
+         * or loaded from a plugin file.
+         */
+        if (isset($this->_plugins['compiler'][$tag_command])) {
+            $found = true;
+            $plugin_func = $this->_plugins['compiler'][$tag_command][0];
+            if (!is_callable($plugin_func)) {
+                $message = "compiler function '$tag_command' is not implemented";
+                $have_function = false;
+            }
+        }
+        /*
+         * Otherwise we need to load plugin file and look for the function
+         * inside it.
+         */
+        else if ($plugin_file = $this->_get_plugin_filepath('compiler', $tag_command)) {
+            $found = true;
+
+            include_once $plugin_file;
+
+            $plugin_func = 'smarty_compiler_' . $tag_command;
+            if (!is_callable($plugin_func)) {
+                $message = "plugin function $plugin_func() not found in $plugin_file\n";
+                $have_function = false;
+            } else {
+                $this->_plugins['compiler'][$tag_command] = array($plugin_func, null, null, null, true);
+            }
+        }
+
+        /*
+         * True return value means that we either found a plugin or a
+         * dynamically registered function. False means that we didn't and the
+         * compiler should now emit code to load custom function plugin for this
+         * tag.
+         */
+        if ($found) {
+            if ($have_function) {
+                $output = call_user_func_array($plugin_func, array($tag_args, &$this));
+                if($output != '') {
+                $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command)
+                                   . $output
+                                   . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>';
+                }
+            } else {
+                $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
+            }
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    /**
+     * compile block function tag
+     *
+     * sets $output to compiled block function tag
+     * @param string $tag_command
+     * @param string $tag_args
+     * @param string $tag_modifier
+     * @param string $output
+     * @return boolean
+     */
+    function _compile_block_tag($tag_command, $tag_args, $tag_modifier, &$output)
+    {
+        if (substr($tag_command, 0, 1) == '/') {
+            $start_tag = false;
+            $tag_command = substr($tag_command, 1);
+        } else
+            $start_tag = true;
+
+        $found = false;
+        $have_function = true;
+
+        /*
+         * First we check if the block function has already been registered
+         * or loaded from a plugin file.
+         */
+        if (isset($this->_plugins['block'][$tag_command])) {
+            $found = true;
+            $plugin_func = $this->_plugins['block'][$tag_command][0];
+            if (!is_callable($plugin_func)) {
+                $message = "block function '$tag_command' is not implemented";
+                $have_function = false;
+            }
+        }
+        /*
+         * Otherwise we need to load plugin file and look for the function
+         * inside it.
+         */
+        else if ($plugin_file = $this->_get_plugin_filepath('block', $tag_command)) {
+            $found = true;
+
+            include_once $plugin_file;
+
+            $plugin_func = 'smarty_block_' . $tag_command;
+            if (!function_exists($plugin_func)) {
+                $message = "plugin function $plugin_func() not found in $plugin_file\n";
+                $have_function = false;
+            } else {
+                $this->_plugins['block'][$tag_command] = array($plugin_func, null, null, null, true);
+
+            }
+        }
+
+        if (!$found) {
+            return false;
+        } else if (!$have_function) {
+            $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
+            return true;
+        }
+
+        /*
+         * Even though we've located the plugin function, compilation
+         * happens only once, so the plugin will still need to be loaded
+         * at runtime for future requests.
+         */
+        $this->_add_plugin('block', $tag_command);
+
+        if ($start_tag)
+            $this->_push_tag($tag_command);
+        else
+            $this->_pop_tag($tag_command);
+
+        if ($start_tag) {
+            $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command);
+            $attrs = $this->_parse_attrs($tag_args);
+            $_cache_attrs='';
+            $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs);
+            $output .= "$_cache_attrs\$this->_tag_stack[] = array('$tag_command', array(".implode(',', $arg_list).')); ';
+            $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);';
+            $output .= 'while ($_block_repeat) { ob_start(); ?>';
+        } else {
+            $output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); ';
+            $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat)';
+            if ($tag_modifier != '') {
+                $this->_parse_modifiers($_out_tag_text, $tag_modifier);
+            }
+            $output .= '$_block_repeat=false;echo ' . $_out_tag_text . '; } ';
+            $output .= " array_pop(\$this->_tag_stack); " . $this->_pop_cacheable_state('block', $tag_command) . '?>';
+        }
+
+        return true;
+    }
+
+
+    /**
+     * compile custom function tag
+     *
+     * @param string $tag_command
+     * @param string $tag_args
+     * @param string $tag_modifier
+     * @return string
+     */
+    function _compile_custom_tag($tag_command, $tag_args, $tag_modifier, &$output)
+    {
+        $found = false;
+        $have_function = true;
+
+        /*
+         * First we check if the custom function has already been registered
+         * or loaded from a plugin file.
+         */
+        if (isset($this->_plugins['function'][$tag_command])) {
+            $found = true;
+            $plugin_func = $this->_plugins['function'][$tag_command][0];
+            if (!is_callable($plugin_func)) {
+                $message = "custom function '$tag_command' is not implemented";
+                $have_function = false;
+            }
+        }
+        /*
+         * Otherwise we need to load plugin file and look for the function
+         * inside it.
+         */
+        else if ($plugin_file = $this->_get_plugin_filepath('function', $tag_command)) {
+            $found = true;
+
+            include_once $plugin_file;
+
+            $plugin_func = 'smarty_function_' . $tag_command;
+            if (!function_exists($plugin_func)) {
+                $message = "plugin function $plugin_func() not found in $plugin_file\n";
+                $have_function = false;
+            } else {
+                $this->_plugins['function'][$tag_command] = array($plugin_func, null, null, null, true);
+
+            }
+        }
+
+        if (!$found) {
+            return false;
+        } else if (!$have_function) {
+            $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
+            return true;
+        }
+
+        /* declare plugin to be loaded on display of the template that
+           we compile right now */
+        $this->_add_plugin('function', $tag_command);
+
+        $_cacheable_state = $this->_push_cacheable_state('function', $tag_command);
+        $attrs = $this->_parse_attrs($tag_args);
+        $_cache_attrs = '';
+        $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs);
+
+        $output = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)";
+        if($tag_modifier != '') {
+            $this->_parse_modifiers($output, $tag_modifier);
+        }
+
+        if($output != '') {
+            $output =  '<?php ' . $_cacheable_state . $_cache_attrs . 'echo ' . $output . ';'
+                . $this->_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline;
+        }
+
+        return true;
+    }
+
+    /**
+     * compile a registered object tag
+     *
+     * @param string $tag_command
+     * @param array $attrs
+     * @param string $tag_modifier
+     * @return string
+     */
+    function _compile_registered_object_tag($tag_command, $attrs, $tag_modifier)
+    {
+        if (substr($tag_command, 0, 1) == '/') {
+            $start_tag = false;
+            $tag_command = substr($tag_command, 1);
+        } else {
+            $start_tag = true;
+        }
+
+        list($object, $obj_comp) = explode('->', $tag_command);
+
+        $arg_list = array();
+        if(count($attrs)) {
+            $_assign_var = false;
+            foreach ($attrs as $arg_name => $arg_value) {
+                if($arg_name == 'assign') {
+                    $_assign_var = $arg_value;
+                    unset($attrs['assign']);
+                    continue;
+                }
+                if (is_bool($arg_value))
+                    $arg_value = $arg_value ? 'true' : 'false';
+                $arg_list[] = "'$arg_name' => $arg_value";
+            }
+        }
+
+        if($this->_reg_objects[$object][2]) {
+            // smarty object argument format
+            $args = "array(".implode(',', (array)$arg_list)."), \$this";
+        } else {
+            // traditional argument format
+            $args = implode(',', array_values($attrs));
+            if (empty($args)) {
+                $args = 'null';
+            }
+        }
+
+        $prefix = '';
+        $postfix = '';
+        $newline = '';
+        if(!is_object($this->_reg_objects[$object][0])) {
+            $this->_trigger_fatal_error("registered '$object' is not an object" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__);
+        } elseif(!empty($this->_reg_objects[$object][1]) && !in_array($obj_comp, $this->_reg_objects[$object][1])) {
+            $this->_trigger_fatal_error("'$obj_comp' is not a registered component of object '$object'", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__);
+        } elseif(method_exists($this->_reg_objects[$object][0], $obj_comp)) {
+            // method
+            if(in_array($obj_comp, $this->_reg_objects[$object][3])) {
+                // block method
+                if ($start_tag) {
+                    $prefix = "\$this->_tag_stack[] = array('$obj_comp', $args); ";
+                    $prefix .= "\$_block_repeat=true; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], null, \$this, \$_block_repeat); ";
+                    $prefix .= "while (\$_block_repeat) { ob_start();";
+                    $return = null;
+                    $postfix = '';
+            } else {
+                    $prefix = "\$_obj_block_content = ob_get_contents(); ob_end_clean(); ";
+                    $return = "\$_block_repeat=false; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat)";
+                    $postfix = "} array_pop(\$this->_tag_stack);";
+                }
+            } else {
+                // non-block method
+                $return = "\$this->_reg_objects['$object'][0]->$obj_comp($args)";
+            }
+        } else {
+            // property
+            $return = "\$this->_reg_objects['$object'][0]->$obj_comp";
+        }
+
+        if($return != null) {
+            if($tag_modifier != '') {
+                $this->_parse_modifiers($return, $tag_modifier);
+            }
+
+            if(!empty($_assign_var)) {
+                $output = "\$this->assign('" . $this->_dequote($_assign_var) ."',  $return);";
+            } else {
+                $output = 'echo ' . $return . ';';
+                $newline = $this->_additional_newline;
+            }
+        } else {
+            $output = '';
+        }
+
+        return '<?php ' . $prefix . $output . $postfix . "?>" . $newline;
+    }
+
+    /**
+     * Compile {insert ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_insert_tag($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $name = $this->_dequote($attrs['name']);
+
+        if (empty($name)) {
+            $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        if (!empty($attrs['script'])) {
+            $delayed_loading = true;
+        } else {
+            $delayed_loading = false;
+        }
+
+        foreach ($attrs as $arg_name => $arg_value) {
+            if (is_bool($arg_value))
+                $arg_value = $arg_value ? 'true' : 'false';
+            $arg_list[] = "'$arg_name' => $arg_value";
+        }
+
+        $this->_add_plugin('insert', $name, $delayed_loading);
+
+        $_params = "array('args' => array(".implode(', ', (array)$arg_list)."))";
+
+        return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>" . $this->_additional_newline;
+    }
+
+    /**
+     * Compile {include ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_include_tag($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $arg_list = array();
+
+        if (empty($attrs['file'])) {
+            $this->_syntax_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        foreach ($attrs as $arg_name => $arg_value) {
+            if ($arg_name == 'file') {
+                $include_file = $arg_value;
+                continue;
+            } else if ($arg_name == 'assign') {
+                $assign_var = $arg_value;
+                continue;
+            }
+            if (is_bool($arg_value))
+                $arg_value = $arg_value ? 'true' : 'false';
+            $arg_list[] = "'$arg_name' => $arg_value";
+        }
+
+        $output = '<?php ';
+
+        if (isset($assign_var)) {
+            $output .= "ob_start();\n";
+        }
+
+        $output .=
+            "\$_smarty_tpl_vars = \$this->_tpl_vars;\n";
+
+
+        $_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))";
+        $output .= "\$this->_smarty_include($_params);\n" .
+        "\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
+        "unset(\$_smarty_tpl_vars);\n";
+
+        if (isset($assign_var)) {
+            $output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n";
+        }
+
+        $output .= ' ?>';
+
+        return $output;
+
+    }
+
+    /**
+     * Compile {include ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_include_php_tag($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+
+        if (empty($attrs['file'])) {
+            $this->_syntax_error("missing 'file' attribute in include_php tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        $assign_var = (empty($attrs['assign'])) ? '' : $this->_dequote($attrs['assign']);
+        $once_var = (empty($attrs['once']) || $attrs['once']=='false') ? 'false' : 'true';
+
+        $arg_list = array();
+        foreach($attrs as $arg_name => $arg_value) {
+            if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') {
+                if(is_bool($arg_value))
+                    $arg_value = $arg_value ? 'true' : 'false';
+                $arg_list[] = "'$arg_name' => $arg_value";
+            }
+        }
+
+        $_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))";
+
+        return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>" . $this->_additional_newline;
+    }
+
+
+    /**
+     * Compile {section ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_section_start($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $arg_list = array();
+
+        $output = '<?php ';
+        $section_name = $attrs['name'];
+        if (empty($section_name)) {
+            $this->_syntax_error("missing section name", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        $output .= "unset(\$this->_sections[$section_name]);\n";
+        $section_props = "\$this->_sections[$section_name]";
+
+        foreach ($attrs as $attr_name => $attr_value) {
+            switch ($attr_name) {
+                case 'loop':
+                    $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n";
+                    break;
+
+                case 'show':
+                    if (is_bool($attr_value))
+                        $show_attr_value = $attr_value ? 'true' : 'false';
+                    else
+                        $show_attr_value = "(bool)$attr_value";
+                    $output .= "{$section_props}['show'] = $show_attr_value;\n";
+                    break;
+
+                case 'name':
+                    $output .= "{$section_props}['$attr_name'] = $attr_value;\n";
+                    break;
+
+                case 'max':
+                case 'start':
+                    $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n";
+                    break;
+
+                case 'step':
+                    $output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n";
+                    break;
+
+                default:
+                    $this->_syntax_error("unknown section attribute - '$attr_name'", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+            }
+        }
+
+        if (!isset($attrs['show']))
+            $output .= "{$section_props}['show'] = true;\n";
+
+        if (!isset($attrs['loop']))
+            $output .= "{$section_props}['loop'] = 1;\n";
+
+        if (!isset($attrs['max']))
+            $output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
+        else
+            $output .= "if ({$section_props}['max'] < 0)\n" .
+                       "    {$section_props}['max'] = {$section_props}['loop'];\n";
+
+        if (!isset($attrs['step']))
+            $output .= "{$section_props}['step'] = 1;\n";
+
+        if (!isset($attrs['start']))
+            $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
+        else {
+            $output .= "if ({$section_props}['start'] < 0)\n" .
+                       "    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" .
+                       "else\n" .
+                       "    {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
+        }
+
+        $output .= "if ({$section_props}['show']) {\n";
+        if (!isset($attrs['start']) && !isset($attrs['step']) && !isset($attrs['max'])) {
+            $output .= "    {$section_props}['total'] = {$section_props}['loop'];\n";
+        } else {
+            $output .= "    {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n";
+        }
+        $output .= "    if ({$section_props}['total'] == 0)\n" .
+                   "        {$section_props}['show'] = false;\n" .
+                   "} else\n" .
+                   "    {$section_props}['total'] = 0;\n";
+
+        $output .= "if ({$section_props}['show']):\n";
+        $output .= "
+            for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1;
+                 {$section_props}['iteration'] <= {$section_props}['total'];
+                 {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\n";
+        $output .= "{$section_props}['rownum'] = {$section_props}['iteration'];\n";
+        $output .= "{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\n";
+        $output .= "{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\n";
+        $output .= "{$section_props}['first']      = ({$section_props}['iteration'] == 1);\n";
+        $output .= "{$section_props}['last']       = ({$section_props}['iteration'] == {$section_props}['total']);\n";
+
+        $output .= "?>";
+
+        return $output;
+    }
+
+
+    /**
+     * Compile {foreach ...} tag.
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_foreach_start($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $arg_list = array();
+
+        if (empty($attrs['from'])) {
+            return $this->_syntax_error("foreach: missing 'from' attribute", E_USER_ERROR, __FILE__, __LINE__);
+        }
+        $from = $attrs['from'];
+
+        if (empty($attrs['item'])) {
+            return $this->_syntax_error("foreach: missing 'item' attribute", E_USER_ERROR, __FILE__, __LINE__);
+        }
+        $item = $this->_dequote($attrs['item']);
+        if (!preg_match('~^\w+$~', $item)) {
+            return $this->_syntax_error("'foreach: item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        if (isset($attrs['key'])) {
+            $key  = $this->_dequote($attrs['key']);
+            if (!preg_match('~^\w+$~', $key)) {
+                return $this->_syntax_error("foreach: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
+            }
+            $key_part = "\$this->_tpl_vars['$key'] => ";
+        } else {
+            $key = null;
+            $key_part = '';
+        }
+
+        if (isset($attrs['name'])) {
+            $name = $attrs['name'];
+        } else {
+            $name = null;
+        }
+
+        $output = '<?php ';
+        $output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }";
+        if (isset($name)) {
+            $foreach_props = "\$this->_foreach[$name]";
+            $output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0);\n";
+            $output .= "if ({$foreach_props}['total'] > 0):\n";
+            $output .= "    foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
+            $output .= "        {$foreach_props}['iteration']++;\n";
+        } else {
+            $output .= "if (count(\$_from)):\n";
+            $output .= "    foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
+        }
+        $output .= '?>';
+
+        return $output;
+    }
+
+
+    /**
+     * Compile {capture} .. {/capture} tags
+     *
+     * @param boolean $start true if this is the {capture} tag
+     * @param string $tag_args
+     * @return string
+     */
+
+    function _compile_capture_tag($start, $tag_args = '')
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+
+        if ($start) {
+            if (isset($attrs['name']))
+                $buffer = $attrs['name'];
+            else
+                $buffer = "'default'";
+
+            if (isset($attrs['assign']))
+                $assign = $attrs['assign'];
+            else
+                $assign = null;
+            $output = "<?php ob_start(); ?>";
+            $this->_capture_stack[] = array($buffer, $assign);
+        } else {
+            list($buffer, $assign) = array_pop($this->_capture_stack);
+            $output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); ";
+            if (isset($assign)) {
+                $output .= " \$this->assign($assign, ob_get_contents());";
+            }
+            $output .= "ob_end_clean(); ?>";
+        }
+
+        return $output;
+    }
+
+    /**
+     * Compile {if ...} tag
+     *
+     * @param string $tag_args
+     * @param boolean $elseif if true, uses elseif instead of if
+     * @return string
+     */
+    function _compile_if_tag($tag_args, $elseif = false)
+    {
+
+        /* Tokenize args for 'if' tag. */
+        preg_match_all('~(?>
+                ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*)? | # valid object call
+                ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)?    | # var or quoted string
+                \-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\||\%|\+|\-|\/|\*|\@    | # valid non-word token
+                \b\w+\b                                                        | # valid word token
+                \S+                                                           # anything else
+                )~x', $tag_args, $match);
+
+        $tokens = $match[0];
+
+        if(empty($tokens)) {
+            $_error_msg = $elseif ? "'elseif'" : "'if'";
+            $_error_msg .= ' statement requires arguments'; 
+            $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, __LINE__);
+        }
+            
+                
+        // make sure we have balanced parenthesis
+        $token_count = array_count_values($tokens);
+        if(isset($token_count['(']) && $token_count['('] != $token_count[')']) {
+            $this->_syntax_error("unbalanced parenthesis in if statement", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        $is_arg_stack = array();
+
+        for ($i = 0; $i < count($tokens); $i++) {
+
+            $token = &$tokens[$i];
+
+            switch (strtolower($token)) {
+                case '!':
+                case '%':
+                case '!==':
+                case '==':
+                case '===':
+                case '>':
+                case '<':
+                case '!=':
+                case '<>':
+                case '<<':
+                case '>>':
+                case '<=':
+                case '>=':
+                case '&&':
+                case '||':
+                case '|':
+                case '^':
+                case '&':
+                case '~':
+                case ')':
+                case ',':
+                case '+':
+                case '-':
+                case '*':
+                case '/':
+                case '@':
+                    break;
+
+                case 'eq':
+                    $token = '==';
+                    break;
+
+                case 'ne':
+                case 'neq':
+                    $token = '!=';
+                    break;
+
+                case 'lt':
+                    $token = '<';
+                    break;
+
+                case 'le':
+                case 'lte':
+                    $token = '<=';
+                    break;
+
+                case 'gt':
+                    $token = '>';
+                    break;
+
+                case 'ge':
+                case 'gte':
+                    $token = '>=';
+                    break;
+
+                case 'and':
+                    $token = '&&';
+                    break;
+
+                case 'or':
+                    $token = '||';
+                    break;
+
+                case 'not':
+                    $token = '!';
+                    break;
+
+                case 'mod':
+                    $token = '%';
+                    break;
+
+                case '(':
+                    array_push($is_arg_stack, $i);
+                    break;
+
+                case 'is':
+                    /* If last token was a ')', we operate on the parenthesized
+                       expression. The start of the expression is on the stack.
+                       Otherwise, we operate on the last encountered token. */
+                    if ($tokens[$i-1] == ')')
+                        $is_arg_start = array_pop($is_arg_stack);
+                    else
+                        $is_arg_start = $i-1;
+                    /* Construct the argument for 'is' expression, so it knows
+                       what to operate on. */
+                    $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
+
+                    /* Pass all tokens from next one until the end to the
+                       'is' expression parsing function. The function will
+                       return modified tokens, where the first one is the result
+                       of the 'is' expression and the rest are the tokens it
+                       didn't touch. */
+                    $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
+
+                    /* Replace the old tokens with the new ones. */
+                    array_splice($tokens, $is_arg_start, count($tokens), $new_tokens);
+
+                    /* Adjust argument start so that it won't change from the
+                       current position for the next iteration. */
+                    $i = $is_arg_start;
+                    break;
+
+                default:
+                    if(preg_match('~^' . $this->_func_regexp . '$~', $token) ) {
+                            // function call
+                            if($this->security &&
+                               !in_array($token, $this->security_settings['IF_FUNCS'])) {
+                                $this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);
+                            }
+                    } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') {
+                        // variable function call
+                        $this->_syntax_error("variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);                      
+                    } elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) {
+                        // object or variable
+                        $token = $this->_parse_var_props($token);
+                    } elseif(is_numeric($token)) {
+                        // number, skip it
+                    } else {
+                        $this->_syntax_error("unidentified token '$token'", E_USER_ERROR, __FILE__, __LINE__);
+                    }
+                    break;
+            }
+        }
+
+        if ($elseif)
+            return '<?php elseif ('.implode(' ', $tokens).'): ?>';
+        else
+            return '<?php if ('.implode(' ', $tokens).'): ?>';
+    }
+
+
+    function _compile_arg_list($type, $name, $attrs, &$cache_code) {
+        $arg_list = array();
+
+        if (isset($type) && isset($name)
+            && isset($this->_plugins[$type])
+            && isset($this->_plugins[$type][$name])
+            && empty($this->_plugins[$type][$name][4])
+            && is_array($this->_plugins[$type][$name][5])
+            ) {
+            /* we have a list of parameters that should be cached */
+            $_cache_attrs = $this->_plugins[$type][$name][5];
+            $_count = $this->_cache_attrs_count++;
+            $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');";
+
+        } else {
+            /* no parameters are cached */
+            $_cache_attrs = null;
+        }
+
+        foreach ($attrs as $arg_name => $arg_value) {
+            if (is_bool($arg_value))
+                $arg_value = $arg_value ? 'true' : 'false';
+            if (is_null($arg_value))
+                $arg_value = 'null';
+            if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) {
+                $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)";
+            } else {
+                $arg_list[] = "'$arg_name' => $arg_value";
+            }
+        }
+        return $arg_list;
+    }
+
+    /**
+     * Parse is expression
+     *
+     * @param string $is_arg
+     * @param array $tokens
+     * @return array
+     */
+    function _parse_is_expr($is_arg, $tokens)
+    {
+        $expr_end = 0;
+        $negate_expr = false;
+
+        if (($first_token = array_shift($tokens)) == 'not') {
+            $negate_expr = true;
+            $expr_type = array_shift($tokens);
+        } else
+            $expr_type = $first_token;
+
+        switch ($expr_type) {
+            case 'even':
+                if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') {
+                    $expr_end++;
+                    $expr_arg = $tokens[$expr_end++];
+                    $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))";
+                } else
+                    $expr = "!(1 & $is_arg)";
+                break;
+
+            case 'odd':
+                if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') {
+                    $expr_end++;
+                    $expr_arg = $tokens[$expr_end++];
+                    $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))";
+                } else
+                    $expr = "(1 & $is_arg)";
+                break;
+
+            case 'div':
+                if (@$tokens[$expr_end] == 'by') {
+                    $expr_end++;
+                    $expr_arg = $tokens[$expr_end++];
+                    $expr = "!($is_arg % " . $this->_parse_var_props($expr_arg) . ")";
+                } else {
+                    $this->_syntax_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__);
+                }
+                break;
+
+            default:
+                $this->_syntax_error("unknown 'is' expression - '$expr_type'", E_USER_ERROR, __FILE__, __LINE__);
+                break;
+        }
+
+        if ($negate_expr) {
+            $expr = "!($expr)";
+        }
+
+        array_splice($tokens, 0, $expr_end, $expr);
+
+        return $tokens;
+    }
+
+
+    /**
+     * Parse attribute string
+     *
+     * @param string $tag_args
+     * @return array
+     */
+    function _parse_attrs($tag_args)
+    {
+
+        /* Tokenize tag attributes. */
+        preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+)
+                         )+ |
+                         [=]
+                        ~x', $tag_args, $match);
+        $tokens       = $match[0];
+
+        $attrs = array();
+        /* Parse state:
+            0 - expecting attribute name
+            1 - expecting '='
+            2 - expecting attribute value (not '=') */
+        $state = 0;
+
+        foreach ($tokens as $token) {
+            switch ($state) {
+                case 0:
+                    /* If the token is a valid identifier, we set attribute name
+                       and go to state 1. */
+                    if (preg_match('~^\w+$~', $token)) {
+                        $attr_name = $token;
+                        $state = 1;
+                    } else
+                        $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+
+                case 1:
+                    /* If the token is '=', then we go to state 2. */
+                    if ($token == '=') {
+                        $state = 2;
+                    } else
+                        $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+
+                case 2:
+                    /* If token is not '=', we set the attribute value and go to
+                       state 0. */
+                    if ($token != '=') {
+                        /* We booleanize the token if it's a non-quoted possible
+                           boolean value. */
+                        if (preg_match('~^(on|yes|true)$~', $token)) {
+                            $token = 'true';
+                        } else if (preg_match('~^(off|no|false)$~', $token)) {
+                            $token = 'false';
+                        } else if ($token == 'null') {
+                            $token = 'null';
+                        } else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) {
+                            /* treat integer literally */
+                        } else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) {
+                            /* treat as a string, double-quote it escaping quotes */
+                            $token = '"'.addslashes($token).'"';
+                        }
+
+                        $attrs[$attr_name] = $token;
+                        $state = 0;
+                    } else
+                        $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+            }
+            $last_token = $token;
+        }
+
+        if($state != 0) {
+            if($state == 1) {
+                $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
+            } else {
+                $this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__);
+            }
+        }
+
+        $this->_parse_vars_props($attrs);
+
+        return $attrs;
+    }
+
+    /**
+     * compile multiple variables and section properties tokens into
+     * PHP code
+     *
+     * @param array $tokens
+     */
+    function _parse_vars_props(&$tokens)
+    {
+        foreach($tokens as $key => $val) {
+            $tokens[$key] = $this->_parse_var_props($val);
+        }
+    }
+
+    /**
+     * compile single variable and section properties token into
+     * PHP code
+     *
+     * @param string $val
+     * @param string $tag_attrs
+     * @return string
+     */
+    function _parse_var_props($val)
+    {
+        $val = trim($val);
+
+        if(preg_match('~^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match)) {
+            // $ variable or object
+            $return = $this->_parse_var($match[1]);
+            $modifiers = $match[2];
+            if (!empty($this->default_modifiers) && !preg_match('~(^|\|)smarty:nodefaults($|\|)~',$modifiers)) {
+                $_default_mod_string = implode('|',(array)$this->default_modifiers);
+                $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers;
+            }
+            $this->_parse_modifiers($return, $modifiers);
+            return $return;
+        } elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // double quoted text
+                preg_match('~^(' . $this->_db_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
+                $return = $this->_expand_quoted_text($match[1]);
+                if($match[2] != '') {
+                    $this->_parse_modifiers($return, $match[2]);
+                }
+                return $return;
+            }
+        elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // numerical constant
+                preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
+                if($match[2] != '') {
+                    $this->_parse_modifiers($match[1], $match[2]);
+                    return $match[1];
+                }
+            }
+        elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // single quoted text
+                preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
+                if($match[2] != '') {
+                    $this->_parse_modifiers($match[1], $match[2]);
+                    return $match[1];
+                }
+            }
+        elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // config var
+                return $this->_parse_conf_var($val);
+            }
+        elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // section var
+                return $this->_parse_section_prop($val);
+            }
+        elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
+            // literal string
+            return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"');
+        }
+        return $val;
+    }
+
+    /**
+     * expand quoted text with embedded variables
+     *
+     * @param string $var_expr
+     * @return string
+     */
+    function _expand_quoted_text($var_expr)
+    {
+        // if contains unescaped $, expand it
+        if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) {
+            $_match = $_match[0];
+            rsort($_match);
+            reset($_match);
+            foreach($_match as $_var) {
+                $var_expr = str_replace ($_var, '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."', $var_expr);
+            }
+            $_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr);
+        } else {
+            $_return = $var_expr;
+        }
+        // replace double quoted literal string with single quotes
+        $_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return);
+        return $_return;
+    }
+
+    /**
+     * parse variable expression into PHP code
+     *
+     * @param string $var_expr
+     * @param string $output
+     * @return string
+     */
+    function _parse_var($var_expr)
+    {
+        $_has_math = false;
+        $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+        if(count($_math_vars) > 1) {
+            $_first_var = "";
+            $_complete_var = "";
+            $_output = "";
+            // simple check if there is any math, to stop recursion (due to modifiers with "xx % yy" as parameter)
+            foreach($_math_vars as $_k => $_math_var) {
+                $_math_var = $_math_vars[$_k];
+
+                if(!empty($_math_var) || is_numeric($_math_var)) {
+                    // hit a math operator, so process the stuff which came before it
+                    if(preg_match('~^' . $this->_dvar_math_regexp . '$~', $_math_var)) {
+                        $_has_math = true;
+                        if(!empty($_complete_var) || is_numeric($_complete_var)) {
+                            $_output .= $this->_parse_var($_complete_var);
+                        }
+
+                        // just output the math operator to php
+                        $_output .= $_math_var;
+
+                        if(empty($_first_var))
+                            $_first_var = $_complete_var;
+
+                        $_complete_var = "";
+                    } else {
+                        $_complete_var .= $_math_var;
+                    }
+                }
+            }
+            if($_has_math) {
+                if(!empty($_complete_var) || is_numeric($_complete_var))
+                    $_output .= $this->_parse_var($_complete_var);
+
+                // get the modifiers working (only the last var from math + modifier is left)
+                $var_expr = $_complete_var;
+            }
+        }
+
+        // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit)
+        if(is_numeric(substr($var_expr, 0, 1)))
+            $_var_ref = $var_expr;
+        else
+            $_var_ref = substr($var_expr, 1);
+        
+        if(!$_has_math) {
+            
+            // get [foo] and .foo and ->foo and (...) pieces
+            preg_match_all('~(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, $match);
+                        
+            $_indexes = $match[0];
+            $_var_name = array_shift($_indexes);
+
+            /* Handle $smarty.* variable references as a special case. */
+            if ($_var_name == 'smarty') {
+                /*
+                 * If the reference could be compiled, use the compiled output;
+                 * otherwise, fall back on the $smarty variable generated at
+                 * run-time.
+                 */
+                if (($smarty_ref = $this->_compile_smarty_ref($_indexes)) !== null) {
+                    $_output = $smarty_ref;
+                } else {
+                    $_var_name = substr(array_shift($_indexes), 1);
+                    $_output = "\$this->_smarty_vars['$_var_name']";
+                }
+            } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) {
+                // because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers
+                if(count($_indexes) > 0)
+                {
+                    $_var_name .= implode("", $_indexes);
+                    $_indexes = array();
+                }
+                $_output = $_var_name;
+            } else {
+                $_output = "\$this->_tpl_vars['$_var_name']";
+            }
+
+            foreach ($_indexes as $_index) {
+                if (substr($_index, 0, 1) == '[') {
+                    $_index = substr($_index, 1, -1);
+                    if (is_numeric($_index)) {
+                        $_output .= "[$_index]";
+                    } elseif (substr($_index, 0, 1) == '$') {
+                        if (strpos($_index, '.') !== false) {
+                            $_output .= '[' . $this->_parse_var($_index) . ']';
+                        } else {
+                            $_output .= "[\$this->_tpl_vars['" . substr($_index, 1) . "']]";
+                        }
+                    } else {
+                        $_var_parts = explode('.', $_index);
+                        $_var_section = $_var_parts[0];
+                        $_var_section_prop = isset($_var_parts[1]) ? $_var_parts[1] : 'index';
+                        $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]";
+                    }
+                } else if (substr($_index, 0, 1) == '.') {
+                    if (substr($_index, 1, 1) == '$')
+                        $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]";
+                    else
+                        $_output .= "['" . substr($_index, 1) . "']";
+                } else if (substr($_index,0,2) == '->') {
+                    if(substr($_index,2,2) == '__') {
+                        $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);
+                    } elseif($this->security && substr($_index, 2, 1) == '_') {
+                        $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__);
+                    } elseif (substr($_index, 2, 1) == '$') {
+                        if ($this->security) {
+                            $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__);
+                        } else {
+                            $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}';
+                        }
+                    } else {
+                        $_output .= $_index;
+                    }
+                } elseif (substr($_index, 0, 1) == '(') {
+                    $_index = $this->_parse_parenth_args($_index);
+                    $_output .= $_index;
+                } else {
+                    $_output .= $_index;
+                }
+            }
+        }
+
+        return $_output;
+    }
+
+    /**
+     * parse arguments in function call parenthesis
+     *
+     * @param string $parenth_args
+     * @return string
+     */
+    function _parse_parenth_args($parenth_args)
+    {
+        preg_match_all('~' . $this->_param_regexp . '~',$parenth_args, $match);
+        $orig_vals = $match = $match[0];
+        $this->_parse_vars_props($match);
+        $replace = array();
+        for ($i = 0, $count = count($match); $i < $count; $i++) {
+            $replace[$orig_vals[$i]] = $match[$i];
+        }
+        return strtr($parenth_args, $replace);
+    }
+
+    /**
+     * parse configuration variable expression into PHP code
+     *
+     * @param string $conf_var_expr
+     */
+    function _parse_conf_var($conf_var_expr)
+    {
+        $parts = explode('|', $conf_var_expr, 2);
+        $var_ref = $parts[0];
+        $modifiers = isset($parts[1]) ? $parts[1] : '';
+
+        $var_name = substr($var_ref, 1, -1);
+
+        $output = "\$this->_config[0]['vars']['$var_name']";
+
+        $this->_parse_modifiers($output, $modifiers);
+
+        return $output;
+    }
+
+    /**
+     * parse section property expression into PHP code
+     *
+     * @param string $section_prop_expr
+     * @return string
+     */
+    function _parse_section_prop($section_prop_expr)
+    {
+        $parts = explode('|', $section_prop_expr, 2);
+        $var_ref = $parts[0];
+        $modifiers = isset($parts[1]) ? $parts[1] : '';
+
+        preg_match('!%(\w+)\.(\w+)%!', $var_ref, $match);
+        $section_name = $match[1];
+        $prop_name = $match[2];
+
+        $output = "\$this->_sections['$section_name']['$prop_name']";
+
+        $this->_parse_modifiers($output, $modifiers);
+
+        return $output;
+    }
+
+
+    /**
+     * parse modifier chain into PHP code
+     *
+     * sets $output to parsed modified chain
+     * @param string $output
+     * @param string $modifier_string
+     */
+    function _parse_modifiers(&$output, $modifier_string)
+    {
+        preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match);
+        list(, $_modifiers, $modifier_arg_strings) = $_match;
+
+        for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) {
+            $_modifier_name = $_modifiers[$_i];
+
+            if($_modifier_name == 'smarty') {
+                // skip smarty modifier
+                continue;
+            }
+
+            preg_match_all('~:(' . $this->_qstr_regexp . '|[^:]+)~', $modifier_arg_strings[$_i], $_match);
+            $_modifier_args = $_match[1];
+
+            if (substr($_modifier_name, 0, 1) == '@') {
+                $_map_array = false;
+                $_modifier_name = substr($_modifier_name, 1);
+            } else {
+                $_map_array = true;
+            }
+
+            if (empty($this->_plugins['modifier'][$_modifier_name])
+                && !$this->_get_plugin_filepath('modifier', $_modifier_name)
+                && function_exists($_modifier_name)) {
+                if ($this->security && !in_array($_modifier_name, $this->security_settings['MODIFIER_FUNCS'])) {
+                    $this->_trigger_fatal_error("[plugin] (secure mode) modifier '$_modifier_name' is not allowed" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__);
+                } else {
+                    $this->_plugins['modifier'][$_modifier_name] = array($_modifier_name,  null, null, false);
+                }
+            }
+            $this->_add_plugin('modifier', $_modifier_name);
+
+            $this->_parse_vars_props($_modifier_args);
+
+            if($_modifier_name == 'default') {
+                // supress notifications of default modifier vars and args
+                if(substr($output, 0, 1) == '$') {
+                    $output = '@' . $output;
+                }
+                if(isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') {
+                    $_modifier_args[0] = '@' . $_modifier_args[0];
+                }
+            }
+            if (count($_modifier_args) > 0)
+                $_modifier_args = ', '.implode(', ', $_modifier_args);
+            else
+                $_modifier_args = '';
+
+            if ($_map_array) {
+                $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))";
+
+            } else {
+
+                $output = $this->_compile_plugin_call('modifier', $_modifier_name)."($output$_modifier_args)";
+
+            }
+        }
+    }
+
+
+    /**
+     * add plugin
+     *
+     * @param string $type
+     * @param string $name
+     * @param boolean? $delayed_loading
+     */
+    function _add_plugin($type, $name, $delayed_loading = null)
+    {
+        if (!isset($this->_plugin_info[$type])) {
+            $this->_plugin_info[$type] = array();
+        }
+        if (!isset($this->_plugin_info[$type][$name])) {
+            $this->_plugin_info[$type][$name] = array($this->_current_file,
+                                                      $this->_current_line_no,
+                                                      $delayed_loading);
+        }
+    }
+
+
+    /**
+     * Compiles references of type $smarty.foo
+     *
+     * @param string $indexes
+     * @return string
+     */
+    function _compile_smarty_ref(&$indexes)
+    {
+        /* Extract the reference name. */
+        $_ref = substr($indexes[0], 1);
+        foreach($indexes as $_index_no=>$_index) {
+            if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) {
+                $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
+            }
+        }
+
+        switch ($_ref) {
+            case 'now':
+                $compiled_ref = 'time()';
+                $_max_index = 1;
+                break;
+
+            case 'foreach':
+                array_shift($indexes);
+                $_var = $this->_parse_var_props(substr($indexes[0], 1));
+                $_propname = substr($indexes[1], 1);
+                $_max_index = 1;
+                switch ($_propname) {
+                    case 'index':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['iteration']-1)";
+                        break;
+                        
+                    case 'first':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['iteration'] <= 1)";
+                        break;
+
+                    case 'last':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['iteration'] == \$this->_foreach[$_var]['total'])";
+                        break;
+                        
+                    case 'show':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['total'] > 0)";
+                        break;
+                        
+                    default:
+                        unset($_max_index);
+                        $compiled_ref = "\$this->_foreach[$_var]";
+                }
+                break;
+
+            case 'section':
+                array_shift($indexes);
+                $_var = $this->_parse_var_props(substr($indexes[0], 1));
+                $compiled_ref = "\$this->_sections[$_var]";
+                break;
+
+            case 'get':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']";
+                break;
+
+            case 'post':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']";
+                break;
+
+            case 'cookies':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']";
+                break;
+
+            case 'env':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']";
+                break;
+
+            case 'server':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']";
+                break;
+
+            case 'session':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']";
+                break;
+
+            /*
+             * These cases are handled either at run-time or elsewhere in the
+             * compiler.
+             */
+            case 'request':
+                if ($this->request_use_auto_globals) {
+                    $compiled_ref = '$_REQUEST';
+                    break;
+                } else {
+                    $this->_init_smarty_vars = true;
+                }
+                return null;
+
+            case 'capture':
+                return null;
+
+            case 'template':
+                $compiled_ref = "'$this->_current_file'";
+                $_max_index = 1;
+                break;
+
+            case 'version':
+                $compiled_ref = "'$this->_version'";
+                $_max_index = 1;
+                break;
+
+            case 'const':
+                if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) {
+                    $this->_syntax_error("(secure mode) constants not permitted",
+                                         E_USER_WARNING, __FILE__, __LINE__);
+                    return;
+                }
+                array_shift($indexes);
+                if (preg_match('!^\.\w+$!', $indexes[0])) {
+                    $compiled_ref = '@' . substr($indexes[0], 1);
+                } else {
+                    $_val = $this->_parse_var_props(substr($indexes[0], 1));
+                    $compiled_ref = '@constant(' . $_val . ')';
+                }
+                $_max_index = 1;
+                break;
+
+            case 'config':
+                $compiled_ref = "\$this->_config[0]['vars']";
+                $_max_index = 3;
+                break;
+
+            case 'ldelim':
+                $compiled_ref = "'$this->left_delimiter'";
+                break;
+
+            case 'rdelim':
+                $compiled_ref = "'$this->right_delimiter'";
+                break;
+                
+            default:
+                $this->_syntax_error('$smarty.' . $_ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
+                break;
+        }
+
+        if (isset($_max_index) && count($indexes) > $_max_index) {
+            $this->_syntax_error('$smarty' . implode('', $indexes) .' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        array_shift($indexes);
+        return $compiled_ref;
+    }
+
+    /**
+     * compiles call to plugin of type $type with name $name
+     * returns a string containing the function-name or method call
+     * without the paramter-list that would have follow to make the
+     * call valid php-syntax
+     *
+     * @param string $type
+     * @param string $name
+     * @return string
+     */
+    function _compile_plugin_call($type, $name) {
+        if (isset($this->_plugins[$type][$name])) {
+            /* plugin loaded */
+            if (is_array($this->_plugins[$type][$name][0])) {
+                return ((is_object($this->_plugins[$type][$name][0][0])) ?
+                        "\$this->_plugins['$type']['$name'][0][0]->"    /* method callback */
+                        : (string)($this->_plugins[$type][$name][0][0]).'::'    /* class callback */
+                       ). $this->_plugins[$type][$name][0][1];
+
+            } else {
+                /* function callback */
+                return $this->_plugins[$type][$name][0];
+
+            }
+        } else {
+            /* plugin not loaded -> auto-loadable-plugin */
+            return 'smarty_'.$type.'_'.$name;
+
+        }
+    }
+
+    /**
+     * load pre- and post-filters
+     */
+    function _load_filters()
+    {
+        if (count($this->_plugins['prefilter']) > 0) {
+            foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
+                if ($prefilter === false) {
+                    unset($this->_plugins['prefilter'][$filter_name]);
+                    $_params = array('plugins' => array(array('prefilter', $filter_name, null, null, false)));
+                    require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                    smarty_core_load_plugins($_params, $this);
+                }
+            }
+        }
+        if (count($this->_plugins['postfilter']) > 0) {
+            foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
+                if ($postfilter === false) {
+                    unset($this->_plugins['postfilter'][$filter_name]);
+                    $_params = array('plugins' => array(array('postfilter', $filter_name, null, null, false)));
+                    require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                    smarty_core_load_plugins($_params, $this);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Quote subpattern references
+     *
+     * @param string $string
+     * @return string
+     */
+    function _quote_replace($string)
+    {
+        return strtr($string, array('\\' => '\\\\', '$' => '\\$'));
+    }
+
+    /**
+     * display Smarty syntax error
+     *
+     * @param string $error_msg
+     * @param integer $error_type
+     * @param string $file
+     * @param integer $line
+     */
+    function _syntax_error($error_msg, $error_type = E_USER_ERROR, $file=null, $line=null)
+    {
+        $this->_trigger_fatal_error("syntax error: $error_msg", $this->_current_file, $this->_current_line_no, $file, $line, $error_type);
+    }
+
+
+    /**
+     * check if the compilation changes from cacheable to
+     * non-cacheable state with the beginning of the current
+     * plugin. return php-code to reflect the transition.
+     * @return string
+     */
+    function _push_cacheable_state($type, $name) {
+        $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
+        if ($_cacheable
+            || 0<$this->_cacheable_state++) return '';
+        if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty'));
+        $_ret = 'if ($this->caching && !$this->_cache_including) { echo \'{nocache:'
+            . $this->_cache_serial . '#' . $this->_nocache_count
+            . '}\'; };';
+        return $_ret;
+    }
+
+
+    /**
+     * check if the compilation changes from non-cacheable to
+     * cacheable state with the end of the current plugin return
+     * php-code to reflect the transition.
+     * @return string
+     */
+    function _pop_cacheable_state($type, $name) {
+        $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
+        if ($_cacheable
+            || --$this->_cacheable_state>0) return '';
+        return 'if ($this->caching && !$this->_cache_including) { echo \'{/nocache:'
+            . $this->_cache_serial . '#' . ($this->_nocache_count++)
+            . '}\'; };';
+    }
+
+
+    /**
+     * push opening tag-name, file-name and line-number on the tag-stack
+     * @param string the opening tag's name
+     */
+    function _push_tag($open_tag)
+    {
+        array_push($this->_tag_stack, array($open_tag, $this->_current_line_no));
+    }
+
+    /**
+     * pop closing tag-name
+     * raise an error if this stack-top doesn't match with the closing tag
+     * @param string the closing tag's name
+     * @return string the opening tag's name
+     */
+    function _pop_tag($close_tag)
+    {
+        $message = '';
+        if (count($this->_tag_stack)>0) {
+            list($_open_tag, $_line_no) = array_pop($this->_tag_stack);
+            if ($close_tag == $_open_tag) {
+                return $_open_tag;
+            }
+            if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif' )) {
+                return $this->_pop_tag($close_tag);
+            }
+            if ($close_tag == 'section' && $_open_tag == 'sectionelse') {
+                $this->_pop_tag($close_tag);
+                return $_open_tag;
+            }
+            if ($close_tag == 'foreach' && $_open_tag == 'foreachelse') {
+                $this->_pop_tag($close_tag);
+                return $_open_tag;
+            }
+            if ($_open_tag == 'else' || $_open_tag == 'elseif') {
+                $_open_tag = 'if';
+            } elseif ($_open_tag == 'sectionelse') {
+                $_open_tag = 'section';
+            } elseif ($_open_tag == 'foreachelse') {
+                $_open_tag = 'foreach';
+            }
+            $message = " expected {/$_open_tag} (opened line $_line_no).";
+        }
+        $this->_syntax_error("mismatched tag {/$close_tag}.$message",
+                             E_USER_ERROR, __FILE__, __LINE__);
+    }
+
+}
+
+/**
+ * compare to values by their string length
+ *
+ * @access private
+ * @param string $a
+ * @param string $b
+ * @return 0|-1|1
+ */
+function _smarty_sort_length($a, $b)
+{
+    if($a == $b)
+        return 0;
+
+    if(strlen($a) == strlen($b))
+        return ($a > $b) ? -1 : 1;
+
+    return (strlen($a) > strlen($b)) ? -1 : 1;
+}
+
+
+/* vim: set et: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/Smarty.class.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/Smarty.class.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/Smarty.class.php	(revision 1328)
@@ -0,0 +1,1944 @@
+<?php
+
+/**
+ * Project:     Smarty: the PHP compiling template engine
+ * File:        Smarty.class.php
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * For questions, help, comments, discussion, etc., please join the
+ * Smarty mailing list. Send a blank e-mail to
+ * smarty-general-subscribe@lists.php.net
+ *
+ * @link http://smarty.php.net/
+ * @copyright 2001-2005 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Andrei Zmievski <andrei@php.net>
+ * @package Smarty
+ * @version 2.6.13
+ */
+
+/* $Id$ */
+
+/**
+ * DIR_SEP isn't used anymore, but third party apps might
+ */
+if(!defined('DIR_SEP')) {
+    define('DIR_SEP', DIRECTORY_SEPARATOR);
+}
+
+/**
+ * set SMARTY_DIR to absolute path to Smarty library files.
+ * if not defined, include_path will be used. Sets SMARTY_DIR only if user
+ * application has not already defined it.
+ */
+
+if (!defined('SMARTY_DIR')) {
+    define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+}
+
+if (!defined('SMARTY_CORE_DIR')) {
+    define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
+}
+
+define('SMARTY_PHP_PASSTHRU',   0);
+define('SMARTY_PHP_QUOTE',      1);
+define('SMARTY_PHP_REMOVE',     2);
+define('SMARTY_PHP_ALLOW',      3);
+
+/**
+ * @package Smarty
+ */
+class Smarty
+{
+    /**#@+
+     * Smarty Configuration Section
+     */
+
+    /**
+     * The name of the directory where templates are located.
+     *
+     * @var string
+     */
+    var $template_dir    =  'templates';
+
+    /**
+     * The directory where compiled templates are located.
+     *
+     * @var string
+     */
+    var $compile_dir     =  'templates_c';
+
+    /**
+     * The directory where config files are located.
+     *
+     * @var string
+     */
+    var $config_dir      =  'configs';
+
+    /**
+     * An array of directories searched for plugins.
+     *
+     * @var array
+     */
+    var $plugins_dir     =  array('plugins');
+
+    /**
+     * If debugging is enabled, a debug console window will display
+     * when the page loads (make sure your browser allows unrequested
+     * popup windows)
+     *
+     * @var boolean
+     */
+    var $debugging       =  false;
+
+    /**
+     * When set, smarty does uses this value as error_reporting-level.
+     *
+     * @var boolean
+     */
+    var $error_reporting  =  null;
+
+    /**
+     * This is the path to the debug console template. If not set,
+     * the default one will be used.
+     *
+     * @var string
+     */
+    var $debug_tpl       =  '';
+
+    /**
+     * This determines if debugging is enable-able from the browser.
+     * <ul>
+     *  <li>NONE => no debugging control allowed</li>
+     *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
+     * </ul>
+     * @link http://www.foo.dom/index.php?SMARTY_DEBUG
+     * @var string
+     */
+    var $debugging_ctrl  =  'NONE';
+
+    /**
+     * This tells Smarty whether to check for recompiling or not. Recompiling
+     * does not need to happen unless a template or config file is changed.
+     * Typically you enable this during development, and disable for
+     * production.
+     *
+     * @var boolean
+     */
+    var $compile_check   =  true;
+
+    /**
+     * This forces templates to compile every time. Useful for development
+     * or debugging.
+     *
+     * @var boolean
+     */
+    var $force_compile   =  false;
+
+    /**
+     * This enables template caching.
+     * <ul>
+     *  <li>0 = no caching</li>
+     *  <li>1 = use class cache_lifetime value</li>
+     *  <li>2 = use cache_lifetime in cache file</li>
+     * </ul>
+     * @var integer
+     */
+    var $caching         =  0;
+
+    /**
+     * The name of the directory for cache files.
+     *
+     * @var string
+     */
+    var $cache_dir       =  'cache';
+
+    /**
+     * This is the number of seconds cached content will persist.
+     * <ul>
+     *  <li>0 = always regenerate cache</li>
+     *  <li>-1 = never expires</li>
+     * </ul>
+     *
+     * @var integer
+     */
+    var $cache_lifetime  =  3600;
+
+    /**
+     * Only used when $caching is enabled. If true, then If-Modified-Since headers
+     * are respected with cached content, and appropriate HTTP headers are sent.
+     * This way repeated hits to a cached page do not send the entire page to the
+     * client every time.
+     *
+     * @var boolean
+     */
+    var $cache_modified_check = false;
+
+    /**
+     * This determines how Smarty handles "<?php ... ?>" tags in templates.
+     * possible values:
+     * <ul>
+     *  <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>
+     *  <li>SMARTY_PHP_QUOTE    -> escape tags as entities</li>
+     *  <li>SMARTY_PHP_REMOVE   -> remove php tags</li>
+     *  <li>SMARTY_PHP_ALLOW    -> execute php tags</li>
+     * </ul>
+     *
+     * @var integer
+     */
+    var $php_handling    =  SMARTY_PHP_PASSTHRU;
+
+    /**
+     * This enables template security. When enabled, many things are restricted
+     * in the templates that normally would go unchecked. This is useful when
+     * untrusted parties are editing templates and you want a reasonable level
+     * of security. (no direct execution of PHP in templates for example)
+     *
+     * @var boolean
+     */
+    var $security       =   false;
+
+    /**
+     * This is the list of template directories that are considered secure. This
+     * is used only if {@link $security} is enabled. One directory per array
+     * element.  {@link $template_dir} is in this list implicitly.
+     *
+     * @var array
+     */
+    var $secure_dir     =   array();
+
+    /**
+     * These are the security settings for Smarty. They are used only when
+     * {@link $security} is enabled.
+     *
+     * @var array
+     */
+    var $security_settings  = array(
+                                    'PHP_HANDLING'    => false,
+                                    'IF_FUNCS'        => array('array', 'list',
+                                                               'isset', 'empty',
+                                                               'count', 'sizeof',
+                                                               'in_array', 'is_array',
+                                                               'true', 'false', 'null'),
+                                    'INCLUDE_ANY'     => false,
+                                    'PHP_TAGS'        => false,
+                                    'MODIFIER_FUNCS'  => array('count'),
+                                    'ALLOW_CONSTANTS'  => false
+                                   );
+
+    /**
+     * This is an array of directories where trusted php scripts reside.
+     * {@link $security} is disabled during their inclusion/execution.
+     *
+     * @var array
+     */
+    var $trusted_dir        = array();
+
+    /**
+     * The left delimiter used for the template tags.
+     *
+     * @var string
+     */
+    var $left_delimiter  =  '{';
+
+    /**
+     * The right delimiter used for the template tags.
+     *
+     * @var string
+     */
+    var $right_delimiter =  '}';
+
+    /**
+     * The order in which request variables are registered, similar to
+     * variables_order in php.ini E = Environment, G = GET, P = POST,
+     * C = Cookies, S = Server
+     *
+     * @var string
+     */
+    var $request_vars_order    = 'EGPCS';
+
+    /**
+     * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
+     * are uses as request-vars or $_*[]-vars. note: if
+     * request_use_auto_globals is true, then $request_vars_order has
+     * no effect, but the php-ini-value "gpc_order"
+     *
+     * @var boolean
+     */
+    var $request_use_auto_globals      = true;
+
+    /**
+     * Set this if you want different sets of compiled files for the same
+     * templates. This is useful for things like different languages.
+     * Instead of creating separate sets of templates per language, you
+     * set different compile_ids like 'en' and 'de'.
+     *
+     * @var string
+     */
+    var $compile_id            = null;
+
+    /**
+     * This tells Smarty whether or not to use sub dirs in the cache/ and
+     * templates_c/ directories. sub directories better organized, but
+     * may not work well with PHP safe mode enabled.
+     *
+     * @var boolean
+     *
+     */
+    var $use_sub_dirs          = false;
+
+    /**
+     * This is a list of the modifiers to apply to all template variables.
+     * Put each modifier in a separate array element in the order you want
+     * them applied. example: <code>array('escape:"htmlall"');</code>
+     *
+     * @var array
+     */
+    var $default_modifiers        = array();
+
+    /**
+     * This is the resource type to be used when not specified
+     * at the beginning of the resource path. examples:
+     * $smarty->display('file:index.tpl');
+     * $smarty->display('db:index.tpl');
+     * $smarty->display('index.tpl'); // will use default resource type
+     * {include file="file:index.tpl"}
+     * {include file="db:index.tpl"}
+     * {include file="index.tpl"} {* will use default resource type *}
+     *
+     * @var array
+     */
+    var $default_resource_type    = 'file';
+
+    /**
+     * The function used for cache file handling. If not set, built-in caching is used.
+     *
+     * @var null|string function name
+     */
+    var $cache_handler_func   = null;
+
+    /**
+     * This indicates which filters are automatically loaded into Smarty.
+     *
+     * @var array array of filter names
+     */
+    var $autoload_filters = array();
+
+    /**#@+
+     * @var boolean
+     */
+    /**
+     * This tells if config file vars of the same name overwrite each other or not.
+     * if disabled, same name variables are accumulated in an array.
+     */
+    var $config_overwrite = true;
+
+    /**
+     * This tells whether or not to automatically booleanize config file variables.
+     * If enabled, then the strings "on", "true", and "yes" are treated as boolean
+     * true, and "off", "false" and "no" are treated as boolean false.
+     */
+    var $config_booleanize = true;
+
+    /**
+     * This tells whether hidden sections [.foobar] are readable from the
+     * tempalates or not. Normally you would never allow this since that is
+     * the point behind hidden sections: the application can access them, but
+     * the templates cannot.
+     */
+    var $config_read_hidden = false;
+
+    /**
+     * This tells whether or not automatically fix newlines in config files.
+     * It basically converts \r (mac) or \r\n (dos) to \n
+     */
+    var $config_fix_newlines = true;
+    /**#@-*/
+
+    /**
+     * If a template cannot be found, this PHP function will be executed.
+     * Useful for creating templates on-the-fly or other special action.
+     *
+     * @var string function name
+     */
+    var $default_template_handler_func = '';
+
+    /**
+     * The file that contains the compiler class. This can a full
+     * pathname, or relative to the php_include path.
+     *
+     * @var string
+     */
+    var $compiler_file        =    'Smarty_Compiler.class.php';
+
+    /**
+     * The class used for compiling templates.
+     *
+     * @var string
+     */
+    var $compiler_class        =   'Smarty_Compiler';
+
+    /**
+     * The class used to load config vars.
+     *
+     * @var string
+     */
+    var $config_class          =   'Config_File';
+
+/**#@+
+ * END Smarty Configuration Section
+ * There should be no need to touch anything below this line.
+ * @access private
+ */
+    /**
+     * where assigned template vars are kept
+     *
+     * @var array
+     */
+    var $_tpl_vars             = array();
+
+    /**
+     * stores run-time $smarty.* vars
+     *
+     * @var null|array
+     */
+    var $_smarty_vars          = null;
+
+    /**
+     * keeps track of sections
+     *
+     * @var array
+     */
+    var $_sections             = array();
+
+    /**
+     * keeps track of foreach blocks
+     *
+     * @var array
+     */
+    var $_foreach              = array();
+
+    /**
+     * keeps track of tag hierarchy
+     *
+     * @var array
+     */
+    var $_tag_stack            = array();
+
+    /**
+     * configuration object
+     *
+     * @var Config_file
+     */
+    var $_conf_obj             = null;
+
+    /**
+     * loaded configuration settings
+     *
+     * @var array
+     */
+    var $_config               = array(array('vars'  => array(), 'files' => array()));
+
+    /**
+     * md5 checksum of the string 'Smarty'
+     *
+     * @var string
+     */
+    var $_smarty_md5           = 'f8d698aea36fcbead2b9d5359ffca76f';
+
+    /**
+     * Smarty version number
+     *
+     * @var string
+     */
+    var $_version              = '2.6.13';
+
+    /**
+     * current template inclusion depth
+     *
+     * @var integer
+     */
+    var $_inclusion_depth      = 0;
+
+    /**
+     * for different compiled templates
+     *
+     * @var string
+     */
+    var $_compile_id           = null;
+
+    /**
+     * text in URL to enable debug mode
+     *
+     * @var string
+     */
+    var $_smarty_debug_id      = 'SMARTY_DEBUG';
+
+    /**
+     * debugging information for debug console
+     *
+     * @var array
+     */
+    var $_smarty_debug_info    = array();
+
+    /**
+     * info that makes up a cache file
+     *
+     * @var array
+     */
+    var $_cache_info           = array();
+
+    /**
+     * default file permissions
+     *
+     * @var integer
+     */
+    var $_file_perms           = 0644;
+
+    /**
+     * default dir permissions
+     *
+     * @var integer
+     */
+    var $_dir_perms               = 0771;
+
+    /**
+     * registered objects
+     *
+     * @var array
+     */
+    var $_reg_objects           = array();
+
+    /**
+     * table keeping track of plugins
+     *
+     * @var array
+     */
+    var $_plugins              = array(
+                                       'modifier'      => array(),
+                                       'function'      => array(),
+                                       'block'         => array(),
+                                       'compiler'      => array(),
+                                       'prefilter'     => array(),
+                                       'postfilter'    => array(),
+                                       'outputfilter'  => array(),
+                                       'resource'      => array(),
+                                       'insert'        => array());
+
+
+    /**
+     * cache serials
+     *
+     * @var array
+     */
+    var $_cache_serials = array();
+
+    /**
+     * name of optional cache include file
+     *
+     * @var string
+     */
+    var $_cache_include = null;
+
+    /**
+     * indicate if the current code is used in a compiled
+     * include
+     *
+     * @var string
+     */
+    var $_cache_including = false;
+
+    /**#@-*/
+    /**
+     * The class constructor.
+     */
+    function Smarty()
+    {
+      $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
+                    : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
+    }
+
+    /**
+     * assigns values to template variables
+     *
+     * @param array|string $tpl_var the template variable name(s)
+     * @param mixed $value the value to assign
+     */
+    function assign($tpl_var, $value = null)
+    {
+        if (is_array($tpl_var)){
+            foreach ($tpl_var as $key => $val) {
+                if ($key != '') {
+                    $this->_tpl_vars[$key] = $val;
+                }
+            }
+        } else {
+            if ($tpl_var != '')
+                $this->_tpl_vars[$tpl_var] = $value;
+        }
+    }
+
+    /**
+     * assigns values to template variables by reference
+     *
+     * @param string $tpl_var the template variable name
+     * @param mixed $value the referenced value to assign
+     */
+    function assign_by_ref($tpl_var, &$value)
+    {
+        if ($tpl_var != '')
+            $this->_tpl_vars[$tpl_var] = &$value;
+    }
+
+    /**
+     * appends values to template variables
+     *
+     * @param array|string $tpl_var the template variable name(s)
+     * @param mixed $value the value to append
+     */
+    function append($tpl_var, $value=null, $merge=false)
+    {
+        if (is_array($tpl_var)) {
+            // $tpl_var is an array, ignore $value
+            foreach ($tpl_var as $_key => $_val) {
+                if ($_key != '') {
+                    if(!@is_array($this->_tpl_vars[$_key])) {
+                        settype($this->_tpl_vars[$_key],'array');
+                    }
+                    if($merge && is_array($_val)) {
+                        foreach($_val as $_mkey => $_mval) {
+                            $this->_tpl_vars[$_key][$_mkey] = $_mval;
+                        }
+                    } else {
+                        $this->_tpl_vars[$_key][] = $_val;
+                    }
+                }
+            }
+        } else {
+            if ($tpl_var != '' && isset($value)) {
+                if(!@is_array($this->_tpl_vars[$tpl_var])) {
+                    settype($this->_tpl_vars[$tpl_var],'array');
+                }
+                if($merge && is_array($value)) {
+                    foreach($value as $_mkey => $_mval) {
+                        $this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
+                    }
+                } else {
+                    $this->_tpl_vars[$tpl_var][] = $value;
+                }
+            }
+        }
+    }
+
+    /**
+     * appends values to template variables by reference
+     *
+     * @param string $tpl_var the template variable name
+     * @param mixed $value the referenced value to append
+     */
+    function append_by_ref($tpl_var, &$value, $merge=false)
+    {
+        if ($tpl_var != '' && isset($value)) {
+            if(!@is_array($this->_tpl_vars[$tpl_var])) {
+             settype($this->_tpl_vars[$tpl_var],'array');
+            }
+            if ($merge && is_array($value)) {
+                foreach($value as $_key => $_val) {
+                    $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
+                }
+            } else {
+                $this->_tpl_vars[$tpl_var][] = &$value;
+            }
+        }
+    }
+
+
+    /**
+     * clear the given assigned template variable.
+     *
+     * @param string $tpl_var the template variable to clear
+     */
+    function clear_assign($tpl_var)
+    {
+        if (is_array($tpl_var))
+            foreach ($tpl_var as $curr_var)
+                unset($this->_tpl_vars[$curr_var]);
+        else
+            unset($this->_tpl_vars[$tpl_var]);
+    }
+
+
+    /**
+     * Registers custom function to be used in templates
+     *
+     * @param string $function the name of the template function
+     * @param string $function_impl the name of the PHP function to register
+     */
+    function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
+    {
+        $this->_plugins['function'][$function] =
+            array($function_impl, null, null, false, $cacheable, $cache_attrs);
+
+    }
+
+    /**
+     * Unregisters custom function
+     *
+     * @param string $function name of template function
+     */
+    function unregister_function($function)
+    {
+        unset($this->_plugins['function'][$function]);
+    }
+
+    /**
+     * Registers object to be used in templates
+     *
+     * @param string $object name of template object
+     * @param object &$object_impl the referenced PHP object to register
+     * @param null|array $allowed list of allowed methods (empty = all)
+     * @param boolean $smarty_args smarty argument format, else traditional
+     * @param null|array $block_functs list of methods that are block format
+     */
+    function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+    {
+        settype($allowed, 'array');
+        settype($smarty_args, 'boolean');
+        $this->_reg_objects[$object] =
+            array(&$object_impl, $allowed, $smarty_args, $block_methods);
+    }
+
+    /**
+     * Unregisters object
+     *
+     * @param string $object name of template object
+     */
+    function unregister_object($object)
+    {
+        unset($this->_reg_objects[$object]);
+    }
+
+
+    /**
+     * Registers block function to be used in templates
+     *
+     * @param string $block name of template block
+     * @param string $block_impl PHP function to register
+     */
+    function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
+    {
+        $this->_plugins['block'][$block] =
+            array($block_impl, null, null, false, $cacheable, $cache_attrs);
+    }
+
+    /**
+     * Unregisters block function
+     *
+     * @param string $block name of template function
+     */
+    function unregister_block($block)
+    {
+        unset($this->_plugins['block'][$block]);
+    }
+
+    /**
+     * Registers compiler function
+     *
+     * @param string $function name of template function
+     * @param string $function_impl name of PHP function to register
+     */
+    function register_compiler_function($function, $function_impl, $cacheable=true)
+    {
+        $this->_plugins['compiler'][$function] =
+            array($function_impl, null, null, false, $cacheable);
+    }
+
+    /**
+     * Unregisters compiler function
+     *
+     * @param string $function name of template function
+     */
+    function unregister_compiler_function($function)
+    {
+        unset($this->_plugins['compiler'][$function]);
+    }
+
+    /**
+     * Registers modifier to be used in templates
+     *
+     * @param string $modifier name of template modifier
+     * @param string $modifier_impl name of PHP function to register
+     */
+    function register_modifier($modifier, $modifier_impl)
+    {
+        $this->_plugins['modifier'][$modifier] =
+            array($modifier_impl, null, null, false);
+    }
+
+    /**
+     * Unregisters modifier
+     *
+     * @param string $modifier name of template modifier
+     */
+    function unregister_modifier($modifier)
+    {
+        unset($this->_plugins['modifier'][$modifier]);
+    }
+
+    /**
+     * Registers a resource to fetch a template
+     *
+     * @param string $type name of resource
+     * @param array $functions array of functions to handle resource
+     */
+    function register_resource($type, $functions)
+    {
+        if (count($functions)==4) {
+            $this->_plugins['resource'][$type] =
+                array($functions, false);
+
+        } elseif (count($functions)==5) {
+            $this->_plugins['resource'][$type] =
+                array(array(array(&$functions[0], $functions[1])
+                            ,array(&$functions[0], $functions[2])
+                            ,array(&$functions[0], $functions[3])
+                            ,array(&$functions[0], $functions[4]))
+                      ,false);
+
+        } else {
+            $this->trigger_error("malformed function-list for '$type' in register_resource");
+
+        }
+    }
+
+    /**
+     * Unregisters a resource
+     *
+     * @param string $type name of resource
+     */
+    function unregister_resource($type)
+    {
+        unset($this->_plugins['resource'][$type]);
+    }
+
+    /**
+     * Registers a prefilter function to apply
+     * to a template before compiling
+     *
+     * @param string $function name of PHP function to register
+     */
+    function register_prefilter($function)
+    {
+    $_name = (is_array($function)) ? $function[1] : $function;
+        $this->_plugins['prefilter'][$_name]
+            = array($function, null, null, false);
+    }
+
+    /**
+     * Unregisters a prefilter function
+     *
+     * @param string $function name of PHP function
+     */
+    function unregister_prefilter($function)
+    {
+        unset($this->_plugins['prefilter'][$function]);
+    }
+
+    /**
+     * Registers a postfilter function to apply
+     * to a compiled template after compilation
+     *
+     * @param string $function name of PHP function to register
+     */
+    function register_postfilter($function)
+    {
+    $_name = (is_array($function)) ? $function[1] : $function;
+        $this->_plugins['postfilter'][$_name]
+            = array($function, null, null, false);
+    }
+
+    /**
+     * Unregisters a postfilter function
+     *
+     * @param string $function name of PHP function
+     */
+    function unregister_postfilter($function)
+    {
+        unset($this->_plugins['postfilter'][$function]);
+    }
+
+    /**
+     * Registers an output filter function to apply
+     * to a template output
+     *
+     * @param string $function name of PHP function
+     */
+    function register_outputfilter($function)
+    {
+    $_name = (is_array($function)) ? $function[1] : $function;
+        $this->_plugins['outputfilter'][$_name]
+            = array($function, null, null, false);
+    }
+
+    /**
+     * Unregisters an outputfilter function
+     *
+     * @param string $function name of PHP function
+     */
+    function unregister_outputfilter($function)
+    {
+        unset($this->_plugins['outputfilter'][$function]);
+    }
+
+    /**
+     * load a filter of specified type and name
+     *
+     * @param string $type filter type
+     * @param string $name filter name
+     */
+    function load_filter($type, $name)
+    {
+        switch ($type) {
+            case 'output':
+                $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
+                require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                smarty_core_load_plugins($_params, $this);
+                break;
+
+            case 'pre':
+            case 'post':
+                if (!isset($this->_plugins[$type . 'filter'][$name]))
+                    $this->_plugins[$type . 'filter'][$name] = false;
+                break;
+        }
+    }
+
+    /**
+     * clear cached content for the given template and cache id
+     *
+     * @param string $tpl_file name of template file
+     * @param string $cache_id name of cache_id
+     * @param string $compile_id name of compile_id
+     * @param string $exp_time expiration time
+     * @return boolean
+     */
+    function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
+    {
+
+        if (!isset($compile_id))
+            $compile_id = $this->compile_id;
+
+        if (!isset($tpl_file))
+            $compile_id = null;
+
+        $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
+
+        if (!empty($this->cache_handler_func)) {
+            return call_user_func_array($this->cache_handler_func,
+                                  array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
+        } else {
+            $_params = array('auto_base' => $this->cache_dir,
+                            'auto_source' => $tpl_file,
+                            'auto_id' => $_auto_id,
+                            'exp_time' => $exp_time);
+            require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
+            return smarty_core_rm_auto($_params, $this);
+        }
+
+    }
+
+
+    /**
+     * clear the entire contents of cache (all templates)
+     *
+     * @param string $exp_time expire time
+     * @return boolean results of {@link smarty_core_rm_auto()}
+     */
+    function clear_all_cache($exp_time = null)
+    {
+        return $this->clear_cache(null, null, null, $exp_time);
+    }
+
+
+    /**
+     * test to see if valid cache exists for this template
+     *
+     * @param string $tpl_file name of template file
+     * @param string $cache_id
+     * @param string $compile_id
+     * @return string|false results of {@link _read_cache_file()}
+     */
+    function is_cached($tpl_file, $cache_id = null, $compile_id = null)
+    {
+        if (!$this->caching)
+            return false;
+
+        if (!isset($compile_id))
+            $compile_id = $this->compile_id;
+
+        $_params = array(
+            'tpl_file' => $tpl_file,
+            'cache_id' => $cache_id,
+            'compile_id' => $compile_id
+        );
+        require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
+        return smarty_core_read_cache_file($_params, $this);
+    }
+
+
+    /**
+     * clear all the assigned template variables.
+     *
+     */
+    function clear_all_assign()
+    {
+        $this->_tpl_vars = array();
+    }
+
+    /**
+     * clears compiled version of specified template resource,
+     * or all compiled template files if one is not specified.
+     * This function is for advanced use only, not normally needed.
+     *
+     * @param string $tpl_file
+     * @param string $compile_id
+     * @param string $exp_time
+     * @return boolean results of {@link smarty_core_rm_auto()}
+     */
+    function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
+    {
+        if (!isset($compile_id)) {
+            $compile_id = $this->compile_id;
+        }
+        $_params = array('auto_base' => $this->compile_dir,
+                        'auto_source' => $tpl_file,
+                        'auto_id' => $compile_id,
+                        'exp_time' => $exp_time,
+                        'extensions' => array('.inc', '.php'));
+        require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
+        return smarty_core_rm_auto($_params, $this);
+    }
+
+    /**
+     * Checks whether requested template exists.
+     *
+     * @param string $tpl_file
+     * @return boolean
+     */
+    function template_exists($tpl_file)
+    {
+        $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false);
+        return $this->_fetch_resource_info($_params);
+    }
+
+    /**
+     * Returns an array containing template variables
+     *
+     * @param string $name
+     * @param string $type
+     * @return array
+     */
+    function &get_template_vars($name=null)
+    {
+        if(!isset($name)) {
+            return $this->_tpl_vars;
+        } elseif(isset($this->_tpl_vars[$name])) {
+            return $this->_tpl_vars[$name];
+        } else {
+            // var non-existant, return valid reference
+            $_tmp = null;
+            return $_tmp;   
+        }
+    }
+
+    /**
+     * Returns an array containing config variables
+     *
+     * @param string $name
+     * @param string $type
+     * @return array
+     */
+    function &get_config_vars($name=null)
+    {
+        if(!isset($name) && is_array($this->_config[0])) {
+            return $this->_config[0]['vars'];
+        } else if(isset($this->_config[0]['vars'][$name])) {
+            return $this->_config[0]['vars'][$name];
+        } else {
+            // var non-existant, return valid reference
+            $_tmp = null;
+            return $_tmp;
+        }
+    }
+
+    /**
+     * trigger Smarty error
+     *
+     * @param string $error_msg
+     * @param integer $error_type
+     */
+    function trigger_error($error_msg, $error_type = E_USER_WARNING)
+    {
+        trigger_error("Smarty error: $error_msg", $error_type);
+    }
+
+
+    /**
+     * executes & displays the template results
+     *
+     * @param string $resource_name
+     * @param string $cache_id
+     * @param string $compile_id
+     */
+    function display($resource_name, $cache_id = null, $compile_id = null)
+    {
+        $this->fetch($resource_name, $cache_id, $compile_id, true);
+    }
+
+    /**
+     * executes & returns or displays the template results
+     *
+     * @param string $resource_name
+     * @param string $cache_id
+     * @param string $compile_id
+     * @param boolean $display
+     */
+    function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
+    {
+        static $_cache_info = array();
+        
+        $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
+               ? $this->error_reporting : error_reporting() & ~E_NOTICE);
+
+        if (!$this->debugging && $this->debugging_ctrl == 'URL') {
+            $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+            if (@strstr($_query_string, $this->_smarty_debug_id)) {
+                if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
+                    // enable debugging for this browser session
+                    @setcookie('SMARTY_DEBUG', true);
+                    $this->debugging = true;
+                } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
+                    // disable debugging for this browser session
+                    @setcookie('SMARTY_DEBUG', false);
+                    $this->debugging = false;
+                } else {
+                    // enable debugging for this page
+                    $this->debugging = true;
+                }
+            } else {
+                $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
+            }
+        }
+
+        if ($this->debugging) {
+            // capture time for debugging info
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $_debug_start_time = smarty_core_get_microtime($_params, $this);
+            $this->_smarty_debug_info[] = array('type'      => 'template',
+                                                'filename'  => $resource_name,
+                                                'depth'     => 0);
+            $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
+        }
+
+        if (!isset($compile_id)) {
+            $compile_id = $this->compile_id;
+        }
+
+        $this->_compile_id = $compile_id;
+        $this->_inclusion_depth = 0;
+
+        if ($this->caching) {
+            // save old cache_info, initialize cache_info
+            array_push($_cache_info, $this->_cache_info);
+            $this->_cache_info = array();
+            $_params = array(
+                'tpl_file' => $resource_name,
+                'cache_id' => $cache_id,
+                'compile_id' => $compile_id,
+                'results' => null
+            );
+            require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
+            if (smarty_core_read_cache_file($_params, $this)) {
+                $_smarty_results = $_params['results'];
+                if (!empty($this->_cache_info['insert_tags'])) {
+                    $_params = array('plugins' => $this->_cache_info['insert_tags']);
+                    require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                    smarty_core_load_plugins($_params, $this);
+                    $_params = array('results' => $_smarty_results);
+                    require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
+                    $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
+                }
+                if (!empty($this->_cache_info['cache_serials'])) {
+                    $_params = array('results' => $_smarty_results);
+                    require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php');
+                    $_smarty_results = smarty_core_process_compiled_include($_params, $this);
+                }
+
+
+                if ($display) {
+                    if ($this->debugging)
+                    {
+                        // capture time for debugging info
+                        $_params = array();
+                        require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+                        $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
+                        require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
+                        $_smarty_results .= smarty_core_display_debug_console($_params, $this);
+                    }
+                    if ($this->cache_modified_check) {
+                        $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+                        $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
+                        $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT';
+                        if (@count($this->_cache_info['insert_tags']) == 0
+                            && !$this->_cache_serials
+                            && $_gmt_mtime == $_last_modified_date) {
+                            if (php_sapi_name()=='cgi')
+                                header('Status: 304 Not Modified');
+                            else
+                                header('HTTP/1.1 304 Not Modified');
+
+                        } else {
+                            header('Last-Modified: '.$_gmt_mtime);
+                            echo $_smarty_results;
+                        }
+                    } else {
+                            echo $_smarty_results;
+                    }
+                    error_reporting($_smarty_old_error_level);
+                    // restore initial cache_info
+                    $this->_cache_info = array_pop($_cache_info);
+                    return true;
+                } else {
+                    error_reporting($_smarty_old_error_level);
+                    // restore initial cache_info
+                    $this->_cache_info = array_pop($_cache_info);
+                    return $_smarty_results;
+                }
+            } else {
+                $this->_cache_info['template'][$resource_name] = true;
+                if ($this->cache_modified_check && $display) {
+                    header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
+                }
+            }
+        }
+
+        // load filters that are marked as autoload
+        if (count($this->autoload_filters)) {
+            foreach ($this->autoload_filters as $_filter_type => $_filters) {
+                foreach ($_filters as $_filter) {
+                    $this->load_filter($_filter_type, $_filter);
+                }
+            }
+        }
+
+        $_smarty_compile_path = $this->_get_compile_path($resource_name);
+
+        // if we just need to display the results, don't perform output
+        // buffering - for speed
+        $_cache_including = $this->_cache_including;
+        $this->_cache_including = false;
+        if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
+            if ($this->_is_compiled($resource_name, $_smarty_compile_path)
+                    || $this->_compile_resource($resource_name, $_smarty_compile_path))
+            {
+                include($_smarty_compile_path);
+            }
+        } else {
+            ob_start();
+            if ($this->_is_compiled($resource_name, $_smarty_compile_path)
+                    || $this->_compile_resource($resource_name, $_smarty_compile_path))
+            {
+                include($_smarty_compile_path);
+            }
+            $_smarty_results = ob_get_contents();
+            ob_end_clean();
+
+            foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) {
+                $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this));
+            }
+        }
+
+        if ($this->caching) {
+            $_params = array('tpl_file' => $resource_name,
+                        'cache_id' => $cache_id,
+                        'compile_id' => $compile_id,
+                        'results' => $_smarty_results);
+            require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php');
+            smarty_core_write_cache_file($_params, $this);
+            require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
+            $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
+
+            if ($this->_cache_serials) {
+                // strip nocache-tags from output
+                $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s'
+                                                ,''
+                                                ,$_smarty_results);
+            }
+            // restore initial cache_info
+            $this->_cache_info = array_pop($_cache_info);
+        }
+        $this->_cache_including = $_cache_including;
+
+        if ($display) {
+            if (isset($_smarty_results)) { echo $_smarty_results; }
+            if ($this->debugging) {
+                // capture time for debugging info
+                $_params = array();
+                require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+                $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
+                require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
+                echo smarty_core_display_debug_console($_params, $this);
+            }
+            error_reporting($_smarty_old_error_level);
+            return;
+        } else {
+            error_reporting($_smarty_old_error_level);
+            if (isset($_smarty_results)) { return $_smarty_results; }
+        }
+    }
+
+    /**
+     * load configuration values
+     *
+     * @param string $file
+     * @param string $section
+     * @param string $scope
+     */
+    function config_load($file, $section = null, $scope = 'global')
+    {
+        require_once($this->_get_plugin_filepath('function', 'config_load'));
+        smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this);
+    }
+
+    /**
+     * return a reference to a registered object
+     *
+     * @param string $name
+     * @return object
+     */
+    function &get_registered_object($name) {
+        if (!isset($this->_reg_objects[$name]))
+        $this->_trigger_fatal_error("'$name' is not a registered object");
+
+        if (!is_object($this->_reg_objects[$name][0]))
+        $this->_trigger_fatal_error("registered '$name' is not an object");
+
+        return $this->_reg_objects[$name][0];
+    }
+
+    /**
+     * clear configuration values
+     *
+     * @param string $var
+     */
+    function clear_config($var = null)
+    {
+        if(!isset($var)) {
+            // clear all values
+            $this->_config = array(array('vars'  => array(),
+                                         'files' => array()));
+        } else {
+            unset($this->_config[0]['vars'][$var]);
+        }
+    }
+
+    /**
+     * get filepath of requested plugin
+     *
+     * @param string $type
+     * @param string $name
+     * @return string|false
+     */
+    function _get_plugin_filepath($type, $name)
+    {
+        $_params = array('type' => $type, 'name' => $name);
+        require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php');
+        return smarty_core_assemble_plugin_filepath($_params, $this);
+    }
+
+   /**
+     * test if resource needs compiling
+     *
+     * @param string $resource_name
+     * @param string $compile_path
+     * @return boolean
+     */
+    function _is_compiled($resource_name, $compile_path)
+    {
+        if (!$this->force_compile && file_exists($compile_path)) {
+            if (!$this->compile_check) {
+                // no need to check compiled file
+                return true;
+            } else {
+                // get file source and timestamp
+                $_params = array('resource_name' => $resource_name, 'get_source'=>false);
+                if (!$this->_fetch_resource_info($_params)) {
+                    return false;
+                }
+                if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
+                    // template not expired, no recompile
+                    return true;
+                } else {
+                    // compile template
+                    return false;
+                }
+            }
+        } else {
+            // compiled template does not exist, or forced compile
+            return false;
+        }
+    }
+
+   /**
+     * compile the template
+     *
+     * @param string $resource_name
+     * @param string $compile_path
+     * @return boolean
+     */
+    function _compile_resource($resource_name, $compile_path)
+    {
+
+        $_params = array('resource_name' => $resource_name);
+        if (!$this->_fetch_resource_info($_params)) {
+            return false;
+        }
+
+        $_source_content = $_params['source_content'];
+        $_cache_include    = substr($compile_path, 0, -4).'.inc';
+
+        if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
+            // if a _cache_serial was set, we also have to write an include-file:
+            if ($this->_cache_include_info) {
+                require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php');
+                smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)),  $this);
+            }
+
+            $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content);
+            require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
+            smarty_core_write_compiled_resource($_params, $this);
+
+            return true;
+        } else {
+            return false;
+        }
+
+    }
+
+   /**
+     * compile the given source
+     *
+     * @param string $resource_name
+     * @param string $source_content
+     * @param string $compiled_content
+     * @return boolean
+     */
+    function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
+    {
+        if (file_exists(SMARTY_DIR . $this->compiler_file)) {
+            require_once(SMARTY_DIR . $this->compiler_file);
+        } else {
+            // use include_path
+            require_once($this->compiler_file);
+        }
+
+
+        $smarty_compiler = new $this->compiler_class;
+
+        $smarty_compiler->template_dir      = $this->template_dir;
+        $smarty_compiler->compile_dir       = $this->compile_dir;
+        $smarty_compiler->plugins_dir       = $this->plugins_dir;
+        $smarty_compiler->config_dir        = $this->config_dir;
+        $smarty_compiler->force_compile     = $this->force_compile;
+        $smarty_compiler->caching           = $this->caching;
+        $smarty_compiler->php_handling      = $this->php_handling;
+        $smarty_compiler->left_delimiter    = $this->left_delimiter;
+        $smarty_compiler->right_delimiter   = $this->right_delimiter;
+        $smarty_compiler->_version          = $this->_version;
+        $smarty_compiler->security          = $this->security;
+        $smarty_compiler->secure_dir        = $this->secure_dir;
+        $smarty_compiler->security_settings = $this->security_settings;
+        $smarty_compiler->trusted_dir       = $this->trusted_dir;
+        $smarty_compiler->use_sub_dirs      = $this->use_sub_dirs;
+        $smarty_compiler->_reg_objects      = &$this->_reg_objects;
+        $smarty_compiler->_plugins          = &$this->_plugins;
+        $smarty_compiler->_tpl_vars         = &$this->_tpl_vars;
+        $smarty_compiler->default_modifiers = $this->default_modifiers;
+        $smarty_compiler->compile_id        = $this->_compile_id;
+        $smarty_compiler->_config            = $this->_config;
+        $smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals;
+
+        if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
+            $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
+        }
+        $smarty_compiler->_cache_include = $cache_include_path;
+
+
+        $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content);
+
+        if ($smarty_compiler->_cache_serial) {
+            $this->_cache_include_info = array(
+                'cache_serial'=>$smarty_compiler->_cache_serial
+                ,'plugins_code'=>$smarty_compiler->_plugins_code
+                ,'include_file_path' => $cache_include_path);
+
+        } else {
+            $this->_cache_include_info = null;
+
+        }
+
+        return $_results;
+    }
+
+    /**
+     * Get the compile path for this resource
+     *
+     * @param string $resource_name
+     * @return string results of {@link _get_auto_filename()}
+     */
+    function _get_compile_path($resource_name)
+    {
+        return $this->_get_auto_filename($this->compile_dir, $resource_name,
+                                         $this->_compile_id) . '.php';
+    }
+
+    /**
+     * fetch the template info. Gets timestamp, and source
+     * if get_source is true
+     *
+     * sets $source_content to the source of the template, and
+     * $resource_timestamp to its time stamp
+     * @param string $resource_name
+     * @param string $source_content
+     * @param integer $resource_timestamp
+     * @param boolean $get_source
+     * @param boolean $quiet
+     * @return boolean
+     */
+
+    function _fetch_resource_info(&$params)
+    {
+        if(!isset($params['get_source'])) { $params['get_source'] = true; }
+        if(!isset($params['quiet'])) { $params['quiet'] = false; }
+
+        $_return = false;
+        $_params = array('resource_name' => $params['resource_name']) ;
+        if (isset($params['resource_base_path']))
+            $_params['resource_base_path'] = $params['resource_base_path'];
+        else
+            $_params['resource_base_path'] = $this->template_dir;
+
+        if ($this->_parse_resource_name($_params)) {
+            $_resource_type = $_params['resource_type'];
+            $_resource_name = $_params['resource_name'];
+            switch ($_resource_type) {
+                case 'file':
+                    if ($params['get_source']) {
+                        $params['source_content'] = $this->_read_file($_resource_name);
+                    }
+                    $params['resource_timestamp'] = filemtime($_resource_name);
+                    $_return = is_file($_resource_name);
+                    break;
+
+                default:
+                    // call resource functions to fetch the template source and timestamp
+                    if ($params['get_source']) {
+                        $_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
+                            call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
+                                                 array($_resource_name, &$params['source_content'], &$this));
+                    } else {
+                        $_source_return = true;
+                    }
+
+                    $_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
+                        call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
+                                             array($_resource_name, &$params['resource_timestamp'], &$this));
+
+                    $_return = $_source_return && $_timestamp_return;
+                    break;
+            }
+        }
+
+        if (!$_return) {
+            // see if we can get a template with the default template handler
+            if (!empty($this->default_template_handler_func)) {
+                if (!is_callable($this->default_template_handler_func)) {
+                    $this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist.");
+                } else {
+                    $_return = call_user_func_array(
+                        $this->default_template_handler_func,
+                        array($_params['resource_type'], $_params['resource_name'], &$params['source_content'], &$params['resource_timestamp'], &$this));
+                }
+            }
+        }
+
+        if (!$_return) {
+            if (!$params['quiet']) {
+                $this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"');
+            }
+        } else if ($_return && $this->security) {
+            require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
+            if (!smarty_core_is_secure($_params, $this)) {
+                if (!$params['quiet'])
+                    $this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed');
+                $params['source_content'] = null;
+                $params['resource_timestamp'] = null;
+                return false;
+            }
+        }
+        return $_return;
+    }
+
+
+    /**
+     * parse out the type and name from the resource
+     *
+     * @param string $resource_base_path
+     * @param string $resource_name
+     * @param string $resource_type
+     * @param string $resource_name
+     * @return boolean
+     */
+
+    function _parse_resource_name(&$params)
+    {
+
+        // split tpl_path by the first colon
+        $_resource_name_parts = explode(':', $params['resource_name'], 2);
+
+        if (count($_resource_name_parts) == 1) {
+            // no resource type given
+            $params['resource_type'] = $this->default_resource_type;
+            $params['resource_name'] = $_resource_name_parts[0];
+        } else {
+            if(strlen($_resource_name_parts[0]) == 1) {
+                // 1 char is not resource type, but part of filepath
+                $params['resource_type'] = $this->default_resource_type;
+                $params['resource_name'] = $params['resource_name'];
+            } else {
+                $params['resource_type'] = $_resource_name_parts[0];
+                $params['resource_name'] = $_resource_name_parts[1];
+            }
+        }
+
+        if ($params['resource_type'] == 'file') {
+            if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) {
+                // relative pathname to $params['resource_base_path']
+                // use the first directory where the file is found
+                foreach ((array)$params['resource_base_path'] as $_curr_path) {
+                    $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
+                    if (file_exists($_fullpath) && is_file($_fullpath)) {
+                        $params['resource_name'] = $_fullpath;
+                        return true;
+                    }
+                    // didn't find the file, try include_path
+                    $_params = array('file_path' => $_fullpath);
+                    require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
+                    if(smarty_core_get_include_path($_params, $this)) {
+                        $params['resource_name'] = $_params['new_file_path'];
+                        return true;
+                    }
+                }
+                return false;
+            } else {
+                /* absolute path */
+                return file_exists($params['resource_name']);
+            }
+        } elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
+            $_params = array('type' => $params['resource_type']);
+            require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php');
+            smarty_core_load_resource_plugin($_params, $this);
+        }
+
+        return true;
+    }
+
+
+    /**
+     * Handle modifiers
+     *
+     * @param string|null $modifier_name
+     * @param array|null $map_array
+     * @return string result of modifiers
+     */
+    function _run_mod_handler()
+    {
+        $_args = func_get_args();
+        list($_modifier_name, $_map_array) = array_splice($_args, 0, 2);
+        list($_func_name, $_tpl_file, $_tpl_line) =
+            $this->_plugins['modifier'][$_modifier_name];
+
+        $_var = $_args[0];
+        foreach ($_var as $_key => $_val) {
+            $_args[0] = $_val;
+            $_var[$_key] = call_user_func_array($_func_name, $_args);
+        }
+        return $_var;
+    }
+
+    /**
+     * Remove starting and ending quotes from the string
+     *
+     * @param string $string
+     * @return string
+     */
+    function _dequote($string)
+    {
+        if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') &&
+            substr($string, -1) == substr($string, 0, 1))
+            return substr($string, 1, -1);
+        else
+            return $string;
+    }
+
+
+    /**
+     * read in a file
+     *
+     * @param string $filename
+     * @return string
+     */
+    function _read_file($filename)
+    {
+        if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
+            $contents = '';
+            while (!feof($fd)) {
+                $contents .= fread($fd, 8192);
+            }
+            fclose($fd);
+            return $contents;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * get a concrete filename for automagically created content
+     *
+     * @param string $auto_base
+     * @param string $auto_source
+     * @param string $auto_id
+     * @return string
+     * @staticvar string|null
+     * @staticvar string|null
+     */
+    function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null)
+    {
+        $_compile_dir_sep =  $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
+        $_return = $auto_base . DIRECTORY_SEPARATOR;
+
+        if(isset($auto_id)) {
+            // make auto_id safe for directory names
+            $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id)));
+            // split into separate directories
+            $_return .= $auto_id . $_compile_dir_sep;
+        }
+
+        if(isset($auto_source)) {
+            // make source name safe for filename
+            $_filename = urlencode(basename($auto_source));
+            $_crc32 = sprintf('%08X', crc32($auto_source));
+            // prepend %% to avoid name conflicts with
+            // with $params['auto_id'] names
+            $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep .
+                      substr($_crc32, 0, 3) . $_compile_dir_sep . $_crc32;
+            $_return .= '%%' . $_crc32 . '%%' . $_filename;
+        }
+
+        return $_return;
+    }
+
+    /**
+     * unlink a file, possibly using expiration time
+     *
+     * @param string $resource
+     * @param integer $exp_time
+     */
+    function _unlink($resource, $exp_time = null)
+    {
+        if(isset($exp_time)) {
+            if(time() - @filemtime($resource) >= $exp_time) {
+                return @unlink($resource);
+            }
+        } else {
+            return @unlink($resource);
+        }
+    }
+
+    /**
+     * returns an auto_id for auto-file-functions
+     *
+     * @param string $cache_id
+     * @param string $compile_id
+     * @return string|null
+     */
+    function _get_auto_id($cache_id=null, $compile_id=null) {
+    if (isset($cache_id))
+        return (isset($compile_id)) ? $cache_id . '|' . $compile_id  : $cache_id;
+    elseif(isset($compile_id))
+        return $compile_id;
+    else
+        return null;
+    }
+
+    /**
+     * trigger Smarty plugin error
+     *
+     * @param string $error_msg
+     * @param string $tpl_file
+     * @param integer $tpl_line
+     * @param string $file
+     * @param integer $line
+     * @param integer $error_type
+     */
+    function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null,
+            $file = null, $line = null, $error_type = E_USER_ERROR)
+    {
+        if(isset($file) && isset($line)) {
+            $info = ' ('.basename($file).", line $line)";
+        } else {
+            $info = '';
+        }
+        if (isset($tpl_line) && isset($tpl_file)) {
+            $this->trigger_error('[in ' . $tpl_file . ' line ' . $tpl_line . "]: $error_msg$info", $error_type);
+        } else {
+            $this->trigger_error($error_msg . $info, $error_type);
+        }
+    }
+
+
+    /**
+     * callback function for preg_replace, to call a non-cacheable block
+     * @return string
+     */
+    function _process_compiled_include_callback($match) {
+        $_func = '_smarty_tplfunc_'.$match[2].'_'.$match[3];
+        ob_start();
+        $_func($this);
+        $_ret = ob_get_contents();
+        ob_end_clean();
+        return $_ret;
+    }
+
+
+    /**
+     * called for included templates
+     *
+     * @param string $_smarty_include_tpl_file
+     * @param string $_smarty_include_vars
+     */
+
+    // $_smarty_include_tpl_file, $_smarty_include_vars
+
+    function _smarty_include($params)
+    {
+        if ($this->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $debug_start_time = smarty_core_get_microtime($_params, $this);
+            $this->_smarty_debug_info[] = array('type'      => 'template',
+                                                  'filename'  => $params['smarty_include_tpl_file'],
+                                                  'depth'     => ++$this->_inclusion_depth);
+            $included_tpls_idx = count($this->_smarty_debug_info) - 1;
+        }
+
+        $this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
+
+        // config vars are treated as local, so push a copy of the
+        // current ones onto the front of the stack
+        array_unshift($this->_config, $this->_config[0]);
+
+        $_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
+
+
+        if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
+            || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
+        {
+            include($_smarty_compile_path);
+        }
+
+        // pop the local vars off the front of the stack
+        array_shift($this->_config);
+
+        $this->_inclusion_depth--;
+
+        if ($this->debugging) {
+            // capture time for debugging info
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
+        }
+
+        if ($this->caching) {
+            $this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
+        }
+    }
+
+
+    /**
+     * get or set an array of cached attributes for function that is
+     * not cacheable
+     * @return array
+     */
+    function &_smarty_cache_attrs($cache_serial, $count) {
+        $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];
+
+        if ($this->_cache_including) {
+            /* return next set of cache_attrs */
+            $_return = current($_cache_attrs);
+            next($_cache_attrs);
+            return $_return;
+
+        } else {
+            /* add a reference to a new set of cache_attrs */
+            $_cache_attrs[] = array();
+            return $_cache_attrs[count($_cache_attrs)-1];
+
+        }
+
+    }
+
+
+    /**
+     * wrapper for include() retaining $this
+     * @return mixed
+     */
+    function _include($filename, $once=false, $params=null)
+    {
+        if ($once) {
+            return include_once($filename);
+        } else {
+            return include($filename);
+        }
+    }
+
+
+    /**
+     * wrapper for eval() retaining $this
+     * @return mixed
+     */
+    function _eval($code, $params=null)
+    {
+        return eval($code);
+    }
+    /**#@-*/
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/trunk/data/module/Smarty/libs/Config_File.class.php
===================================================================
--- /temp/trunk/data/module/Smarty/libs/Config_File.class.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/libs/Config_File.class.php	(revision 1328)
@@ -0,0 +1,389 @@
+<?php
+
+/**
+ * Config_File class.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @link http://smarty.php.net/
+ * @version 2.6.13
+ * @copyright Copyright: 2001-2005 New Digital Group, Inc.
+ * @author Andrei Zmievski <andrei@php.net>
+ * @access public
+ * @package Smarty
+ */
+
+/* $Id$ */
+
+/**
+ * Config file reading class
+ * @package Smarty
+ */
+class Config_File {
+    /**#@+
+     * Options
+     * @var boolean
+     */
+    /**
+     * Controls whether variables with the same name overwrite each other.
+     */
+    var $overwrite        =    true;
+
+    /**
+     * Controls whether config values of on/true/yes and off/false/no get
+     * converted to boolean values automatically.
+     */
+    var $booleanize        =    true;
+
+    /**
+     * Controls whether hidden config sections/vars are read from the file.
+     */
+    var $read_hidden     =    true;
+
+    /**
+     * Controls whether or not to fix mac or dos formatted newlines.
+     * If set to true, \r or \r\n will be changed to \n.
+     */
+    var $fix_newlines =    true;
+    /**#@-*/
+
+    /** @access private */
+    var $_config_path    = "";
+    var $_config_data    = array();
+    /**#@-*/
+
+    /**
+     * Constructs a new config file class.
+     *
+     * @param string $config_path (optional) path to the config files
+     */
+    function Config_File($config_path = NULL)
+    {
+        if (isset($config_path))
+            $this->set_path($config_path);
+    }
+
+
+    /**
+     * Set the path where configuration files can be found.
+     *
+     * @param string $config_path path to the config files
+     */
+    function set_path($config_path)
+    {
+        if (!empty($config_path)) {
+            if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
+                $this->_trigger_error_msg("Bad config file path '$config_path'");
+                return;
+            }
+            if(substr($config_path, -1) != DIRECTORY_SEPARATOR) {
+                $config_path .= DIRECTORY_SEPARATOR;
+            }
+
+            $this->_config_path = $config_path;
+        }
+    }
+
+
+    /**
+     * Retrieves config info based on the file, section, and variable name.
+     *
+     * @param string $file_name config file to get info for
+     * @param string $section_name (optional) section to get info for
+     * @param string $var_name (optional) variable to get info for
+     * @return string|array a value or array of values
+     */
+    function get($file_name, $section_name = NULL, $var_name = NULL)
+    {
+        if (empty($file_name)) {
+            $this->_trigger_error_msg('Empty config file name');
+            return;
+        } else {
+            $file_name = $this->_config_path . $file_name;
+            if (!isset($this->_config_data[$file_name]))
+                $this->load_file($file_name, false);
+        }
+
+        if (!empty($var_name)) {
+            if (empty($section_name)) {
+                return $this->_config_data[$file_name]["vars"][$var_name];
+            } else {
+                if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
+                    return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
+                else
+                    return array();
+            }
+        } else {
+            if (empty($section_name)) {
+                return (array)$this->_config_data[$file_name]["vars"];
+            } else {
+                if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
+                    return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
+                else
+                    return array();
+            }
+        }
+    }
+
+
+    /**
+     * Retrieves config info based on the key.
+     *
+     * @param $file_name string config key (filename/section/var)
+     * @return string|array same as get()
+     * @uses get() retrieves information from config file and returns it
+     */
+    function &get_key($config_key)
+    {
+        list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
+        $result = &$this->get($file_name, $section_name, $var_name);
+        return $result;
+    }
+
+    /**
+     * Get all loaded config file names.
+     *
+     * @return array an array of loaded config file names
+     */
+    function get_file_names()
+    {
+        return array_keys($this->_config_data);
+    }
+
+
+    /**
+     * Get all section names from a loaded file.
+     *
+     * @param string $file_name config file to get section names from
+     * @return array an array of section names from the specified file
+     */
+    function get_section_names($file_name)
+    {
+        $file_name = $this->_config_path . $file_name;
+        if (!isset($this->_config_data[$file_name])) {
+            $this->_trigger_error_msg("Unknown config file '$file_name'");
+            return;
+        }
+
+        return array_keys($this->_config_data[$file_name]["sections"]);
+    }
+
+
+    /**
+     * Get all global or section variable names.
+     *
+     * @param string $file_name config file to get info for
+     * @param string $section_name (optional) section to get info for
+     * @return array an array of variables names from the specified file/section
+     */
+    function get_var_names($file_name, $section = NULL)
+    {
+        if (empty($file_name)) {
+            $this->_trigger_error_msg('Empty config file name');
+            return;
+        } else if (!isset($this->_config_data[$file_name])) {
+            $this->_trigger_error_msg("Unknown config file '$file_name'");
+            return;
+        }
+
+        if (empty($section))
+            return array_keys($this->_config_data[$file_name]["vars"]);
+        else
+            return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]);
+    }
+
+
+    /**
+     * Clear loaded config data for a certain file or all files.
+     *
+     * @param string $file_name file to clear config data for
+     */
+    function clear($file_name = NULL)
+    {
+        if ($file_name === NULL)
+            $this->_config_data = array();
+        else if (isset($this->_config_data[$file_name]))
+            $this->_config_data[$file_name] = array();
+    }
+
+
+    /**
+     * Load a configuration file manually.
+     *
+     * @param string $file_name file name to load
+     * @param boolean $prepend_path whether current config path should be
+     *                              prepended to the filename
+     */
+    function load_file($file_name, $prepend_path = true)
+    {
+        if ($prepend_path && $this->_config_path != "")
+            $config_file = $this->_config_path . $file_name;
+        else
+            $config_file = $file_name;
+
+        ini_set('track_errors', true);
+        $fp = @fopen($config_file, "r");
+        if (!is_resource($fp)) {
+            $this->_trigger_error_msg("Could not open config file '$config_file'");
+            return false;
+        }
+
+        $contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
+        fclose($fp);
+
+        $this->_config_data[$config_file] = $this->parse_contents($contents);
+        return true;
+    }
+
+    /**
+     * Store the contents of a file manually.
+     *
+     * @param string $config_file file name of the related contents
+     * @param string $contents the file-contents to parse
+     */
+    function set_file_contents($config_file, $contents)
+    {
+        $this->_config_data[$config_file] = $this->parse_contents($contents);
+        return true;
+    }
+
+    /**
+     * parse the source of a configuration file manually.
+     *
+     * @param string $contents the file-contents to parse
+     */
+    function parse_contents($contents)
+    {
+        if($this->fix_newlines) {
+            // fix mac/dos formatted newlines
+            $contents = preg_replace('!\r\n?!', "\n", $contents);
+        }
+
+        $config_data = array();
+        $config_data['sections'] = array();
+        $config_data['vars'] = array();
+
+        /* reference to fill with data */
+        $vars =& $config_data['vars'];
+
+        /* parse file line by line */
+        preg_match_all('!^.*\r?\n?!m', $contents, $match);
+        $lines = $match[0];
+        for ($i=0, $count=count($lines); $i<$count; $i++) {
+            $line = $lines[$i];
+            if (empty($line)) continue;
+
+            if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
+                /* section found */
+                if (substr($match[1], 0, 1) == '.') {
+                    /* hidden section */
+                    if ($this->read_hidden) {
+                        $section_name = substr($match[1], 1);
+                    } else {
+                        /* break reference to $vars to ignore hidden section */
+                        unset($vars);
+                        $vars = array();
+                        continue;
+                    }
+                } else {                    
+                    $section_name = $match[1];
+                }
+                if (!isset($config_data['sections'][$section_name]))
+                    $config_data['sections'][$section_name] = array('vars' => array());
+                $vars =& $config_data['sections'][$section_name]['vars'];
+                continue;
+            }
+
+            if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) {
+                /* variable found */
+                $var_name = rtrim($match[1]);
+                if (strpos($match[2], '"""') === 0) {
+                    /* handle multiline-value */
+                    $lines[$i] = substr($match[2], 3);
+                    $var_value = '';
+                    while ($i<$count) {
+                        if (($pos = strpos($lines[$i], '"""')) === false) {
+                            $var_value .= $lines[$i++];
+                        } else {
+                            /* end of multiline-value */
+                            $var_value .= substr($lines[$i], 0, $pos);
+                            break;
+                        }
+                    }
+                    $booleanize = false;
+
+                } else {
+                    /* handle simple value */
+                    $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2]));
+                    $booleanize = $this->booleanize;
+
+                }
+                $this->_set_config_var($vars, $var_name, $var_value, $booleanize);
+            }
+            /* else unparsable line / means it is a comment / means ignore it */
+        }
+        return $config_data;
+    }
+
+    /**#@+ @access private */
+    /**
+     * @param array &$container
+     * @param string $var_name
+     * @param mixed $var_value
+     * @param boolean $booleanize determines whether $var_value is converted to
+     *                            to true/false
+     */
+    function _set_config_var(&$container, $var_name, $var_value, $booleanize)
+    {
+        if (substr($var_name, 0, 1) == '.') {
+            if (!$this->read_hidden)
+                return;
+            else
+                $var_name = substr($var_name, 1);
+        }
+
+        if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) {
+            $this->_trigger_error_msg("Bad variable name '$var_name'");
+            return;
+        }
+
+        if ($booleanize) {
+            if (preg_match("/^(on|true|yes)$/i", $var_value))
+                $var_value = true;
+            else if (preg_match("/^(off|false|no)$/i", $var_value))
+                $var_value = false;
+        }
+
+        if (!isset($container[$var_name]) || $this->overwrite)
+            $container[$var_name] = $var_value;
+        else {
+            settype($container[$var_name], 'array');
+            $container[$var_name][] = $var_value;
+        }
+    }
+
+    /**
+     * @uses trigger_error() creates a PHP warning/error
+     * @param string $error_msg
+     * @param integer $error_type one of
+     */
+    function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING)
+    {
+        trigger_error("Config_File error: $error_msg", $error_type);
+    }
+    /**#@-*/
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/unit_test/config.php
===================================================================
--- /temp/trunk/data/module/Smarty/unit_test/config.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/unit_test/config.php	(revision 1328)
@@ -0,0 +1,5 @@
+<?php
+
+define('SMARTY_DIR', '../libs/');
+
+?>
Index: /temp/trunk/data/module/Smarty/unit_test/smarty_unit_test.php
===================================================================
--- /temp/trunk/data/module/Smarty/unit_test/smarty_unit_test.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/unit_test/smarty_unit_test.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once 'test_cases.php';
+require_once 'PHPUnit.php';
+
+$suite = new PHPUnit_TestSuite("SmartyTest");
+$result = PHPUnit::run($suite);
+
+echo $result -> toString();
+?>
Index: /temp/trunk/data/module/Smarty/unit_test/test_cases.php
===================================================================
--- /temp/trunk/data/module/Smarty/unit_test/test_cases.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/unit_test/test_cases.php	(revision 1328)
@@ -0,0 +1,450 @@
+<?php
+
+require_once './config.php';
+require_once SMARTY_DIR . 'Smarty.class.php';
+require_once 'PHPUnit.php';
+
+class Obj {
+    var $val = 'val';
+    var $arr = array('one' => 'one', 'two' => 2);
+    var $ten = 10;
+
+    function meth($a="a", $b="b") {
+        return "$a:$b";
+    }
+
+    function six() {
+        return 6;
+    }
+}
+
+    
+class SmartyTest extends PHPUnit_TestCase {   
+    // contains the object handle of the string class
+    var $abc;
+    // contains the last triggered error's errorlevel
+    var $errorlevel;
+
+    // constructor of the test suite
+    function SmartyTest($name) {
+       $this->PHPUnit_TestCase($name);
+    }
+
+    // called before the test functions will be executed    
+    // this function is defined in PHPUnit_TestCase and overwritten 
+    // here
+    function setUp() {
+        // create a new instance of String with the
+        // string 'abc'
+        $this->smarty = new Smarty;
+    }
+    // called after the test functions are executed    
+    // this function is defined in PHPUnit_TestCase and overwritten 
+    // here    
+    function tearDown() {
+        // delete your instance
+        unset($this->smarty);
+    }
+    
+    // dummy errorhandler for functions that are supposed to call trigger_error()
+    function error_handler($errorlevel) {
+        if ($errorlevel) $this->errorlevel = $errorlevel;
+    }
+
+    /* DIRECTORY TESTS */
+    
+    // test that template_dir exists
+    function test_template_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->template_dir));                       
+    }
+    // test that template_dir is a directory
+    function test_template_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->template_dir));                       
+    }
+    // test that template_dir is readable
+    function test_template_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->template_dir));                       
+    }
+    // test that config_dir exists
+    function test_config_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->config_dir));                       
+    }
+    // test that config_dir is a directory
+    function test_config_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->config_dir));                       
+    }
+    // test that config_dir is readable
+    function test_config_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->config_dir));                       
+    }
+    // test that compile_dir exists
+    function test_compile_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->compile_dir));                       
+    }
+    // test that compile_dir is a directory
+    function test_compile_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->compile_dir));                       
+    }
+    // test that compile_dir is readable
+    function test_compile_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->compile_dir));                       
+    }
+    // test that compile_dir is writable
+    function test_compile_dir_is_writable() {
+        $this->assertTrue(is_writable($this->smarty->compile_dir));                       
+    }
+    // test that cache_dir exists
+    function test_cache_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->cache_dir));                       
+    }
+    // test that cache_dir is a directory
+    function test_cache_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->cache_dir));                       
+    }
+    // test that cache_dir is readable
+    function test_cache_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->cache_dir));                       
+    }
+    // test that cache_dir is writable
+    function test_cache_dir_is_writable() {
+        $this->assertTrue(is_writable($this->smarty->cache_dir));                       
+    }
+
+    /* METHOD EXISTS TESTS */
+    function test_assign_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'assign'));
+    }
+    function test_assign_by_ref_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'assign_by_ref'));
+    }
+    function test_append_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'append'));
+    }
+    function test_append_by_ref_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'append_by_ref'));
+    }
+    function test_clear_assign_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_assign'));
+    }
+    function test_register_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_function'));
+    }
+    function test_unregister_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_function'));
+    }
+    function test_register_object_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_object'));
+    }
+    function test_unregister_object_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_object'));
+    }
+    function test_register_block_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_block'));
+    }
+    function test_unregister_block_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_block'));
+    }
+    function test_register_compiler_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_compiler_function'));
+    }
+    function test_unregister_compiler_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_compiler_function'));
+    }
+    function test_register_modifier_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_modifier'));
+    }
+    function test_unregister_modifier_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_modifier'));
+    }
+    function test_register_resource_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_resource'));
+    }
+    function test_unregister_resource_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_resource'));
+    }
+    function test_register_prefilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_prefilter'));
+    }
+    function test_unregister_prefilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_prefilter'));
+    }
+    function test_register_postfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_postfilter'));
+    }
+    function test_unregister_postfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_postfilter'));
+    }
+    function test_register_outputfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_outputfilter'));
+    }
+    function test_unregister_outputfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_outputfilter'));
+    }
+    function test_load_filter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'load_filter'));
+    }
+    function test_clear_cache_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_cache'));
+    }
+    function test_clear_all_cache_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_all_cache'));
+    }
+    function test_is_cached_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'is_cached'));
+    }
+    function test_clear_all_assign_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_all_assign'));
+    }
+    function test_clear_compiled_tpl_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_compiled_tpl'));
+    }
+    function test_template_exists_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'template_exists'));
+    }
+    function test_get_template_vars_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'get_template_vars'));
+    }
+    function test_get_config_vars_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'get_config_vars'));
+    }
+    function test_trigger_error_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'trigger_error'));
+    }
+    function test_display_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'display'));
+    }
+    function test_fetch_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'fetch'));
+    }
+    function test_config_load_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'config_load'));
+    }
+    function test_get_registered_object_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'get_registered_object'));
+    }
+    function test_clear_config_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_config'));
+    }
+    function test_get_plugin_filepath() {
+        $this->assertTrue(method_exists($this->smarty, '_get_plugin_filepath'));
+    }
+
+    
+    function test_clear_compiled_tpl() {
+        $this->assertTrue($this->smarty->clear_compiled_tpl());
+    }
+    
+    /* DISPLAY TESTS */
+    
+    // test that display() executes properly
+    function test_call_to_display() {
+        ob_start();
+        $this->smarty->display('index.tpl');
+        $output = ob_get_contents();
+        ob_end_clean();
+        $this->assertEquals($output, 'TEST STRING');
+    }
+
+    /* FETCH TESTS */
+
+    // test that fetch() executes properly
+    function test_call_to_fetch() {
+        $this->assertEquals($this->smarty->fetch('index.tpl'), 'TEST STRING');
+    }
+    
+    /* ASSIGN TESTS */
+
+    // test assigning a simple template variable
+    function test_assign_var() {
+        $this->smarty->assign('foo', 'bar');
+        $this->assertEquals($this->smarty->fetch('assign_var.tpl'), 'bar');
+    }
+
+    /* PARSING TESTS */
+    
+    // test assigning and calling an object
+    function test_parse_obj_meth() {
+        $obj  = new Obj();
+        $this->smarty->assign('obj', $obj);
+        $this->smarty->assign('foo', 'foo');
+        $this->assertEquals('foo:2.5
+2.5:foo
+2.5:b
+val:foo
+foo:val
+foo:foo
+one:2
+foo:foo:b', $this->smarty->fetch('parse_obj_meth.tpl'));
+    }
+    
+    // test assigning and calling an object
+    function test_parse_math() {
+        $obj  = new Obj();
+        $this->smarty->assign('obj', $obj);
+        $this->smarty->assign('flt', 2.5);
+        $this->smarty->assign('items', array(1, 2));
+        $this->assertEquals('3
+3.5
+7
+11
+4
+4.5
+8
+12
+12.5
+25
+16
+20
+8.5
+7', $this->smarty->fetch('parse_math.tpl'));
+    }
+    
+    /* CONFIG FILE TESTS */
+
+    // test assigning a double quoted global variable
+    function test_config_load_globals_double_quotes() {
+        // load the global var
+        $this->smarty->config_load('globals_double_quotes.conf');
+        // test that it is assigned
+        $this->assertEquals($this->smarty->_config[0]['vars']['foo'], 'bar');
+    }
+
+    // test assigning a single quoted global variable
+    function test_config_load_globals_single_quotes() {
+        // load the global var
+        $this->smarty->config_load('globals_single_quotes.conf');
+        // test that it is assigned
+        $this->assertEquals($this->smarty->_config[0]['vars']['foo'], 'bar');
+    }
+
+    // test loading and running modifier.escape.php
+    function test_escape_modifier_get_plugins_filepath() {
+        $filepath = $this->smarty->_get_plugin_filepath('modifier', 'escape');
+        $this->assertTrue($filepath);
+    }
+
+    function test_escape_modifier_include_file() {
+        $filepath = $this->smarty->_get_plugin_filepath('modifier', 'escape');
+        $this->assertTrue(include($filepath));
+    }
+
+    function test_escape_modifier_function_exists() {
+        $this->assertTrue(function_exists('smarty_modifier_escape'));
+    }
+
+    function test_escape_modifier_escape_default() {
+        $string = smarty_modifier_escape("<html><body></body></html>");
+        $this->assertEquals('&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;',
+                            $string);
+    }
+
+    function test_escape_modifier_escape_html() {
+        $string = smarty_modifier_escape("<html><body></body></html>", 'html');
+        $this->assertEquals('&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;',
+                            $string);
+    }
+
+    function test_escape_modifier_escape_htmlall() {
+        $string = smarty_modifier_escape("<html><body></body></html>", 'htmlall');
+        $this->assertEquals('&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;',
+                            $string);
+    }
+
+    function test_escape_modifier_escape_url() {
+        $string = smarty_modifier_escape("http://test.com?foo=bar", 'url');
+        $this->assertEquals('http%3A%2F%2Ftest.com%3Ffoo%3Dbar', $string);
+    }
+
+    function test_escape_modifier_escape_quotes() {
+        $string = smarty_modifier_escape("'\\'\\''", 'quotes');
+        $this->assertEquals("\\'\\'\\'\\'", $string);
+    }
+
+    function test_escape_modifier_escape_hex() {
+        $string = smarty_modifier_escape("abcd", 'hex');
+        $this->assertEquals('%61%62%63%64', $string);
+    }
+
+    function test_escape_modifier_escape_hexentity() {
+        $string = smarty_modifier_escape("ABCD", 'hexentity');
+        $this->assertEquals('&#x41;&#x42;&#x43;&#x44;', $string);
+    }
+
+    function test_escape_modifier_escape_javascript() {
+        $string = smarty_modifier_escape("\r\n\\", 'javascript');
+        $this->assertEquals('\\r\\n\\\\', $string);
+    }
+
+
+    function test_core_is_secure_file_exists() {
+        $file = SMARTY_CORE_DIR . 'core.is_secure.php';
+        $this->assertTrue(file_exists($file));
+    }
+
+    function test_core_is_secure_file_include() {
+        $file = SMARTY_CORE_DIR . 'core.is_secure.php';
+        $this->assertTrue(include($file));
+    }
+
+    function test_core_is_secure_function_exists() {
+        $this->assertTrue(function_exists('smarty_core_is_secure'));
+    }
+
+    function test_core_is_secure_function_is_secure_true() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+
+        /* check if index.tpl is secure (should be true) */
+        $params = array('resource_type' => 'file',
+                        'resource_base_path' => dirname(__FILE__) . '/templates',
+                        'resource_name' => dirname(__FILE__) . '/templates/index.tpl');
+        $this->assertTrue(smarty_core_is_secure($params, $this->smarty));
+        $this->smarty->security = $security;
+    }
+
+    function test_core_is_secure_function_is_secure_false() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+        /* check if test_cases.php is secure (should be false) */
+        $params = array('resource_type' => 'file',
+                        'resource_base_path' => dirname(__FILE__) . '/templates',
+                        'resource_name' => __FILE__);
+        $this->assertFalse(smarty_core_is_secure($params, $this->smarty));
+        $this->smarty->security = $security;
+
+    }
+
+    // test constants and security
+    function test_core_is_secure_function_smarty_var_const() {
+        define('TEST_CONSTANT', 'test constant');
+        $this->assertEquals('test constant', $this->smarty->fetch('constant.tpl',
+                                                             null, 'var_const'));
+    }
+
+    function test_core_is_secure_function_smarty_var_const_allowed() {
+        $security = $this->smarty->security;
+        $security_settings = $this->smarty->security_settings;
+        $this->smarty->security_settings['ALLOW_CONSTANTS'] = true;
+        $this->smarty->security = true;
+        $this->assertEquals('test constant', $this->smarty->fetch('constant.tpl',
+                                                     null, 'var_const_allowed'));
+        $this->smarty->security_settings = $security_settings;
+        $this->smarty->security = $security;   
+    }
+
+    function test_core_is_secure_function_smarty_var_const_not_allowed() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+        /* catch errors: */
+        $this->errorlevel = null;
+        set_error_handler(array(&$this, 'error_handler'));
+        $this->smarty->fetch('constant.tpl', null, 'var_const_not_allowed');
+        restore_error_handler();
+
+        $this->assertEquals( $this->errorlevel, E_USER_WARNING);
+        $this->smarty->security = $security;
+    }
+
+}
+
+?>
Index: /temp/trunk/data/module/Smarty/unit_test/smarty_unit_test_gui.php
===================================================================
--- /temp/trunk/data/module/Smarty/unit_test/smarty_unit_test_gui.php	(revision 1328)
+++ /temp/trunk/data/module/Smarty/unit_test/smarty_unit_test_gui.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once 'test_cases.php';
+require_once 'PHPUnit.php';
+
+$suite = new PHPUnit_TestSuite("SmartyTest");
+$result = PHPUnit::run($suite);
+
+echo $result -> toHTML();
+?>
Index: /temp/trunk/data/module/DB/ifx.php
===================================================================
--- /temp/trunk/data/module/DB/ifx.php	(revision 1328)
+++ /temp/trunk/data/module/DB/ifx.php	(revision 1328)
@@ -0,0 +1,681 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's ifx extension
+ * for interacting with Informix databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's ifx extension
+ * for interacting with Informix databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * More info on Informix errors can be found at:
+ * http://www.informix.com/answers/english/ierrors.htm
+ *
+ * TODO:
+ *   - set needed env Informix vars on connect
+ *   - implement native prepare/execute
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_ifx extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'ifx';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'ifx';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => 'emulate',
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        '-201'    => DB_ERROR_SYNTAX,
+        '-206'    => DB_ERROR_NOSUCHTABLE,
+        '-217'    => DB_ERROR_NOSUCHFIELD,
+        '-236'    => DB_ERROR_VALUE_COUNT_ON_ROW,
+        '-239'    => DB_ERROR_CONSTRAINT,
+        '-253'    => DB_ERROR_SYNTAX,
+        '-292'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-310'    => DB_ERROR_ALREADY_EXISTS,
+        '-316'    => DB_ERROR_ALREADY_EXISTS,
+        '-319'    => DB_ERROR_NOT_FOUND,
+        '-329'    => DB_ERROR_NODBSELECTED,
+        '-346'    => DB_ERROR_CONSTRAINT,
+        '-386'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-391'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-554'    => DB_ERROR_SYNTAX,
+        '-691'    => DB_ERROR_CONSTRAINT,
+        '-692'    => DB_ERROR_CONSTRAINT,
+        '-703'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-1204'   => DB_ERROR_INVALID_DATE,
+        '-1205'   => DB_ERROR_INVALID_DATE,
+        '-1206'   => DB_ERROR_INVALID_DATE,
+        '-1209'   => DB_ERROR_INVALID_DATE,
+        '-1210'   => DB_ERROR_INVALID_DATE,
+        '-1212'   => DB_ERROR_INVALID_DATE,
+        '-1213'   => DB_ERROR_INVALID_NUMBER,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     * @access private
+     */
+    var $affected = 0;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_ifx()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('informix') &&
+            !PEAR::loadExtension('Informix'))
+        {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $dbhost = $dsn['hostspec'] ? '@' . $dsn['hostspec'] : '';
+        $dbname = $dsn['database'] ? $dsn['database'] . $dbhost : '';
+        $user = $dsn['username'] ? $dsn['username'] : '';
+        $pw = $dsn['password'] ? $dsn['password'] : '';
+
+        $connect_function = $persistent ? 'ifx_pconnect' : 'ifx_connect';
+
+        $this->connection = @$connect_function($dbname, $user, $pw);
+        if (!is_resource($this->connection)) {
+            return $this->ifxRaiseError(DB_ERROR_CONNECT_FAILED);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @ifx_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $this->affected   = null;
+        if (preg_match('/(SELECT)/i', $query)) {    //TESTME: Use !DB::isManip()?
+            // the scroll is needed for fetching absolute row numbers
+            // in a select query result
+            $result = @ifx_query($query, $this->connection, IFX_SCROLL);
+        } else {
+            if (!$this->autocommit && $ismanip) {
+                if ($this->transaction_opcount == 0) {
+                    $result = @ifx_query('BEGIN WORK', $this->connection);
+                    if (!$result) {
+                        return $this->ifxRaiseError();
+                    }
+                }
+                $this->transaction_opcount++;
+            }
+            $result = @ifx_query($query, $this->connection);
+        }
+        if (!$result) {
+            return $this->ifxRaiseError();
+        }
+        $this->affected = @ifx_affected_rows($result);
+        // Determine which queries should return data, and which
+        // should return an error code only.
+        if (preg_match('/(SELECT)/i', $query)) {
+            return $result;
+        }
+        // XXX Testme: free results inside a transaction
+        // may cause to stop it and commit the work?
+
+        // Result has to be freed even with a insert or update
+        @ifx_free_result($result);
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal ifx result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            return $this->affected;
+        } else {
+            return 0;
+        }
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if (($rownum !== null) && ($rownum < 0)) {
+            return null;
+        }
+        if ($rownum === null) {
+            /*
+             * Even though fetch_row() should return the next row  if
+             * $rownum is null, it doesn't in all cases.  Bug 598.
+             */
+            $rownum = 'NEXT';
+        } else {
+            // Index starts at row 1, unlike most DBMS's starting at 0.
+            $rownum++;
+        }
+        if (!$arr = @ifx_fetch_row($result, $rownum)) {
+            return null;
+        }
+        if ($fetchmode !== DB_FETCHMODE_ASSOC) {
+            $i=0;
+            $order = array();
+            foreach ($arr as $val) {
+                $order[$i++] = $val;
+            }
+            $arr = $order;
+        } elseif ($fetchmode == DB_FETCHMODE_ASSOC &&
+                  $this->options['portability'] & DB_PORTABILITY_LOWERCASE)
+        {
+            $arr = array_change_key_case($arr, CASE_LOWER);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        if (!$cols = @ifx_num_fields($result)) {
+            return $this->ifxRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @ifx_free_result($result);
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = true)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            $result = @ifx_query('COMMIT WORK', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->ifxRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            $result = @ifx_query('ROLLBACK WORK', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->ifxRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ ifxRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_ifx::errorNative(), DB_ifx::errorCode()
+     */
+    function ifxRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $errno = $this->errorCode(ifx_error());
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 $this->errorNative());
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code and message produced by the last query
+     *
+     * @return string  the DBMS' error code and message
+     */
+    function errorNative()
+    {
+        return @ifx_error() . ' ' . @ifx_errormsg();
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Maps native error codes to DB's portable ones.
+     *
+     * Requires that the DB implementation's constructor fills
+     * in the <var>$errorcode_map</var> property.
+     *
+     * @param  string  $nativecode  error code returned by the database
+     * @return int a portable DB error code, or DB_ERROR if this DB
+     * implementation has no mapping for the given error code.
+     */
+    function errorCode($nativecode)
+    {
+        if (ereg('SQLCODE=(.*)]', $nativecode, $match)) {
+            $code = $match[1];
+            if (isset($this->errorcode_map[$code])) {
+                return $this->errorcode_map[$code];
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' if <var>$result</var> is a table name.
+     *
+     * If analyzing a query result and the result has duplicate field names,
+     * an error will be raised saying
+     * <samp>can't distinguish duplicate field names</samp>.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.6.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @ifx_query("SELECT * FROM $result WHERE 1=0",
+                             $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->ifxRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        $flds = @ifx_fieldproperties($id);
+        $count = @ifx_num_fields($id);
+
+        if (count($flds) != $count) {
+            return $this->raiseError("can't distinguish duplicate field names");
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $i   = 0;
+        $res = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        foreach ($flds as $key => $value) {
+            $props = explode(';', $value);
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func($key),
+                'type'  => $props[0],
+                'len'   => $props[1],
+                'flags' => $props[4] == 'N' ? 'not_null' : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+            $i++;
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @ifx_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT tabname FROM systables WHERE tabid >= 100';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/pgsql.php
===================================================================
--- /temp/trunk/data/module/DB/pgsql.php	(revision 1328)
+++ /temp/trunk/data/module/DB/pgsql.php	(revision 1328)
@@ -0,0 +1,1097 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's pgsql extension
+ * for interacting with PostgreSQL databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Rui Hirokawa <hirokawa@php.net>
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's pgsql extension
+ * for interacting with PostgreSQL databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Rui Hirokawa <hirokawa@php.net>
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_pgsql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'pgsql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'pgsql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => '4.3.0',
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => true,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     */
+    var $affected = 0;
+
+    /**
+     * The current row being looked at in fetchInto()
+     * @var array
+     * @access private
+     */
+    var $row = array();
+
+    /**
+     * The number of rows in a given result set
+     * @var array
+     * @access private
+     */
+    var $_num_rows = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_pgsql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's pgsql driver supports the following extra DSN options:
+     *   + connect_timeout  How many seconds to wait for a connection to
+     *                       be established.  Available since PEAR DB 1.7.0.
+     *   + new_link         If set to true, causes subsequent calls to
+     *                       connect() to return a new connection link
+     *                       instead of the existing one.  WARNING: this is
+     *                       not portable to other DBMS's.  Available only
+     *                       if PHP is >= 4.3.0 and PEAR DB is >= 1.7.0.
+     *   + options          Command line options to be sent to the server.
+     *                       Available since PEAR DB 1.6.4.
+     *   + service          Specifies a service name in pg_service.conf that
+     *                       holds additional connection parameters.
+     *                       Available since PEAR DB 1.7.0.
+     *   + sslmode          How should SSL be used when connecting?  Values:
+     *                       disable, allow, prefer or require.
+     *                       Available since PEAR DB 1.7.0.
+     *   + tty              This was used to specify where to send server
+     *                       debug output.  Available since PEAR DB 1.6.4.
+     *
+     * Example of connecting to a new link via a socket:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * $dsn = 'pgsql://user:pass@unix(/tmp)/dbname?new_link=true';
+     * $options = array(
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     *
+     * @link http://www.postgresql.org/docs/current/static/libpq.html#LIBPQ-CONNECT
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('pgsql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $protocol = $dsn['protocol'] ? $dsn['protocol'] : 'tcp';
+
+        $params = array('');
+        if ($protocol == 'tcp') {
+            if ($dsn['hostspec']) {
+                $params[0] .= 'host=' . $dsn['hostspec'];
+            }
+            if ($dsn['port']) {
+                $params[0] .= ' port=' . $dsn['port'];
+            }
+        } elseif ($protocol == 'unix') {
+            // Allow for pg socket in non-standard locations.
+            if ($dsn['socket']) {
+                $params[0] .= 'host=' . $dsn['socket'];
+            }
+            if ($dsn['port']) {
+                $params[0] .= ' port=' . $dsn['port'];
+            }
+        }
+        if ($dsn['database']) {
+            $params[0] .= ' dbname=\'' . addslashes($dsn['database']) . '\'';
+        }
+        if ($dsn['username']) {
+            $params[0] .= ' user=\'' . addslashes($dsn['username']) . '\'';
+        }
+        if ($dsn['password']) {
+            $params[0] .= ' password=\'' . addslashes($dsn['password']) . '\'';
+        }
+        if (!empty($dsn['options'])) {
+            $params[0] .= ' options=' . $dsn['options'];
+        }
+        if (!empty($dsn['tty'])) {
+            $params[0] .= ' tty=' . $dsn['tty'];
+        }
+        if (!empty($dsn['connect_timeout'])) {
+            $params[0] .= ' connect_timeout=' . $dsn['connect_timeout'];
+        }
+        if (!empty($dsn['sslmode'])) {
+            $params[0] .= ' sslmode=' . $dsn['sslmode'];
+        }
+        if (!empty($dsn['service'])) {
+            $params[0] .= ' service=' . $dsn['service'];
+        }
+
+        if (isset($dsn['new_link'])
+            && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
+        {
+            if (version_compare(phpversion(), '4.3.0', '>=')) {
+                $params[] = PGSQL_CONNECT_FORCE_NEW;
+            }
+        }
+
+        $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $php_errormsg);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @pg_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @pg_exec($this->connection, 'begin;');
+                if (!$result) {
+                    return $this->pgsqlRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @pg_exec($this->connection, $query);
+        if (!$result) {
+            return $this->pgsqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if ($ismanip) {
+            $this->affected = @pg_affected_rows($result);
+            return DB_OK;
+        } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|SHOW)\s/si', $query)) {
+            /* PostgreSQL commands:
+               ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
+               CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
+               GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
+               REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
+               UNLISTEN, UPDATE, VACUUM
+            */
+            $this->row[(int)$result] = 0; // reset the row counter.
+            $numrows = $this->numRows($result);
+            if (is_object($numrows)) {
+                return $numrows;
+            }
+            $this->_num_rows[(int)$result] = $numrows;
+            $this->affected = 0;
+            return $result;
+        } else {
+            $this->affected = 0;
+            return DB_OK;
+        }
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal pgsql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        $result_int = (int)$result;
+        $rownum = ($rownum !== null) ? $rownum : $this->row[$result_int];
+        if ($rownum >= $this->_num_rows[$result_int]) {
+            return null;
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @pg_fetch_array($result, $rownum, PGSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @pg_fetch_row($result, $rownum);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        $this->row[$result_int] = ++$rownum;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        if (is_resource($result)) {
+            unset($this->row[(int)$result]);
+            unset($this->_num_rows[(int)$result]);
+            $this->affected = 0;
+            return @pg_freeresult($result);
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * @deprecated  Deprecated in release 1.6.0
+     * @internal
+     */
+    function quote($str)
+    {
+        return $this->quoteSmart($str);
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     *                 + null = the string <samp>NULL</samp>
+     *                 + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp>
+     *                 + integer or double = the unquoted number
+     *                 + other (including strings and numeric strings) =
+     *                   the data escaped according to MySQL's settings
+     *                   then encapsulated between single quotes
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 'TRUE' : 'FALSE';
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * {@internal PostgreSQL treats a backslash as an escape character,
+     * so they are escaped as well.
+     *
+     * Not using pg_escape_string() yet because it requires PostgreSQL
+     * to be at version 7.2 or greater.}}
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        return str_replace("'", "''", str_replace('\\', '\\\\', $str));
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @pg_numfields($result);
+        if (!$cols) {
+            return $this->pgsqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @pg_numrows($result);
+        if ($rows === null) {
+            return $this->pgsqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            // (disabled) hack to shut up error messages from libpq.a
+            //@fclose(@fopen("php://stderr", "w"));
+            $result = @pg_exec($this->connection, 'end;');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->pgsqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            $result = @pg_exec($this->connection, 'abort;');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->pgsqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        return $this->affected;
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_pgsql::createSequence(), DB_pgsql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = false;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result =& $this->query("SELECT NEXTVAL('${seqname}')");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = true;
+                $this->pushErrorHandling(PEAR_ERROR_RETURN);
+                $result = $this->createSequence($seq_name);
+                $this->popErrorHandling();
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        $result->free();
+        return $arr[0];
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_pgsql::nextID(), DB_pgsql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $result = $this->query("CREATE SEQUENCE ${seqname}");
+        return $result;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_pgsql::nextID(), DB_pgsql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP SEQUENCE '
+                            . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        return "$query LIMIT $count OFFSET $from";
+    }
+
+    // }}}
+    // {{{ pgsqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_pgsql::errorNative(), DB_pgsql::errorCode()
+     */
+    function pgsqlRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+        return $this->raiseError($errno, null, null, null, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * {@internal Error messages are used instead of error codes 
+     * in order to support older versions of PostgreSQL.}}
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return @pg_errormessage($this->connection);
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message.
+     *
+     * @param  string  $errormsg  error message returned from the database
+     * @return integer  an error number from a DB error constant
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/(relation|sequence|table).*does not exist|class .* not found/i'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/index .* does not exist/'
+                    => DB_ERROR_NOT_FOUND,
+                '/column .* does not exist/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/relation .* already exists/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/(divide|division) by zero$/i'
+                    => DB_ERROR_DIVZERO,
+                '/pg_atoi: error in .*: can\'t parse /i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/invalid input syntax for( type)? (integer|numeric)/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/value .* is out of range for type \w*int/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/integer out of range/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/value too long for type character/i'
+                    => DB_ERROR_INVALID,
+                '/attribute .* not found|relation .* does not have attribute/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/column .* specified in USING clause does not exist in (left|right) table/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/parser: parse error at or near/i'
+                    => DB_ERROR_SYNTAX,
+                '/syntax error at/'
+                    => DB_ERROR_SYNTAX,
+                '/column reference .* is ambiguous/i'
+                    => DB_ERROR_SYNTAX,
+                '/permission denied/'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/violates not-null constraint/'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/violates [\w ]+ constraint/'
+                    => DB_ERROR_CONSTRAINT,
+                '/referential integrity violation/'
+                    => DB_ERROR_CONSTRAINT,
+                '/more expressions than target columns/i'
+                    => DB_ERROR_VALUE_COUNT_ON_ROW,
+            );
+        }
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        // Fall back to DB_ERROR if there was no mapping.
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @pg_numfields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func(@pg_fieldname($id, $i)),
+                'type'  => @pg_fieldtype($id, $i),
+                'len'   => @pg_fieldsize($id, $i),
+                'flags' => $got_string
+                           ? $this->_pgFieldFlags($id, $i, $result)
+                           : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @pg_freeresult($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ _pgFieldFlags()
+
+    /**
+     * Get a column's flags
+     *
+     * Supports "not_null", "default_value", "primary_key", "unique_key"
+     * and "multiple_key".  The default value is passed through
+     * rawurlencode() in case there are spaces in it.
+     *
+     * @param int $resource   the PostgreSQL result identifier
+     * @param int $num_field  the field number
+     *
+     * @return string  the flags
+     *
+     * @access private
+     */
+    function _pgFieldFlags($resource, $num_field, $table_name)
+    {
+        $field_name = @pg_fieldname($resource, $num_field);
+
+        $result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
+                                FROM pg_attribute f, pg_class tab, pg_type typ
+                                WHERE tab.relname = typ.typname
+                                AND typ.typrelid = f.attrelid
+                                AND f.attname = '$field_name'
+                                AND tab.relname = '$table_name'");
+        if (@pg_numrows($result) > 0) {
+            $row = @pg_fetch_row($result, 0);
+            $flags  = ($row[0] == 't') ? 'not_null ' : '';
+
+            if ($row[1] == 't') {
+                $result = @pg_exec($this->connection, "SELECT a.adsrc
+                                    FROM pg_attribute f, pg_class tab, pg_type typ, pg_attrdef a
+                                    WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
+                                    AND f.attrelid = a.adrelid AND f.attname = '$field_name'
+                                    AND tab.relname = '$table_name' AND f.attnum = a.adnum");
+                $row = @pg_fetch_row($result, 0);
+                $num = preg_replace("/'(.*)'::\w+/", "\\1", $row[0]);
+                $flags .= 'default_' . rawurlencode($num) . ' ';
+            }
+        } else {
+            $flags = '';
+        }
+        $result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
+                                FROM pg_attribute f, pg_class tab, pg_type typ, pg_index i
+                                WHERE tab.relname = typ.typname
+                                AND typ.typrelid = f.attrelid
+                                AND f.attrelid = i.indrelid
+                                AND f.attname = '$field_name'
+                                AND tab.relname = '$table_name'");
+        $count = @pg_numrows($result);
+
+        for ($i = 0; $i < $count ; $i++) {
+            $row = @pg_fetch_row($result, $i);
+            $keys = explode(' ', $row[2]);
+
+            if (in_array($num_field + 1, $keys)) {
+                $flags .= ($row[0] == 't' && $row[1] == 'f') ? 'unique_key ' : '';
+                $flags .= ($row[1] == 't') ? 'primary_key ' : '';
+                if (count($keys) > 1)
+                    $flags .= 'multiple_key ';
+            }
+        }
+
+        return trim($flags);
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT c.relname AS "Name"'
+                        . ' FROM pg_class c, pg_user u'
+                        . ' WHERE c.relowner = u.usesysid'
+                        . " AND c.relkind = 'r'"
+                        . ' AND NOT EXISTS'
+                        . ' (SELECT 1 FROM pg_views'
+                        . '  WHERE viewname = c.relname)'
+                        . " AND c.relname !~ '^(pg_|sql_)'"
+                        . ' UNION'
+                        . ' SELECT c.relname AS "Name"'
+                        . ' FROM pg_class c'
+                        . " WHERE c.relkind = 'r'"
+                        . ' AND NOT EXISTS'
+                        . ' (SELECT 1 FROM pg_views'
+                        . '  WHERE viewname = c.relname)'
+                        . ' AND NOT EXISTS'
+                        . ' (SELECT 1 FROM pg_user'
+                        . '  WHERE usesysid = c.relowner)'
+                        . " AND c.relname !~ '^pg_'";
+            case 'schema.tables':
+                return "SELECT schemaname || '.' || tablename"
+                        . ' AS "Name"'
+                        . ' FROM pg_catalog.pg_tables'
+                        . ' WHERE schemaname NOT IN'
+                        . " ('pg_catalog', 'information_schema', 'pg_toast')";
+            case 'views':
+                // Table cols: viewname | viewowner | definition
+                return 'SELECT viewname from pg_views WHERE schemaname'
+                        . " NOT IN ('information_schema', 'pg_catalog')";
+            case 'users':
+                // cols: usename |usesysid|usecreatedb|usetrace|usesuper|usecatupd|passwd  |valuntil
+                return 'SELECT usename FROM pg_user';
+            case 'databases':
+                return 'SELECT datname FROM pg_database';
+            case 'functions':
+            case 'procedures':
+                return 'SELECT proname FROM pg_proc WHERE proowner <> 1';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/sybase.php
===================================================================
--- /temp/trunk/data/module/DB/sybase.php	(revision 1328)
+++ /temp/trunk/data/module/DB/sybase.php	(revision 1328)
@@ -0,0 +1,907 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's sybase extension
+ * for interacting with Sybase databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Ant?io Carlos Ven?cio J?ior <floripa@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's sybase extension
+ * for interacting with Sybase databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * WARNING:  This driver may fail with multiple connections under the
+ * same user/pass/host and different databases.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Ant?io Carlos Ven?cio J?ior <floripa@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_sybase extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'sybase';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'sybase';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = '';
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_sybase()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's sybase driver supports the following extra DSN options:
+     *   + appname       The application name to use on this connection.
+     *                   Available since PEAR DB 1.7.0.
+     *   + charset       The character set to use on this connection.
+     *                   Available since PEAR DB 1.7.0.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('sybase') &&
+            !PEAR::loadExtension('sybase_ct'))
+        {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $dsn['hostspec'] = $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost';
+        $dsn['password'] = !empty($dsn['password']) ? $dsn['password'] : false;
+        $dsn['charset'] = isset($dsn['charset']) ? $dsn['charset'] : false;
+        $dsn['appname'] = isset($dsn['appname']) ? $dsn['appname'] : false;
+
+        $connect_function = $persistent ? 'sybase_pconnect' : 'sybase_connect';
+
+        if ($dsn['username']) {
+            $this->connection = @$connect_function($dsn['hostspec'],
+                                                   $dsn['username'],
+                                                   $dsn['password'],
+                                                   $dsn['charset'],
+                                                   $dsn['appname']);
+        } else {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     'The DSN did not contain a username.');
+        }
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     @sybase_get_last_message());
+        }
+
+        if ($dsn['database']) {
+            if (!@sybase_select_db($dsn['database'], $this->connection)) {
+                return $this->raiseError(DB_ERROR_NODBSELECTED,
+                                         null, null, null,
+                                         @sybase_get_last_message());
+            }
+            $this->_db = $dsn['database'];
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @sybase_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        if (!@sybase_select_db($this->_db, $this->connection)) {
+            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $query = $this->modifyQuery($query);
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @sybase_query('BEGIN TRANSACTION', $this->connection);
+                if (!$result) {
+                    return $this->sybaseRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @sybase_query($query, $this->connection);
+        if (!$result) {
+            return $this->sybaseRaiseError();
+        }
+        if (is_resource($result)) {
+            return $result;
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        return $ismanip ? DB_OK : $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal sybase result pointer to the next available result
+     *
+     * @param a valid sybase result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@sybase_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            if (function_exists('sybase_fetch_assoc')) {
+                $arr = @sybase_fetch_assoc($result);
+            } else {
+                if ($arr = @sybase_fetch_array($result)) {
+                    foreach ($arr as $key => $value) {
+                        if (is_int($key)) {
+                            unset($arr[$key]);
+                        }
+                    }
+                }
+            }
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @sybase_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @sybase_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @sybase_num_fields($result);
+        if (!$cols) {
+            return $this->sybaseRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @sybase_num_rows($result);
+        if ($rows === false) {
+            return $this->sybaseRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            $result = @sybase_affected_rows($this->connection);
+        } else {
+            $result = 0;
+        }
+        return $result;
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_sybase::createSequence(), DB_sybase::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        if (!@sybase_select_db($this->_db, $this->connection)) {
+            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
+            {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } elseif (!DB::isError($result)) {
+                $result =& $this->query("SELECT @@IDENTITY FROM $seqname");
+                $repeat = 0;
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        return $result[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_sybase::nextID(), DB_sybase::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE TABLE '
+                            . $this->getSequenceName($seq_name)
+                            . ' (id numeric(10, 0) IDENTITY NOT NULL,'
+                            . ' vapor int NULL)');
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_sybase::nextID(), DB_sybase::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@sybase_select_db($this->_db, $this->connection)) {
+                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @sybase_query('COMMIT', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->sybaseRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@sybase_select_db($this->_db, $this->connection)) {
+                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @sybase_query('ROLLBACK', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->sybaseRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ sybaseRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_sybase::errorNative(), DB_sybase::errorCode()
+     */
+    function sybaseRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+        return $this->raiseError($errno, null, null, null, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return @sybase_get_last_message();
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message.
+     *
+     * @param  string  $errormsg  error message returned from the database
+     * @return integer  an error number from a DB error constant
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/Incorrect syntax near/'
+                    => DB_ERROR_SYNTAX,
+                '/^Unclosed quote before the character string [\"\'].*[\"\']\./'
+                    => DB_ERROR_SYNTAX,
+                '/Implicit conversion (from datatype|of NUMERIC value)/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/Cannot drop the table [\"\'].+[\"\'], because it doesn\'t exist in the system catalogs\./'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/Only the owner of object [\"\'].+[\"\'] or a user with System Administrator \(SA\) role can run this command\./'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^.+ permission denied on object .+, database .+, owner .+/'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^.* permission denied, database .+, owner .+/'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/[^.*] not found\./'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/There is already an object named/'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/Invalid column name/'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/does not allow null values/'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/Command has been aborted/'
+                    => DB_ERROR_CONSTRAINT,
+                '/^Cannot drop the index .* because it doesn\'t exist/i'
+                    => DB_ERROR_NOT_FOUND,
+                '/^There is already an index/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/^There are fewer columns in the INSERT statement than values specified/i'
+                    => DB_ERROR_VALUE_COUNT_ON_ROW,
+            );
+        }
+
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.6.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            if (!@sybase_select_db($this->_db, $this->connection)) {
+                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $id = @sybase_query("SELECT * FROM $result WHERE 1=0",
+                                $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->sybaseRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @sybase_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $f = @sybase_fetch_field($id, $i);
+            // column_source is often blank
+            $res[$i] = array(
+                'table' => $got_string
+                           ? $case_func($result)
+                           : $case_func($f->column_source),
+                'name'  => $case_func($f->name),
+                'type'  => $f->type,
+                'len'   => $f->max_length,
+                'flags' => '',
+            );
+            if ($res[$i]['table']) {
+                $res[$i]['flags'] = $this->_sybase_field_flags(
+                        $res[$i]['table'], $res[$i]['name']);
+            }
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @sybase_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ _sybase_field_flags()
+
+    /**
+     * Get the flags for a field
+     *
+     * Currently supports:
+     *  + <samp>unique_key</samp>    (unique index, unique check or primary_key)
+     *  + <samp>multiple_key</samp>  (multi-key index)
+     *
+     * @param string  $table   the table name
+     * @param string  $column  the field name
+     *
+     * @return string  space delimited string of flags.  Empty string if none.
+     *
+     * @access private
+     */
+    function _sybase_field_flags($table, $column)
+    {
+        static $tableName = null;
+        static $flags = array();
+
+        if ($table != $tableName) {
+            $flags = array();
+            $tableName = $table;
+
+            // get unique/primary keys
+            $res = $this->getAll("sp_helpindex $table", DB_FETCHMODE_ASSOC);
+
+            if (!isset($res[0]['index_description'])) {
+                return '';
+            }
+
+            foreach ($res as $val) {
+                $keys = explode(', ', trim($val['index_keys']));
+
+                if (sizeof($keys) > 1) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'multiple_key');
+                    }
+                }
+
+                if (strpos($val['index_description'], 'unique')) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'unique_key');
+                    }
+                }
+            }
+
+        }
+
+        if (array_key_exists($column, $flags)) {
+            return(implode(' ', $flags[$column]));
+        }
+
+        return '';
+    }
+
+    // }}}
+    // {{{ _add_flag()
+
+    /**
+     * Adds a string to the flags array if the flag is not yet in there
+     * - if there is no flag present the array is created
+     *
+     * @param array  $array  reference of flags array to add a value to
+     * @param mixed  $value  value to add to the flag array
+     *
+     * @return void
+     *
+     * @access private
+     */
+    function _add_flag(&$array, $value)
+    {
+        if (!is_array($array)) {
+            $array = array($value);
+        } elseif (!in_array($value, $array)) {
+            array_push($array, $value);
+        }
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return "SELECT name FROM sysobjects WHERE type = 'U'"
+                       . ' ORDER BY name';
+            case 'views':
+                return "SELECT name FROM sysobjects WHERE type = 'V'";
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/fbsql.php
===================================================================
--- /temp/trunk/data/module/DB/fbsql.php	(revision 1328)
+++ /temp/trunk/data/module/DB/fbsql.php	(revision 1328)
@@ -0,0 +1,770 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's fbsql extension
+ * for interacting with FrontBase databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Frank M. Kromann <frank@frontbase.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's fbsql extension
+ * for interacting with FrontBase databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Frank M. Kromann <frank@frontbase.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class functional since Release 1.7.0
+ */
+class DB_fbsql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'fbsql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'fbsql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+         22 => DB_ERROR_SYNTAX,
+         85 => DB_ERROR_ALREADY_EXISTS,
+        108 => DB_ERROR_SYNTAX,
+        116 => DB_ERROR_NOSUCHTABLE,
+        124 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        215 => DB_ERROR_NOSUCHFIELD,
+        217 => DB_ERROR_INVALID_NUMBER,
+        226 => DB_ERROR_NOSUCHFIELD,
+        231 => DB_ERROR_INVALID,
+        239 => DB_ERROR_TRUNCATED,
+        251 => DB_ERROR_SYNTAX,
+        266 => DB_ERROR_NOT_FOUND,
+        357 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        358 => DB_ERROR_CONSTRAINT,
+        360 => DB_ERROR_CONSTRAINT,
+        361 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_fbsql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('fbsql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array(
+            $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
+            $dsn['username'] ? $dsn['username'] : null,
+            $dsn['password'] ? $dsn['password'] : null,
+        );
+
+        $connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $php_errormsg);
+        }
+
+        if ($dsn['database']) {
+            if (!@fbsql_select_db($dsn['database'], $this->connection)) {
+                return $this->fbsqlRaiseError();
+            }
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @fbsql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @fbsql_query("$query;", $this->connection);
+        if (!$result) {
+            return $this->fbsqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if (DB::isManip($query)) {
+            return DB_OK;
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal fbsql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return @fbsql_next_result($result);
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@fbsql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @fbsql_fetch_array($result, FBSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @fbsql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @fbsql_free_result($result);
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff=false)
+    {
+        if ($onoff) {
+            $this->query("SET COMMIT TRUE");
+        } else {
+            $this->query("SET COMMIT FALSE");
+        }
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        @fbsql_commit();
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        @fbsql_rollback();
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @fbsql_num_fields($result);
+        if (!$cols) {
+            return $this->fbsqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @fbsql_num_rows($result);
+        if ($rows === null) {
+            return $this->fbsqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            $result = @fbsql_affected_rows($this->connection);
+        } else {
+            $result = 0;
+        }
+        return $result;
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_fbsql::createSequence(), DB_fbsql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query('SELECT UNIQUE FROM ' . $seqname);
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $result;
+                }
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->fbsqlRaiseError();
+        }
+        $result->fetchInto($tmp, DB_FETCHMODE_ORDERED);
+        return $tmp[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_fbsql::nextID(), DB_fbsql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+        if ($res) {
+            $res = $this->query('SET UNIQUE = 0 FOR ' . $seqname);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_fbsql::nextID(), DB_fbsql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name)
+                            . ' RESTRICT');
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if (DB::isManip($query)) {
+            return preg_replace('/^([\s(])*SELECT/i',
+                                "\\1SELECT TOP($count)", $query);
+        } else {
+            return preg_replace('/([\s(])*SELECT/i',
+                                "\\1SELECT TOP($from, $count)", $query);
+        }
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     *                 + null = the string <samp>NULL</samp>
+     *                 + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp>
+     *                 + integer or double = the unquoted number
+     *                 + other (including strings and numeric strings) =
+     *                   the data escaped according to FrontBase's settings
+     *                   then encapsulated between single quotes
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 'TRUE' : 'FALSE';
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ fbsqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_fbsql::errorNative(), DB_common::errorCode()
+     */
+    function fbsqlRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $errno = $this->errorCode(fbsql_errno($this->connection));
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 @fbsql_error($this->connection));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        return @fbsql_errno($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @fbsql_list_fields($this->dsn['database'],
+                                     $result, $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->fbsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @fbsql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $case_func(@fbsql_field_table($id, $i)),
+                'name'  => $case_func(@fbsql_field_name($id, $i)),
+                'type'  => @fbsql_field_type($id, $i),
+                'len'   => @fbsql_field_len($id, $i),
+                'flags' => @fbsql_field_flags($id, $i),
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @fbsql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT "table_name" FROM information_schema.tables'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk AND'
+                       . ' "table_type" = \'BASE TABLE\''
+                       . ' AND "schema_name" = current_schema';
+            case 'views':
+                return 'SELECT "table_name" FROM information_schema.tables'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk AND'
+                       . ' "table_type" = \'VIEW\''
+                       . ' AND "schema_name" = current_schema';
+            case 'users':
+                return 'SELECT "user_name" from information_schema.users'; 
+            case 'functions':
+                return 'SELECT "routine_name" FROM'
+                       . ' information_schema.psm_routines'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk'
+                       . ' AND "routine_kind"=\'FUNCTION\''
+                       . ' AND "schema_name" = current_schema';
+            case 'procedures':
+                return 'SELECT "routine_name" FROM'
+                       . ' information_schema.psm_routines'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk'
+                       . ' AND "routine_kind"=\'PROCEDURE\''
+                       . ' AND "schema_name" = current_schema';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/odbc.php
===================================================================
--- /temp/trunk/data/module/DB/odbc.php	(revision 1328)
+++ /temp/trunk/data/module/DB/odbc.php	(revision 1328)
@@ -0,0 +1,883 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's odbc extension
+ * for interacting with databases via ODBC connections
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's odbc extension
+ * for interacting with databases via ODBC connections
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * More info on ODBC errors could be found here:
+ * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_err_odbc_5stz.asp
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_odbc extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'odbc';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'sql92';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * NOTE: The feature set of the following drivers are different than
+     * the default:
+     *   + solid: 'transactions' = true
+     *   + navision: 'limit' = false
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        '01004' => DB_ERROR_TRUNCATED,
+        '07001' => DB_ERROR_MISMATCH,
+        '21S01' => DB_ERROR_VALUE_COUNT_ON_ROW,
+        '21S02' => DB_ERROR_MISMATCH,
+        '22001' => DB_ERROR_INVALID,
+        '22003' => DB_ERROR_INVALID_NUMBER,
+        '22005' => DB_ERROR_INVALID_NUMBER,
+        '22008' => DB_ERROR_INVALID_DATE,
+        '22012' => DB_ERROR_DIVZERO,
+        '23000' => DB_ERROR_CONSTRAINT,
+        '23502' => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '23503' => DB_ERROR_CONSTRAINT,
+        '23504' => DB_ERROR_CONSTRAINT,
+        '23505' => DB_ERROR_CONSTRAINT,
+        '24000' => DB_ERROR_INVALID,
+        '34000' => DB_ERROR_INVALID,
+        '37000' => DB_ERROR_SYNTAX,
+        '42000' => DB_ERROR_SYNTAX,
+        '42601' => DB_ERROR_SYNTAX,
+        'IM001' => DB_ERROR_UNSUPPORTED,
+        'S0000' => DB_ERROR_NOSUCHTABLE,
+        'S0001' => DB_ERROR_ALREADY_EXISTS,
+        'S0002' => DB_ERROR_NOSUCHTABLE,
+        'S0011' => DB_ERROR_ALREADY_EXISTS,
+        'S0012' => DB_ERROR_NOT_FOUND,
+        'S0021' => DB_ERROR_ALREADY_EXISTS,
+        'S0022' => DB_ERROR_NOSUCHFIELD,
+        'S1009' => DB_ERROR_INVALID,
+        'S1090' => DB_ERROR_INVALID,
+        'S1C00' => DB_ERROR_NOT_CAPABLE,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     * @access private
+     */
+    var $affected = 0;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_odbc()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's odbc driver supports the following extra DSN options:
+     *   + cursor  The type of cursor to be used for this connection.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('odbc')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+        switch ($this->dbsyntax) {
+            case 'access':
+            case 'db2':
+            case 'solid':
+                $this->features['transactions'] = true;
+                break;
+            case 'navision':
+                $this->features['limit'] = false;
+        }
+
+        /*
+         * This is hear for backwards compatibility. Should have been using
+         * 'database' all along, but prior to 1.6.0RC3 'hostspec' was used.
+         */
+        if ($dsn['database']) {
+            $odbcdsn = $dsn['database'];
+        } elseif ($dsn['hostspec']) {
+            $odbcdsn = $dsn['hostspec'];
+        } else {
+            $odbcdsn = 'localhost';
+        }
+
+        $connect_function = $persistent ? 'odbc_pconnect' : 'odbc_connect';
+
+        if (empty($dsn['cursor'])) {
+            $this->connection = @$connect_function($odbcdsn, $dsn['username'],
+                                                   $dsn['password']);
+        } else {
+            $this->connection = @$connect_function($odbcdsn, $dsn['username'],
+                                                   $dsn['password'],
+                                                   $dsn['cursor']);
+        }
+
+        if (!is_resource($this->connection)) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $this->errorNative());
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $err = @odbc_close($this->connection);
+        $this->connection = null;
+        return $err;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @odbc_exec($this->connection, $query);
+        if (!$result) {
+            return $this->odbcRaiseError(); // XXX ERRORMSG
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if (DB::isManip($query)) {
+            $this->affected = $result; // For affectedRows()
+            return DB_OK;
+        }
+        $this->affected = 0;
+        return $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal odbc result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return @odbc_next_result($result);
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        $arr = array();
+        if ($rownum !== null) {
+            $rownum++; // ODBC first row is 1
+            if (version_compare(phpversion(), '4.2.0', 'ge')) {
+                $cols = @odbc_fetch_into($result, $arr, $rownum);
+            } else {
+                $cols = @odbc_fetch_into($result, $rownum, $arr);
+            }
+        } else {
+            $cols = @odbc_fetch_into($result, $arr);
+        }
+        if (!$cols) {
+            return null;
+        }
+        if ($fetchmode !== DB_FETCHMODE_ORDERED) {
+            for ($i = 0; $i < count($arr); $i++) {
+                $colName = @odbc_field_name($result, $i+1);
+                $a[$colName] = $arr[$i];
+            }
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+                $a = array_change_key_case($a, CASE_LOWER);
+            }
+            $arr = $a;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @odbc_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @odbc_num_fields($result);
+        if (!$cols) {
+            return $this->odbcRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (empty($this->affected)) {  // In case of SELECT stms
+            return 0;
+        }
+        $nrows = @odbc_num_rows($this->affected);
+        if ($nrows == -1) {
+            return $this->odbcRaiseError();
+        }
+        return $nrows;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * Not all ODBC drivers support this functionality.  If they don't
+     * a DB_Error object for DB_ERROR_UNSUPPORTED is returned.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $nrows = @odbc_num_rows($result);
+        if ($nrows == -1) {
+            return $this->odbcRaiseError(DB_ERROR_UNSUPPORTED);
+        }
+        if ($nrows === false) {
+            return $this->odbcRaiseError();
+        }
+        return $nrows;
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * Use 'mssql' as the dbsyntax in the DB DSN only if you've unchecked
+     * "Use ANSI quoted identifiers" when setting up the ODBC data source.
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        switch ($this->dsn['dbsyntax']) {
+            case 'access':
+                return '[' . $str . ']';
+            case 'mssql':
+            case 'sybase':
+                return '[' . str_replace(']', ']]', $str) . ']';
+            case 'mysql':
+            case 'mysqli':
+                return '`' . $str . '`';
+            default:
+                return '"' . str_replace('"', '""', $str) . '"';
+        }
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * @deprecated  Deprecated in release 1.6.0
+     * @internal
+     */
+    function quote($str)
+    {
+        return $this->quoteSmart($str);
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_odbc::createSequence(), DB_odbc::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("update ${seqname} set id = id + 1");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = 1;
+                $this->pushErrorHandling(PEAR_ERROR_RETURN);
+                $result = $this->createSequence($seq_name);
+                $this->popErrorHandling();
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                $result = $this->query("insert into ${seqname} (id) values(0)");
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+
+        $result = $this->query("select id from ${seqname}");
+        if (DB::isError($result)) {
+            return $result;
+        }
+
+        $row = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        if (DB::isError($row || !$row)) {
+            return $row;
+        }
+
+        return $row[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_odbc::nextID(), DB_odbc::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE TABLE '
+                            . $this->getSequenceName($seq_name)
+                            . ' (id integer NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_odbc::nextID(), DB_odbc::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        if (!@odbc_autocommit($this->connection, $onoff)) {
+            return $this->odbcRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if (!@odbc_commit($this->connection)) {
+            return $this->odbcRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if (!@odbc_rollback($this->connection)) {
+            return $this->odbcRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ odbcRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_odbc::errorNative(), DB_common::errorCode()
+     */
+    function odbcRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            switch ($this->dbsyntax) {
+                case 'access':
+                    if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
+                        $this->errorcode_map['07001'] = DB_ERROR_NOSUCHFIELD;
+                    } else {
+                        // Doing this in case mode changes during runtime.
+                        $this->errorcode_map['07001'] = DB_ERROR_MISMATCH;
+                    }
+
+                    $native_code = odbc_error($this->connection);
+
+                    // S1000 is for "General Error."  Let's be more specific.
+                    if ($native_code == 'S1000') {
+                        $errormsg = odbc_errormsg($this->connection);
+                        static $error_regexps;
+                        if (!isset($error_regexps)) {
+                            $error_regexps = array(
+                                '/includes related records.$/i'  => DB_ERROR_CONSTRAINT,
+                                '/cannot contain a Null value/i' => DB_ERROR_CONSTRAINT_NOT_NULL,
+                            );
+                        }
+                        foreach ($error_regexps as $regexp => $code) {
+                            if (preg_match($regexp, $errormsg)) {
+                                return $this->raiseError($code,
+                                        null, null, null,
+                                        $native_code . ' ' . $errormsg);
+                            }
+                        }
+                        $errno = DB_ERROR;
+                    } else {
+                        $errno = $this->errorCode($native_code);
+                    }
+                    break;
+                default:
+                    $errno = $this->errorCode(odbc_error($this->connection));
+            }
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 $this->errorNative());
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code and message produced by the last query
+     *
+     * @return string  the DBMS' error code and message
+     */
+    function errorNative()
+    {
+        if (!is_resource($this->connection)) {
+            return @odbc_error() . ' ' . @odbc_errormsg();
+        }
+        return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.7.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @odbc_exec($this->connection, "SELECT * FROM $result");
+            if (!$id) {
+                return $this->odbcRaiseError();
+            }
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->odbcRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @odbc_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $col = $i + 1;
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func(@odbc_field_name($id, $col)),
+                'type'  => @odbc_field_type($id, $col),
+                'len'   => @odbc_field_len($id, $col),
+                'flags' => '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @odbc_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * Thanks to symbol1@gmail.com and Philippe.Jausions@11abacus.com.
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the list of objects requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     * @since Method available since Release 1.7.0
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'databases':
+                if (!function_exists('odbc_data_source')) {
+                    return null;
+                }
+                $res = @odbc_data_source($this->connection, SQL_FETCH_FIRST);
+                if (is_array($res)) {
+                    $out = array($res['server']);
+                    while($res = @odbc_data_source($this->connection,
+                                                   SQL_FETCH_NEXT))
+                    {
+                        $out[] = $res['server'];
+                    }
+                    return $out;
+                } else {
+                    return $this->odbcRaiseError();
+                }
+                break;
+            case 'tables':
+            case 'schema.tables':
+                $keep = 'TABLE';
+                break;
+            case 'views':
+                $keep = 'VIEW';
+                break;
+            default:
+                return null;
+        }
+
+        /*
+         * Removing non-conforming items in the while loop rather than
+         * in the odbc_tables() call because some backends choke on this:
+         *     odbc_tables($this->connection, '', '', '', 'TABLE')
+         */
+        $res  = @odbc_tables($this->connection);
+        if (!$res) {
+            return $this->odbcRaiseError();
+        }
+        $out = array();
+        while ($row = odbc_fetch_array($res)) {
+            if ($row['TABLE_TYPE'] != $keep) {
+                continue;
+            }
+            if ($type == 'schema.tables') {
+                $out[] = $row['TABLE_SCHEM'] . '.' . $row['TABLE_NAME'];
+            } else {
+                $out[] = $row['TABLE_NAME'];
+            }
+        }
+        return $out;
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/common.php
===================================================================
--- /temp/trunk/data/module/DB/common.php	(revision 1328)
+++ /temp/trunk/data/module/DB/common.php	(revision 1328)
@@ -0,0 +1,2157 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Contains the DB_common base class
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the PEAR class so it can be extended from
+ */
+require_once 'PEAR.php';
+
+/**
+ * DB_common is the base class from which each database driver class extends
+ *
+ * All common methods are declared here.  If a given DBMS driver contains
+ * a particular method, that method will overload the one here.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_common extends PEAR
+{
+    // {{{ properties
+
+    /**
+     * The current default fetch mode
+     * @var integer
+     */
+    var $fetchmode = DB_FETCHMODE_ORDERED;
+
+    /**
+     * The name of the class into which results should be fetched when
+     * DB_FETCHMODE_OBJECT is in effect
+     *
+     * @var string
+     */
+    var $fetchmode_object_class = 'stdClass';
+
+    /**
+     * Was a connection present when the object was serialized()?
+     * @var bool
+     * @see DB_common::__sleep(), DB_common::__wake()
+     */
+    var $was_connected = null;
+
+    /**
+     * The most recently executed query
+     * @var string
+     */
+    var $last_query = '';
+
+    /**
+     * Run-time configuration options
+     *
+     * The 'optimize' option has been deprecated.  Use the 'portability'
+     * option instead.
+     *
+     * @var array
+     * @see DB_common::setOption()
+     */
+    var $options = array(
+        'result_buffering' => 500,
+        'persistent' => false,
+        'ssl' => false,
+        'debug' => 0,
+        'seqname_format' => '%s_seq',
+        'autofree' => false,
+        'portability' => DB_PORTABILITY_NONE,
+        'optimize' => 'performance',  // Deprecated.  Use 'portability'.
+    );
+
+    /**
+     * The parameters from the most recently executed query
+     * @var array
+     * @since Property available since Release 1.7.0
+     */
+    var $last_parameters = array();
+
+    /**
+     * The elements from each prepared statement
+     * @var array
+     */
+    var $prepare_tokens = array();
+
+    /**
+     * The data types of the various elements in each prepared statement
+     * @var array
+     */
+    var $prepare_types = array();
+
+    /**
+     * The prepared queries
+     * @var array
+     */
+    var $prepared_queries = array();
+
+
+    // }}}
+    // {{{ DB_common
+
+    /**
+     * This constructor calls <kbd>$this->PEAR('DB_Error')</kbd>
+     *
+     * @return void
+     */
+    function DB_common()
+    {
+        $this->PEAR('DB_Error');
+    }
+
+    // }}}
+    // {{{ __sleep()
+
+    /**
+     * Automatically indicates which properties should be saved
+     * when PHP's serialize() function is called
+     *
+     * @return array  the array of properties names that should be saved
+     */
+    function __sleep()
+    {
+        if ($this->connection) {
+            // Don't disconnect(), people use serialize() for many reasons
+            $this->was_connected = true;
+        } else {
+            $this->was_connected = false;
+        }
+        if (isset($this->autocommit)) {
+            return array('autocommit',
+                         'dbsyntax',
+                         'dsn',
+                         'features',
+                         'fetchmode',
+                         'fetchmode_object_class',
+                         'options',
+                         'was_connected',
+                   );
+        } else {
+            return array('dbsyntax',
+                         'dsn',
+                         'features',
+                         'fetchmode',
+                         'fetchmode_object_class',
+                         'options',
+                         'was_connected',
+                   );
+        }
+    }
+
+    // }}}
+    // {{{ __wakeup()
+
+    /**
+     * Automatically reconnects to the database when PHP's unserialize()
+     * function is called
+     *
+     * The reconnection attempt is only performed if the object was connected
+     * at the time PHP's serialize() function was run.
+     *
+     * @return void
+     */
+    function __wakeup()
+    {
+        if ($this->was_connected) {
+            $this->connect($this->dsn, $this->options);
+        }
+    }
+
+    // }}}
+    // {{{ __toString()
+
+    /**
+     * Automatic string conversion for PHP 5
+     *
+     * @return string  a string describing the current PEAR DB object
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function __toString()
+    {
+        $info = strtolower(get_class($this));
+        $info .=  ': (phptype=' . $this->phptype .
+                  ', dbsyntax=' . $this->dbsyntax .
+                  ')';
+        if ($this->connection) {
+            $info .= ' [connected]';
+        }
+        return $info;
+    }
+
+    // }}}
+    // {{{ toString()
+
+    /**
+     * DEPRECATED:  String conversion method
+     *
+     * @return string  a string describing the current PEAR DB object
+     *
+     * @deprecated Method deprecated in Release 1.7.0
+     */
+    function toString()
+    {
+        return $this->__toString();
+    }
+
+    // }}}
+    // {{{ quoteString()
+
+    /**
+     * DEPRECATED: Quotes a string so it can be safely used within string
+     * delimiters in a query
+     *
+     * @param string $string  the string to be quoted
+     *
+     * @return string  the quoted string
+     *
+     * @see DB_common::quoteSmart(), DB_common::escapeSimple()
+     * @deprecated Method deprecated some time before Release 1.2
+     */
+    function quoteString($string)
+    {
+        $string = $this->quote($string);
+        if ($string{0} == "'") {
+            return substr($string, 1, -1);
+        }
+        return $string;
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * DEPRECATED: Quotes a string so it can be safely used in a query
+     *
+     * @param string $string  the string to quote
+     *
+     * @return string  the quoted string or the string <samp>NULL</samp>
+     *                  if the value submitted is <kbd>null</kbd>.
+     *
+     * @see DB_common::quoteSmart(), DB_common::escapeSimple()
+     * @deprecated Deprecated in release 1.6.0
+     */
+    function quote($string = null)
+    {
+        return ($string === null) ? 'NULL'
+                                  : "'" . str_replace("'", "''", $string) . "'";
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * Delimiting style depends on which database driver is being used.
+     *
+     * NOTE: just because you CAN use delimited identifiers doesn't mean
+     * you SHOULD use them.  In general, they end up causing way more
+     * problems than they solve.
+     *
+     * Portability is broken by using the following characters inside
+     * delimited identifiers:
+     *   + backtick (<kbd>`</kbd>) -- due to MySQL
+     *   + double quote (<kbd>"</kbd>) -- due to Oracle
+     *   + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
+     *
+     * Delimited identifiers are known to generally work correctly under
+     * the following drivers:
+     *   + mssql
+     *   + mysql
+     *   + mysqli
+     *   + oci8
+     *   + odbc(access)
+     *   + odbc(db2)
+     *   + pgsql
+     *   + sqlite
+     *   + sybase (must execute <kbd>set quoted_identifier on</kbd> sometime
+     *     prior to use)
+     *
+     * InterBase doesn't seem to be able to use delimited identifiers
+     * via PHP 4.  They work fine under PHP 5.
+     *
+     * @param string $str  the identifier name to be quoted
+     *
+     * @return string  the quoted identifier
+     *
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '"' . str_replace('"', '""', $str) . '"';
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * The output depends on the PHP data type of input and the database
+     * type being used.
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     * <ul>
+     *  <li>
+     *    <kbd>input</kbd> -> <samp>returns</samp>
+     *  </li>
+     *  <li>
+     *    <kbd>null</kbd> -> the string <samp>NULL</samp>
+     *  </li>
+     *  <li>
+     *    <kbd>integer</kbd> or <kbd>double</kbd> -> the unquoted number
+     *  </li>
+     *  <li>
+     *    <kbd>bool</kbd> -> output depends on the driver in use
+     *    Most drivers return integers: <samp>1</samp> if
+     *    <kbd>true</kbd> or <samp>0</samp> if
+     *    <kbd>false</kbd>.
+     *    Some return strings: <samp>TRUE</samp> if
+     *    <kbd>true</kbd> or <samp>FALSE</samp> if
+     *    <kbd>false</kbd>.
+     *    Finally one returns strings: <samp>T</samp> if
+     *    <kbd>true</kbd> or <samp>F</samp> if
+     *    <kbd>false</kbd>. Here is a list of each DBMS,
+     *    the values returned and the suggested column type:
+     *    <ul>
+     *      <li>
+     *        <kbd>dbase</kbd> -> <samp>T/F</samp>
+     *        (<kbd>Logical</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>fbase</kbd> -> <samp>TRUE/FALSE</samp>
+     *        (<kbd>BOOLEAN</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>ibase</kbd> -> <samp>1/0</samp>
+     *        (<kbd>SMALLINT</kbd>) [1]
+     *      </li>
+     *      <li>
+     *        <kbd>ifx</kbd> -> <samp>1/0</samp>
+     *        (<kbd>SMALLINT</kbd>) [1]
+     *      </li>
+     *      <li>
+     *        <kbd>msql</kbd> -> <samp>1/0</samp>
+     *        (<kbd>INTEGER</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>mssql</kbd> -> <samp>1/0</samp>
+     *        (<kbd>BIT</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>mysql</kbd> -> <samp>1/0</samp>
+     *        (<kbd>TINYINT(1)</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>mysqli</kbd> -> <samp>1/0</samp>
+     *        (<kbd>TINYINT(1)</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>oci8</kbd> -> <samp>1/0</samp>
+     *        (<kbd>NUMBER(1)</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>odbc</kbd> -> <samp>1/0</samp>
+     *        (<kbd>SMALLINT</kbd>) [1]
+     *      </li>
+     *      <li>
+     *        <kbd>pgsql</kbd> -> <samp>TRUE/FALSE</samp>
+     *        (<kbd>BOOLEAN</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>sqlite</kbd> -> <samp>1/0</samp>
+     *        (<kbd>INTEGER</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>sybase</kbd> -> <samp>1/0</samp>
+     *        (<kbd>TINYINT(1)</kbd>)
+     *      </li>
+     *    </ul>
+     *    [1] Accommodate the lowest common denominator because not all
+     *    versions of have <kbd>BOOLEAN</kbd>.
+     *  </li>
+     *  <li>
+     *    other (including strings and numeric strings) ->
+     *    the data with single quotes escaped by preceeding
+     *    single quotes, backslashes are escaped by preceeding
+     *    backslashes, then the whole string is encapsulated
+     *    between single quotes
+     *  </li>
+     * </ul>
+     *
+     * @see DB_common::escapeSimple()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 1 : 0;
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * In SQLite, this makes things safe for inserts/updates, but may
+     * cause problems when performing text comparisons against columns
+     * containing binary data. See the
+     * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        return str_replace("'", "''", $str);
+    }
+
+    // }}}
+    // {{{ provides()
+
+    /**
+     * Tells whether the present driver supports a given feature
+     *
+     * @param string $feature  the feature you're curious about
+     *
+     * @return bool  whether this driver supports $feature
+     */
+    function provides($feature)
+    {
+        return $this->features[$feature];
+    }
+
+    // }}}
+    // {{{ setFetchMode()
+
+    /**
+     * Sets the fetch mode that should be used by default for query results
+     *
+     * @param integer $fetchmode    DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC
+     *                               or DB_FETCHMODE_OBJECT
+     * @param string $object_class  the class name of the object to be returned
+     *                               by the fetch methods when the
+     *                               DB_FETCHMODE_OBJECT mode is selected.
+     *                               If no class is specified by default a cast
+     *                               to object from the assoc array row will be
+     *                               done.  There is also the posibility to use
+     *                               and extend the 'DB_row' class.
+     *
+     * @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT
+     */
+    function setFetchMode($fetchmode, $object_class = 'stdClass')
+    {
+        switch ($fetchmode) {
+            case DB_FETCHMODE_OBJECT:
+                $this->fetchmode_object_class = $object_class;
+            case DB_FETCHMODE_ORDERED:
+            case DB_FETCHMODE_ASSOC:
+                $this->fetchmode = $fetchmode;
+                break;
+            default:
+                return $this->raiseError('invalid fetchmode mode');
+        }
+    }
+
+    // }}}
+    // {{{ setOption()
+
+    /**
+     * Sets run-time configuration options for PEAR DB
+     *
+     * Options, their data types, default values and description:
+     * <ul>
+     * <li>
+     * <var>autofree</var> <kbd>boolean</kbd> = <samp>false</samp>
+     *      <br />should results be freed automatically when there are no
+     *            more rows?
+     * </li><li>
+     * <var>result_buffering</var> <kbd>integer</kbd> = <samp>500</samp>
+     *      <br />how many rows of the result set should be buffered?
+     *      <br />In mysql: mysql_unbuffered_query() is used instead of
+     *            mysql_query() if this value is 0.  (Release 1.7.0)
+     *      <br />In oci8: this value is passed to ocisetprefetch().
+     *            (Release 1.7.0)
+     * </li><li>
+     * <var>debug</var> <kbd>integer</kbd> = <samp>0</samp>
+     *      <br />debug level
+     * </li><li>
+     * <var>persistent</var> <kbd>boolean</kbd> = <samp>false</samp>
+     *      <br />should the connection be persistent?
+     * </li><li>
+     * <var>portability</var> <kbd>integer</kbd> = <samp>DB_PORTABILITY_NONE</samp>
+     *      <br />portability mode constant (see below)
+     * </li><li>
+     * <var>seqname_format</var> <kbd>string</kbd> = <samp>%s_seq</samp>
+     *      <br />the sprintf() format string used on sequence names.  This
+     *            format is applied to sequence names passed to
+     *            createSequence(), nextID() and dropSequence().
+     * </li><li>
+     * <var>ssl</var> <kbd>boolean</kbd> = <samp>false</samp>
+     *      <br />use ssl to connect?
+     * </li>
+     * </ul>
+     *
+     * -----------------------------------------
+     *
+     * PORTABILITY MODES
+     *
+     * These modes are bitwised, so they can be combined using <kbd>|</kbd>
+     * and removed using <kbd>^</kbd>.  See the examples section below on how
+     * to do this.
+     *
+     * <samp>DB_PORTABILITY_NONE</samp>
+     * turn off all portability features
+     *
+     * This mode gets automatically turned on if the deprecated
+     * <var>optimize</var> option gets set to <samp>performance</samp>.
+     *
+     *
+     * <samp>DB_PORTABILITY_LOWERCASE</samp>
+     * convert names of tables and fields to lower case when using
+     * <kbd>get*()</kbd>, <kbd>fetch*()</kbd> and <kbd>tableInfo()</kbd>
+     *
+     * This mode gets automatically turned on in the following databases
+     * if the deprecated option <var>optimize</var> gets set to
+     * <samp>portability</samp>:
+     * + oci8
+     *
+     *
+     * <samp>DB_PORTABILITY_RTRIM</samp>
+     * right trim the data output by <kbd>get*()</kbd> <kbd>fetch*()</kbd>
+     *
+     *
+     * <samp>DB_PORTABILITY_DELETE_COUNT</samp>
+     * force reporting the number of rows deleted
+     *
+     * Some DBMS's don't count the number of rows deleted when performing
+     * simple <kbd>DELETE FROM tablename</kbd> queries.  This portability
+     * mode tricks such DBMS's into telling the count by adding
+     * <samp>WHERE 1=1</samp> to the end of <kbd>DELETE</kbd> queries.
+     *
+     * This mode gets automatically turned on in the following databases
+     * if the deprecated option <var>optimize</var> gets set to
+     * <samp>portability</samp>:
+     * + fbsql
+     * + mysql
+     * + mysqli
+     * + sqlite
+     *
+     *
+     * <samp>DB_PORTABILITY_NUMROWS</samp>
+     * enable hack that makes <kbd>numRows()</kbd> work in Oracle
+     *
+     * This mode gets automatically turned on in the following databases
+     * if the deprecated option <var>optimize</var> gets set to
+     * <samp>portability</samp>:
+     * + oci8
+     *
+     *
+     * <samp>DB_PORTABILITY_ERRORS</samp>
+     * makes certain error messages in certain drivers compatible
+     * with those from other DBMS's
+     *
+     * + mysql, mysqli:  change unique/primary key constraints
+     *   DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
+     *
+     * + odbc(access):  MS's ODBC driver reports 'no such field' as code
+     *   07001, which means 'too few parameters.'  When this option is on
+     *   that code gets mapped to DB_ERROR_NOSUCHFIELD.
+     *   DB_ERROR_MISMATCH -> DB_ERROR_NOSUCHFIELD
+     *
+     * <samp>DB_PORTABILITY_NULL_TO_EMPTY</samp>
+     * convert null values to empty strings in data output by get*() and
+     * fetch*().  Needed because Oracle considers empty strings to be null,
+     * while most other DBMS's know the difference between empty and null.
+     *
+     *
+     * <samp>DB_PORTABILITY_ALL</samp>
+     * turn on all portability features
+     *
+     * -----------------------------------------
+     *
+     * Example 1. Simple setOption() example
+     * <code>
+     * $db->setOption('autofree', true);
+     * </code>
+     *
+     * Example 2. Portability for lowercasing and trimming
+     * <code>
+     * $db->setOption('portability',
+     *                 DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_RTRIM);
+     * </code>
+     *
+     * Example 3. All portability options except trimming
+     * <code>
+     * $db->setOption('portability',
+     *                 DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM);
+     * </code>
+     *
+     * @param string $option option name
+     * @param mixed  $value value for the option
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::$options
+     */
+    function setOption($option, $value)
+    {
+        if (isset($this->options[$option])) {
+            $this->options[$option] = $value;
+
+            /*
+             * Backwards compatibility check for the deprecated 'optimize'
+             * option.  Done here in case settings change after connecting.
+             */
+            if ($option == 'optimize') {
+                if ($value == 'portability') {
+                    switch ($this->phptype) {
+                        case 'oci8':
+                            $this->options['portability'] =
+                                    DB_PORTABILITY_LOWERCASE |
+                                    DB_PORTABILITY_NUMROWS;
+                            break;
+                        case 'fbsql':
+                        case 'mysql':
+                        case 'mysqli':
+                        case 'sqlite':
+                            $this->options['portability'] =
+                                    DB_PORTABILITY_DELETE_COUNT;
+                            break;
+                    }
+                } else {
+                    $this->options['portability'] = DB_PORTABILITY_NONE;
+                }
+            }
+
+            return DB_OK;
+        }
+        return $this->raiseError("unknown option $option");
+    }
+
+    // }}}
+    // {{{ getOption()
+
+    /**
+     * Returns the value of an option
+     *
+     * @param string $option  the option name you're curious about
+     *
+     * @return mixed  the option's value
+     */
+    function getOption($option)
+    {
+        if (isset($this->options[$option])) {
+            return $this->options[$option];
+        }
+        return $this->raiseError("unknown option $option");
+    }
+
+    // }}}
+    // {{{ prepare()
+
+    /**
+     * Prepares a query for multiple execution with execute()
+     *
+     * Creates a query that can be run multiple times.  Each time it is run,
+     * the placeholders, if any, will be replaced by the contents of
+     * execute()'s $data argument.
+     *
+     * Three types of placeholders can be used:
+     *   + <kbd>?</kbd>  scalar value (i.e. strings, integers).  The system
+     *                   will automatically quote and escape the data.
+     *   + <kbd>!</kbd>  value is inserted 'as is'
+     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
+     *                   inserted into the query (i.e. saving binary
+     *                   data in a db)
+     *
+     * Example 1.
+     * <code>
+     * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
+     * $data = array(
+     *     "John's text",
+     *     "'it''s good'",
+     *     'filename.txt'
+     * );
+     * $res = $db->execute($sth, $data);
+     * </code>
+     *
+     * Use backslashes to escape placeholder characters if you don't want
+     * them to be interpreted as placeholders:
+     * <pre>
+     *    "UPDATE foo SET col=? WHERE col='over \& under'"
+     * </pre>
+     *
+     * With some database backends, this is emulated.
+     *
+     * {@internal ibase and oci8 have their own prepare() methods.}}
+     *
+     * @param string $query  the query to be prepared
+     *
+     * @return mixed  DB statement resource on success. A DB_Error object
+     *                 on failure.
+     *
+     * @see DB_common::execute()
+     */
+    function prepare($query)
+    {
+        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
+                               PREG_SPLIT_DELIM_CAPTURE);
+        $token     = 0;
+        $types     = array();
+        $newtokens = array();
+
+        foreach ($tokens as $val) {
+            switch ($val) {
+                case '?':
+                    $types[$token++] = DB_PARAM_SCALAR;
+                    break;
+                case '&':
+                    $types[$token++] = DB_PARAM_OPAQUE;
+                    break;
+                case '!':
+                    $types[$token++] = DB_PARAM_MISC;
+                    break;
+                default:
+                    $newtokens[] = preg_replace('/\\\([&?!])/', "\\1", $val);
+            }
+        }
+
+        $this->prepare_tokens[] = &$newtokens;
+        end($this->prepare_tokens);
+
+        $k = key($this->prepare_tokens);
+        $this->prepare_types[$k] = $types;
+        $this->prepared_queries[$k] = implode(' ', $newtokens);
+
+        return $k;
+    }
+
+    // }}}
+    // {{{ autoPrepare()
+
+    /**
+     * Automaticaly generates an insert or update query and pass it to prepare()
+     *
+     * @param string $table         the table name
+     * @param array  $table_fields  the array of field names
+     * @param int    $mode          a type of query to make:
+     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
+     * @param string $where         for update queries: the WHERE clause to
+     *                               append to the SQL statement.  Don't
+     *                               include the "WHERE" keyword.
+     *
+     * @return resource  the query handle
+     *
+     * @uses DB_common::prepare(), DB_common::buildManipSQL()
+     */
+    function autoPrepare($table, $table_fields, $mode = DB_AUTOQUERY_INSERT,
+                         $where = false)
+    {
+        $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
+        if (DB::isError($query)) {
+            return $query;
+        }
+        return $this->prepare($query);
+    }
+
+    // }}}
+    // {{{ autoExecute()
+
+    /**
+     * Automaticaly generates an insert or update query and call prepare()
+     * and execute() with it
+     *
+     * @param string $table         the table name
+     * @param array  $fields_values the associative array where $key is a
+     *                               field name and $value its value
+     * @param int    $mode          a type of query to make:
+     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
+     * @param string $where         for update queries: the WHERE clause to
+     *                               append to the SQL statement.  Don't
+     *                               include the "WHERE" keyword.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     *
+     * @uses DB_common::autoPrepare(), DB_common::execute()
+     */
+    function autoExecute($table, $fields_values, $mode = DB_AUTOQUERY_INSERT,
+                         $where = false)
+    {
+        $sth = $this->autoPrepare($table, array_keys($fields_values), $mode,
+                                  $where);
+        if (DB::isError($sth)) {
+            return $sth;
+        }
+        $ret =& $this->execute($sth, array_values($fields_values));
+        $this->freePrepared($sth);
+        return $ret;
+
+    }
+
+    // }}}
+    // {{{ buildManipSQL()
+
+    /**
+     * Produces an SQL query string for autoPrepare()
+     *
+     * Example:
+     * <pre>
+     * buildManipSQL('table_sql', array('field1', 'field2', 'field3'),
+     *               DB_AUTOQUERY_INSERT);
+     * </pre>
+     *
+     * That returns
+     * <samp>
+     * INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
+     * </samp>
+     *
+     * NOTES:
+     *   - This belongs more to a SQL Builder class, but this is a simple
+     *     facility.
+     *   - Be carefull! If you don't give a $where param with an UPDATE
+     *     query, all the records of the table will be updated!
+     *
+     * @param string $table         the table name
+     * @param array  $table_fields  the array of field names
+     * @param int    $mode          a type of query to make:
+     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
+     * @param string $where         for update queries: the WHERE clause to
+     *                               append to the SQL statement.  Don't
+     *                               include the "WHERE" keyword.
+     *
+     * @return string  the sql query for autoPrepare()
+     */
+    function buildManipSQL($table, $table_fields, $mode, $where = false)
+    {
+        if (count($table_fields) == 0) {
+            return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+        $first = true;
+        switch ($mode) {
+            case DB_AUTOQUERY_INSERT:
+                $values = '';
+                $names = '';
+                foreach ($table_fields as $value) {
+                    if ($first) {
+                        $first = false;
+                    } else {
+                        $names .= ',';
+                        $values .= ',';
+                    }
+                    $names .= $value;
+                    $values .= '?';
+                }
+                return "INSERT INTO $table ($names) VALUES ($values)";
+            case DB_AUTOQUERY_UPDATE:
+                $set = '';
+                foreach ($table_fields as $value) {
+                    if ($first) {
+                        $first = false;
+                    } else {
+                        $set .= ',';
+                    }
+                    $set .= "$value = ?";
+                }
+                $sql = "UPDATE $table SET $set";
+                if ($where) {
+                    $sql .= " WHERE $where";
+                }
+                return $sql;
+            default:
+                return $this->raiseError(DB_ERROR_SYNTAX);
+        }
+    }
+
+    // }}}
+    // {{{ execute()
+
+    /**
+     * Executes a DB statement prepared with prepare()
+     *
+     * Example 1.
+     * <code>
+     * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
+     * $data = array(
+     *     "John's text",
+     *     "'it''s good'",
+     *     'filename.txt'
+     * );
+     * $res =& $db->execute($sth, $data);
+     * </code>
+     *
+     * @param resource $stmt  a DB statement resource returned from prepare()
+     * @param mixed    $data  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     *
+     * {@internal ibase and oci8 have their own execute() methods.}}
+     *
+     * @see DB_common::prepare()
+     */
+    function &execute($stmt, $data = array())
+    {
+        $realquery = $this->executeEmulateQuery($stmt, $data);
+        if (DB::isError($realquery)) {
+            return $realquery;
+        }
+        $result = $this->simpleQuery($realquery);
+
+        if ($result === DB_OK || DB::isError($result)) {
+            return $result;
+        } else {
+            $tmp =& new DB_result($this, $result);
+            return $tmp;
+        }
+    }
+
+    // }}}
+    // {{{ executeEmulateQuery()
+
+    /**
+     * Emulates executing prepared statements if the DBMS not support them
+     *
+     * @param resource $stmt  a DB statement resource returned from execute()
+     * @param mixed    $data  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a string containing the real query run when emulating
+     *                 prepare/execute.  A DB_Error object on failure.
+     *
+     * @access protected
+     * @see DB_common::execute()
+     */
+    function executeEmulateQuery($stmt, $data = array())
+    {
+        $stmt = (int)$stmt;
+        $data = (array)$data;
+        $this->last_parameters = $data;
+
+        if (count($this->prepare_types[$stmt]) != count($data)) {
+            $this->last_query = $this->prepared_queries[$stmt];
+            return $this->raiseError(DB_ERROR_MISMATCH);
+        }
+
+        $realquery = $this->prepare_tokens[$stmt][0];
+
+        $i = 0;
+        foreach ($data as $value) {
+            if ($this->prepare_types[$stmt][$i] == DB_PARAM_SCALAR) {
+                $realquery .= $this->quoteSmart($value);
+            } elseif ($this->prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) {
+                $fp = @fopen($value, 'rb');
+                if (!$fp) {
+                    return $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                }
+                $realquery .= $this->quoteSmart(fread($fp, filesize($value)));
+                fclose($fp);
+            } else {
+                $realquery .= $value;
+            }
+
+            $realquery .= $this->prepare_tokens[$stmt][++$i];
+        }
+
+        return $realquery;
+    }
+
+    // }}}
+    // {{{ executeMultiple()
+
+    /**
+     * Performs several execute() calls on the same statement handle
+     *
+     * $data must be an array indexed numerically
+     * from 0, one execute call is done for every "row" in the array.
+     *
+     * If an error occurs during execute(), executeMultiple() does not
+     * execute the unfinished rows, but rather returns that error.
+     *
+     * @param resource $stmt  query handle from prepare()
+     * @param array    $data  numeric array containing the
+     *                         data to insert into the query
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::prepare(), DB_common::execute()
+     */
+    function executeMultiple($stmt, $data)
+    {
+        foreach ($data as $value) {
+            $res =& $this->execute($stmt, $value);
+            if (DB::isError($res)) {
+                return $res;
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freePrepared()
+
+    /**
+     * Frees the internal resources associated with a prepared query
+     *
+     * @param resource $stmt           the prepared statement's PHP resource
+     * @param bool     $free_resource  should the PHP resource be freed too?
+     *                                  Use false if you need to get data
+     *                                  from the result set later.
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_common::prepare()
+     */
+    function freePrepared($stmt, $free_resource = true)
+    {
+        $stmt = (int)$stmt;
+        if (isset($this->prepare_tokens[$stmt])) {
+            unset($this->prepare_tokens[$stmt]);
+            unset($this->prepare_types[$stmt]);
+            unset($this->prepared_queries[$stmt]);
+            return true;
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * It is defined here to ensure all drivers have this method available.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     * @see DB_mysql::modifyQuery(), DB_oci8::modifyQuery(),
+     *      DB_sqlite::modifyQuery()
+     */
+    function modifyQuery($query)
+    {
+        return $query;
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * It is defined here to assure that all implementations
+     * have this method defined.
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        return $query;
+    }
+
+    // }}}
+    // {{{ query()
+
+    /**
+     * Sends a query to the database server
+     *
+     * The query string can be either a normal statement to be sent directly
+     * to the server OR if <var>$params</var> are passed the query can have
+     * placeholders and it will be passed through prepare() and execute().
+     *
+     * @param string $query   the SQL query or the statement to prepare
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_result, DB_common::prepare(), DB_common::execute()
+     */
+    function &query($query, $params = array())
+    {
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+            $ret =& $this->execute($sth, $params);
+            $this->freePrepared($sth, false);
+            return $ret;
+        } else {
+            $this->last_parameters = array();
+            $result = $this->simpleQuery($query);
+            if ($result === DB_OK || DB::isError($result)) {
+                return $result;
+            } else {
+                $tmp =& new DB_result($this, $result);
+                return $tmp;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ limitQuery()
+
+    /**
+     * Generates and executes a LIMIT query
+     *
+     * @param string $query   the query
+     * @param intr   $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     */
+    function &limitQuery($query, $from, $count, $params = array())
+    {
+        $query = $this->modifyLimitQuery($query, $from, $count, $params);
+        if (DB::isError($query)){
+            return $query;
+        }
+        $result =& $this->query($query, $params);
+        if (is_a($result, 'DB_result')) {
+            $result->setOption('limit_from', $from);
+            $result->setOption('limit_count', $count);
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ getOne()
+
+    /**
+     * Fetches the first column of the first row from a query result
+     *
+     * Takes care of doing the query and freeing the results when finished.
+     *
+     * @param string $query   the SQL query
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  the returned value of the query.
+     *                 A DB_Error object on failure.
+     */
+    function &getOne($query, $params = array())
+    {
+        $params = (array)$params;
+        // modifyLimitQuery() would be nice here, but it causes BC issues
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+
+        $err = $res->fetchInto($row, DB_FETCHMODE_ORDERED);
+        $res->free();
+
+        if ($err !== DB_OK) {
+            return $err;
+        }
+
+        return $row[0];
+    }
+
+    // }}}
+    // {{{ getRow()
+
+    /**
+     * Fetches the first row of data returned from a query result
+     *
+     * Takes care of doing the query and freeing the results when finished.
+     *
+     * @param string $query   the SQL query
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     * @param int $fetchmode  the fetch mode to use
+     *
+     * @return array  the first row of results as an array.
+     *                 A DB_Error object on failure.
+     */
+    function &getRow($query, $params = array(),
+                     $fetchmode = DB_FETCHMODE_DEFAULT)
+    {
+        // compat check, the params and fetchmode parameters used to
+        // have the opposite order
+        if (!is_array($params)) {
+            if (is_array($fetchmode)) {
+                if ($params === null) {
+                    $tmp = DB_FETCHMODE_DEFAULT;
+                } else {
+                    $tmp = $params;
+                }
+                $params = $fetchmode;
+                $fetchmode = $tmp;
+            } elseif ($params !== null) {
+                $fetchmode = $params;
+                $params = array();
+            }
+        }
+        // modifyLimitQuery() would be nice here, but it causes BC issues
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+
+        $err = $res->fetchInto($row, $fetchmode);
+
+        $res->free();
+
+        if ($err !== DB_OK) {
+            return $err;
+        }
+
+        return $row;
+    }
+
+    // }}}
+    // {{{ getCol()
+
+    /**
+     * Fetches a single column from a query result and returns it as an
+     * indexed array
+     *
+     * @param string $query   the SQL query
+     * @param mixed  $col     which column to return (integer [column number,
+     *                         starting at 0] or string [column name])
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return array  the results as an array.  A DB_Error object on failure.
+     *
+     * @see DB_common::query()
+     */
+    function &getCol($query, $col = 0, $params = array())
+    {
+        $params = (array)$params;
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+
+        $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC;
+
+        if (!is_array($row = $res->fetchRow($fetchmode))) {
+            $ret = array();
+        } else {
+            if (!array_key_exists($col, $row)) {
+                $ret =& $this->raiseError(DB_ERROR_NOSUCHFIELD);
+            } else {
+                $ret = array($row[$col]);
+                while (is_array($row = $res->fetchRow($fetchmode))) {
+                    $ret[] = $row[$col];
+                }
+            }
+        }
+
+        $res->free();
+
+        if (DB::isError($row)) {
+            $ret = $row;
+        }
+
+        return $ret;
+    }
+
+    // }}}
+    // {{{ getAssoc()
+
+    /**
+     * Fetches an entire query result and returns it as an
+     * associative array using the first column as the key
+     *
+     * If the result set contains more than two columns, the value
+     * will be an array of the values from column 2-n.  If the result
+     * set contains only two columns, the returned value will be a
+     * scalar with the value of the second column (unless forced to an
+     * array with the $force_array parameter).  A DB error code is
+     * returned on errors.  If the result set contains fewer than two
+     * columns, a DB_ERROR_TRUNCATED error is returned.
+     *
+     * For example, if the table "mytable" contains:
+     *
+     * <pre>
+     *  ID      TEXT       DATE
+     * --------------------------------
+     *  1       'one'      944679408
+     *  2       'two'      944679408
+     *  3       'three'    944679408
+     * </pre>
+     *
+     * Then the call getAssoc('SELECT id,text FROM mytable') returns:
+     * <pre>
+     *   array(
+     *     '1' => 'one',
+     *     '2' => 'two',
+     *     '3' => 'three',
+     *   )
+     * </pre>
+     *
+     * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
+     * <pre>
+     *   array(
+     *     '1' => array('one', '944679408'),
+     *     '2' => array('two', '944679408'),
+     *     '3' => array('three', '944679408')
+     *   )
+     * </pre>
+     *
+     * If the more than one row occurs with the same value in the
+     * first column, the last row overwrites all previous ones by
+     * default.  Use the $group parameter if you don't want to
+     * overwrite like this.  Example:
+     *
+     * <pre>
+     * getAssoc('SELECT category,id,name FROM mytable', false, null,
+     *          DB_FETCHMODE_ASSOC, true) returns:
+     *
+     *   array(
+     *     '1' => array(array('id' => '4', 'name' => 'number four'),
+     *                  array('id' => '6', 'name' => 'number six')
+     *            ),
+     *     '9' => array(array('id' => '4', 'name' => 'number four'),
+     *                  array('id' => '6', 'name' => 'number six')
+     *            )
+     *   )
+     * </pre>
+     *
+     * Keep in mind that database functions in PHP usually return string
+     * values for results regardless of the database's internal type.
+     *
+     * @param string $query        the SQL query
+     * @param bool   $force_array  used only when the query returns
+     *                              exactly two columns.  If true, the values
+     *                              of the returned array will be one-element
+     *                              arrays instead of scalars.
+     * @param mixed  $params       array, string or numeric data to be used in
+     *                              execution of the statement.  Quantity of
+     *                              items passed must match quantity of
+     *                              placeholders in query:  meaning 1
+     *                              placeholder for non-array parameters or
+     *                              1 placeholder per array element.
+     * @param int   $fetchmode     the fetch mode to use
+     * @param bool  $group         if true, the values of the returned array
+     *                              is wrapped in another array.  If the same
+     *                              key value (in the first column) repeats
+     *                              itself, the values will be appended to
+     *                              this array instead of overwriting the
+     *                              existing values.
+     *
+     * @return array  the associative array containing the query results.
+     *                A DB_Error object on failure.
+     */
+    function &getAssoc($query, $force_array = false, $params = array(),
+                       $fetchmode = DB_FETCHMODE_DEFAULT, $group = false)
+    {
+        $params = (array)$params;
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+        if ($fetchmode == DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->fetchmode;
+        }
+        $cols = $res->numCols();
+
+        if ($cols < 2) {
+            $tmp =& $this->raiseError(DB_ERROR_TRUNCATED);
+            return $tmp;
+        }
+
+        $results = array();
+
+        if ($cols > 2 || $force_array) {
+            // return array values
+            // XXX this part can be optimized
+            if ($fetchmode == DB_FETCHMODE_ASSOC) {
+                while (is_array($row = $res->fetchRow(DB_FETCHMODE_ASSOC))) {
+                    reset($row);
+                    $key = current($row);
+                    unset($row[key($row)]);
+                    if ($group) {
+                        $results[$key][] = $row;
+                    } else {
+                        $results[$key] = $row;
+                    }
+                }
+            } elseif ($fetchmode == DB_FETCHMODE_OBJECT) {
+                while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
+                    $arr = get_object_vars($row);
+                    $key = current($arr);
+                    if ($group) {
+                        $results[$key][] = $row;
+                    } else {
+                        $results[$key] = $row;
+                    }
+                }
+            } else {
+                while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
+                    // we shift away the first element to get
+                    // indices running from 0 again
+                    $key = array_shift($row);
+                    if ($group) {
+                        $results[$key][] = $row;
+                    } else {
+                        $results[$key] = $row;
+                    }
+                }
+            }
+            if (DB::isError($row)) {
+                $results = $row;
+            }
+        } else {
+            // return scalar values
+            while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
+                if ($group) {
+                    $results[$row[0]][] = $row[1];
+                } else {
+                    $results[$row[0]] = $row[1];
+                }
+            }
+            if (DB::isError($row)) {
+                $results = $row;
+            }
+        }
+
+        $res->free();
+
+        return $results;
+    }
+
+    // }}}
+    // {{{ getAll()
+
+    /**
+     * Fetches all of the rows from a query result
+     *
+     * @param string $query      the SQL query
+     * @param mixed  $params     array, string or numeric data to be used in
+     *                            execution of the statement.  Quantity of
+     *                            items passed must match quantity of
+     *                            placeholders in query:  meaning 1
+     *                            placeholder for non-array parameters or
+     *                            1 placeholder per array element.
+     * @param int    $fetchmode  the fetch mode to use:
+     *                            + DB_FETCHMODE_ORDERED
+     *                            + DB_FETCHMODE_ASSOC
+     *                            + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
+     *                            + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED
+     *
+     * @return array  the nested array.  A DB_Error object on failure.
+     */
+    function &getAll($query, $params = array(),
+                     $fetchmode = DB_FETCHMODE_DEFAULT)
+    {
+        // compat check, the params and fetchmode parameters used to
+        // have the opposite order
+        if (!is_array($params)) {
+            if (is_array($fetchmode)) {
+                if ($params === null) {
+                    $tmp = DB_FETCHMODE_DEFAULT;
+                } else {
+                    $tmp = $params;
+                }
+                $params = $fetchmode;
+                $fetchmode = $tmp;
+            } elseif ($params !== null) {
+                $fetchmode = $params;
+                $params = array();
+            }
+        }
+
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if ($res === DB_OK || DB::isError($res)) {
+            return $res;
+        }
+
+        $results = array();
+        while (DB_OK === $res->fetchInto($row, $fetchmode)) {
+            if ($fetchmode & DB_FETCHMODE_FLIPPED) {
+                foreach ($row as $key => $val) {
+                    $results[$key][] = $val;
+                }
+            } else {
+                $results[] = $row;
+            }
+        }
+
+        $res->free();
+
+        if (DB::isError($row)) {
+            $tmp =& $this->raiseError($row);
+            return $tmp;
+        }
+        return $results;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Determines the number of rows in a query result
+     *
+     * @param resource $result  the query result idenifier produced by PHP
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function numRows($result)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ getSequenceName()
+
+    /**
+     * Generates the name used inside the database for a sequence
+     *
+     * The createSequence() docblock contains notes about storing sequence
+     * names.
+     *
+     * @param string $sqn  the sequence's public name
+     *
+     * @return string  the sequence's name in the backend
+     *
+     * @access protected
+     * @see DB_common::createSequence(), DB_common::dropSequence(),
+     *      DB_common::nextID(), DB_common::setOption()
+     */
+    function getSequenceName($sqn)
+    {
+        return sprintf($this->getOption('seqname_format'),
+                       preg_replace('/[^a-z0-9_.]/i', '_', $sqn));
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::dropSequence(),
+     *      DB_common::getSequenceName()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * The name of a given sequence is determined by passing the string
+     * provided in the <var>$seq_name</var> argument through PHP's sprintf()
+     * function using the value from the <var>seqname_format</var> option as
+     * the sprintf()'s format argument.
+     *
+     * <var>seqname_format</var> is set via setOption().
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_common::nextID()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_common::nextID()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ raiseError()
+
+    /**
+     * Communicates an error and invoke error callbacks, etc
+     *
+     * Basically a wrapper for PEAR::raiseError without the message string.
+     *
+     * @param mixed   integer error code, or a PEAR error object (all
+     *                 other parameters are ignored if this parameter is
+     *                 an object
+     * @param int     error mode, see PEAR_Error docs
+     * @param mixed   if error mode is PEAR_ERROR_TRIGGER, this is the
+     *                 error level (E_USER_NOTICE etc).  If error mode is
+     *                 PEAR_ERROR_CALLBACK, this is the callback function,
+     *                 either as a function name, or as an array of an
+     *                 object and method name.  For other error modes this
+     *                 parameter is ignored.
+     * @param string  extra debug information.  Defaults to the last
+     *                 query and native error code.
+     * @param mixed   native error code, integer or string depending the
+     *                 backend
+     *
+     * @return object  the PEAR_Error object
+     *
+     * @see PEAR_Error
+     */
+    function &raiseError($code = DB_ERROR, $mode = null, $options = null,
+                         $userinfo = null, $nativecode = null)
+    {
+        // The error is yet a DB error object
+        if (is_object($code)) {
+            // because we the static PEAR::raiseError, our global
+            // handler should be used if it is set
+            if ($mode === null && !empty($this->_default_error_mode)) {
+                $mode    = $this->_default_error_mode;
+                $options = $this->_default_error_options;
+            }
+            $tmp = PEAR::raiseError($code, null, $mode, $options,
+                                    null, null, true);
+            return $tmp;
+        }
+
+        if ($userinfo === null) {
+            $userinfo = $this->last_query;
+        }
+
+        if ($nativecode) {
+            $userinfo .= ' [nativecode=' . trim($nativecode) . ']';
+        } else {
+            $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';
+        }
+
+        $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo,
+                                'DB_Error', true);
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return mixed  the DBMS' error code.  A DB_Error object on failure.
+     */
+    function errorNative()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Maps native error codes to DB's portable ones
+     *
+     * Uses the <var>$errorcode_map</var> property defined in each driver.
+     *
+     * @param string|int $nativecode  the error code returned by the DBMS
+     *
+     * @return int  the portable DB error code.  Return DB_ERROR if the
+     *               current driver doesn't have a mapping for the
+     *               $nativecode submitted.
+     */
+    function errorCode($nativecode)
+    {
+        if (isset($this->errorcode_map[$nativecode])) {
+            return $this->errorcode_map[$nativecode];
+        }
+        // Fall back to DB_ERROR if there was no mapping.
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ errorMessage()
+
+    /**
+     * Maps a DB error code to a textual message
+     *
+     * @param integer $dbcode  the DB error code
+     *
+     * @return string  the error message corresponding to the error code
+     *                  submitted.  FALSE if the error code is unknown.
+     *
+     * @see DB::errorMessage()
+     */
+    function errorMessage($dbcode)
+    {
+        return DB::errorMessage($this->errorcode_map[$dbcode]);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * The format of the resulting array depends on which <var>$mode</var>
+     * you select.  The sample output below is based on this query:
+     * <pre>
+     *    SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
+     *    FROM tblFoo
+     *    JOIN tblBar ON tblFoo.fldId = tblBar.fldId
+     * </pre>
+     *
+     * <ul>
+     * <li>
+     *
+     * <kbd>null</kbd> (default)
+     *   <pre>
+     *   [0] => Array (
+     *       [table] => tblFoo
+     *       [name] => fldId
+     *       [type] => int
+     *       [len] => 11
+     *       [flags] => primary_key not_null
+     *   )
+     *   [1] => Array (
+     *       [table] => tblFoo
+     *       [name] => fldPhone
+     *       [type] => string
+     *       [len] => 20
+     *       [flags] =>
+     *   )
+     *   [2] => Array (
+     *       [table] => tblBar
+     *       [name] => fldId
+     *       [type] => int
+     *       [len] => 11
+     *       [flags] => primary_key not_null
+     *   )
+     *   </pre>
+     *
+     * </li><li>
+     *
+     * <kbd>DB_TABLEINFO_ORDER</kbd>
+     *
+     *   <p>In addition to the information found in the default output,
+     *   a notation of the number of columns is provided by the
+     *   <samp>num_fields</samp> element while the <samp>order</samp>
+     *   element provides an array with the column names as the keys and
+     *   their location index number (corresponding to the keys in the
+     *   the default output) as the values.</p>
+     *
+     *   <p>If a result set has identical field names, the last one is
+     *   used.</p>
+     *
+     *   <pre>
+     *   [num_fields] => 3
+     *   [order] => Array (
+     *       [fldId] => 2
+     *       [fldTrans] => 1
+     *   )
+     *   </pre>
+     *
+     * </li><li>
+     *
+     * <kbd>DB_TABLEINFO_ORDERTABLE</kbd>
+     *
+     *   <p>Similar to <kbd>DB_TABLEINFO_ORDER</kbd> but adds more
+     *   dimensions to the array in which the table names are keys and
+     *   the field names are sub-keys.  This is helpful for queries that
+     *   join tables which have identical field names.</p>
+     *
+     *   <pre>
+     *   [num_fields] => 3
+     *   [ordertable] => Array (
+     *       [tblFoo] => Array (
+     *           [fldId] => 0
+     *           [fldPhone] => 1
+     *       )
+     *       [tblBar] => Array (
+     *           [fldId] => 2
+     *       )
+     *   )
+     *   </pre>
+     *
+     * </li>
+     * </ul>
+     *
+     * The <samp>flags</samp> element contains a space separated list
+     * of extra information about the field.  This data is inconsistent
+     * between DBMS's due to the way each DBMS works.
+     *   + <samp>primary_key</samp>
+     *   + <samp>unique_key</samp>
+     *   + <samp>multiple_key</samp>
+     *   + <samp>not_null</samp>
+     *
+     * Most DBMS's only provide the <samp>table</samp> and <samp>flags</samp>
+     * elements if <var>$result</var> is a table name.  The following DBMS's
+     * provide full information from queries:
+     *   + fbsql
+     *   + mysql
+     *
+     * If the 'portability' option has <samp>DB_PORTABILITY_LOWERCASE</samp>
+     * turned on, the names of tables and fields will be lowercased.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                string containing the name of a table.
+     *                                While this also accepts a query result
+     *                                resource identifier, this behavior is
+     *                                deprecated.
+     * @param int  $mode   either unused or one of the tableInfo modes:
+     *                     <kbd>DB_TABLEINFO_ORDERTABLE</kbd>,
+     *                     <kbd>DB_TABLEINFO_ORDER</kbd> or
+     *                     <kbd>DB_TABLEINFO_FULL</kbd> (which does both).
+     *                     These are bitwise, so the first two can be
+     *                     combined using <kbd>|</kbd>.
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        /*
+         * If the DB_<driver> class has a tableInfo() method, that one
+         * overrides this one.  But, if the driver doesn't have one,
+         * this method runs and tells users about that fact.
+         */
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ getTables()
+
+    /**
+     * Lists the tables in the current database
+     *
+     * @return array  the list of tables.  A DB_Error object on failure.
+     *
+     * @deprecated Method deprecated some time before Release 1.2
+     */
+    function getTables()
+    {
+        return $this->getListOf('tables');
+    }
+
+    // }}}
+    // {{{ getListOf()
+
+    /**
+     * Lists internal database information
+     *
+     * @param string $type  type of information being sought.
+     *                       Common items being sought are:
+     *                       tables, databases, users, views, functions
+     *                       Each DBMS's has its own capabilities.
+     *
+     * @return array  an array listing the items sought.
+     *                 A DB DB_Error object on failure.
+     */
+    function getListOf($type)
+    {
+        $sql = $this->getSpecialQuery($type);
+        if ($sql === null) {
+            $this->last_query = '';
+            return $this->raiseError(DB_ERROR_UNSUPPORTED);
+        } elseif (is_int($sql) || DB::isError($sql)) {
+            // Previous error
+            return $this->raiseError($sql);
+        } elseif (is_array($sql)) {
+            // Already the result
+            return $sql;
+        }
+        // Launch this query
+        return $this->getCol($sql);
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        return $this->raiseError(DB_ERROR_UNSUPPORTED);
+    }
+
+    // }}}
+    // {{{ _rtrimArrayValues()
+
+    /**
+     * Right-trims all strings in an array
+     *
+     * @param array $array  the array to be trimmed (passed by reference)
+     *
+     * @return void
+     *
+     * @access protected
+     */
+    function _rtrimArrayValues(&$array)
+    {
+        foreach ($array as $key => $value) {
+            if (is_string($value)) {
+                $array[$key] = rtrim($value);
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _convertNullArrayValuesToEmpty()
+
+    /**
+     * Converts all null values in an array to empty strings
+     *
+     * @param array  $array  the array to be de-nullified (passed by reference)
+     *
+     * @return void
+     *
+     * @access protected
+     */
+    function _convertNullArrayValuesToEmpty(&$array)
+    {
+        foreach ($array as $key => $value) {
+            if (is_null($value)) {
+                $array[$key] = '';
+            }
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/msql.php
===================================================================
--- /temp/trunk/data/module/DB/msql.php	(revision 1328)
+++ /temp/trunk/data/module/DB/msql.php	(revision 1328)
@@ -0,0 +1,810 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's msql extension
+ * for interacting with Mini SQL databases
+ *
+ * PHP's mSQL extension did weird things with NULL values prior to PHP
+ * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
+ * those versions.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's msql extension
+ * for interacting with Mini SQL databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * PHP's mSQL extension did weird things with NULL values prior to PHP
+ * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
+ * those versions.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class not functional until Release 1.7.0
+ */
+class DB_msql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'msql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'msql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * The query result resource created by PHP
+     *
+     * Used to make affectedRows() work.  Only contains the result for
+     * data manipulation queries.  Contains false for other queries.
+     *
+     * @var resource
+     * @access private
+     */
+    var $_result;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_msql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * Example of how to connect:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * // $dsn = 'msql://hostname/dbname';  // use a TCP connection
+     * $dsn = 'msql:///dbname';             // use a socket
+     * $options = array(
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('msql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array();
+        if ($dsn['hostspec']) {
+            $params[] = $dsn['port']
+                        ? $dsn['hostspec'] . ',' . $dsn['port']
+                        : $dsn['hostspec'];
+        }
+
+        $connect_function = $persistent ? 'msql_pconnect' : 'msql_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            if (($err = @msql_error()) != '') {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $err);
+            } else {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+
+        if (!@msql_select_db($dsn['database'], $this->connection)) {
+            return $this->msqlRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @msql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @msql_query($query, $this->connection);
+        if (!$result) {
+            return $this->msqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if (DB::isManip($query)) {
+            $this->_result = $result;
+            return DB_OK;
+        } else {
+            $this->_result = false;
+            return $result;
+        }
+    }
+
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal msql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * PHP's mSQL extension did weird things with NULL values prior to PHP
+     * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
+     * those versions.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@msql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @msql_fetch_array($result, MSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @msql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @msql_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @msql_num_fields($result);
+        if (!$cols) {
+            return $this->msqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @msql_num_rows($result);
+        if ($rows === false) {
+            return $this->msqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affected()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (!$this->_result) {
+            return 0;
+        }
+        return msql_affected_rows($this->_result);
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_msql::createSequence(), DB_msql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = false;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result =& $this->query("SELECT _seq FROM ${seqname}");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = true;
+                $this->pushErrorHandling(PEAR_ERROR_RETURN);
+                $result = $this->createSequence($seq_name);
+                $this->popErrorHandling();
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        $result->free();
+        return $arr[0];
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * Also creates a new table to associate the sequence with.  Uses
+     * a separate table to ensure portability with other drivers.
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_msql::nextID(), DB_msql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER NOT NULL)');
+        if (DB::isError($res)) {
+            return $res;
+        }
+        $res = $this->query("CREATE SEQUENCE ON ${seqname}");
+        return $res;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_msql::nextID(), DB_msql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * mSQL does not support delimited identifiers
+     *
+     * @param string $str  the identifier name to be quoted
+     *
+     * @return object  a DB_Error object
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.7.0
+     */
+    function quoteIdentifier($str)
+    {
+        return $this->raiseError(DB_ERROR_UNSUPPORTED);
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.7.0
+     */
+    function escapeSimple($str)
+    {
+        return addslashes($str);
+    }
+
+    // }}}
+    // {{{ msqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_msql::errorNative(), DB_msql::errorCode()
+     */
+    function msqlRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+        return $this->raiseError($errno, null, null, null, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return @msql_error();
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message
+     *
+     * @param string $errormsg  the error message returned from the database
+     *
+     * @return integer  the error number from a DB_ERROR* constant
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/^Access to database denied/i'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^Bad index name/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/^Bad order field/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Bad type for comparison/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Can\'t perform LIKE on/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Can\'t use TEXT fields in LIKE comparison/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Couldn\'t create temporary table/i'
+                    => DB_ERROR_CANNOT_CREATE,
+                '/^Error creating table file/i'
+                    => DB_ERROR_CANNOT_CREATE,
+                '/^Field .* cannot be null$/i'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/^Index (field|condition) .* cannot be null$/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Invalid date format/i'
+                    => DB_ERROR_INVALID_DATE,
+                '/^Invalid time format/i'
+                    => DB_ERROR_INVALID,
+                '/^Literal value for .* is wrong type$/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/^No Database Selected/i'
+                    => DB_ERROR_NODBSELECTED,
+                '/^No value specified for field/i'
+                    => DB_ERROR_VALUE_COUNT_ON_ROW,
+                '/^Non unique value for unique index/i'
+                    => DB_ERROR_CONSTRAINT,
+                '/^Out of memory for temporary table/i'
+                    => DB_ERROR_CANNOT_CREATE,
+                '/^Permission denied/i'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^Reference to un-selected table/i'
+                    => DB_ERROR_SYNTAX,
+                '/^syntax error/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Table .* exists$/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/^Unknown database/i'
+                    => DB_ERROR_NOSUCHDB,
+                '/^Unknown field/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/^Unknown (index|system variable)/i'
+                    => DB_ERROR_NOT_FOUND,
+                '/^Unknown table/i'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/^Unqualified field/i'
+                    => DB_ERROR_SYNTAX,
+            );
+        }
+
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @msql_query("SELECT * FROM $result",
+                              $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @msql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $tmp = @msql_fetch_field($id);
+
+            $flags = '';
+            if ($tmp->not_null) {
+                $flags .= 'not_null ';
+            }
+            if ($tmp->unique) {
+                $flags .= 'unique_key ';
+            }
+            $flags = trim($flags);
+
+            $res[$i] = array(
+                'table' => $case_func($tmp->table),
+                'name'  => $case_func($tmp->name),
+                'type'  => $tmp->type,
+                'len'   => msql_field_len($id, $i),
+                'flags' => $flags,
+            );
+
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @msql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtain a list of a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return array  the array containing the list of objects requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'databases':
+                $id = @msql_list_dbs($this->connection);
+                break;
+            case 'tables':
+                $id = @msql_list_tables($this->dsn['database'],
+                                        $this->connection);
+                break;
+            default:
+                return null;
+        }
+        if (!$id) {
+            return $this->msqlRaiseError();
+        }
+        $out = array();
+        while ($row = @msql_fetch_row($id)) {
+            $out[] = $row[0];
+        }
+        return $out;
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/dbase.php
===================================================================
--- /temp/trunk/data/module/DB/dbase.php	(revision 1328)
+++ /temp/trunk/data/module/DB/dbase.php	(revision 1328)
@@ -0,0 +1,510 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's dbase extension
+ * for interacting with dBase databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's dbase extension
+ * for interacting with dBase databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_dbase extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'dbase';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'dbase';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => false,
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => false,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * A means of emulating result resources
+     * @var array
+     */
+    var $res_row = array();
+
+    /**
+     * The quantity of results so far
+     *
+     * For emulating result resources.
+     *
+     * @var integer
+     */
+    var $result = 0;
+
+    /**
+     * Maps dbase data type id's to human readable strings
+     *
+     * The human readable values are based on the output of PHP's
+     * dbase_get_header_info() function.
+     *
+     * @var array
+     * @since Property available since Release 1.7.0
+     */
+    var $types = array(
+        'C' => 'character',
+        'D' => 'date',
+        'L' => 'boolean',
+        'M' => 'memo',
+        'N' => 'number',
+    );
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_dbase()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database and create it if it doesn't exist
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's dbase driver supports the following extra DSN options:
+     *   + mode    An integer specifying the read/write mode to use
+     *              (0 = read only, 1 = write only, 2 = read/write).
+     *              Available since PEAR DB 1.7.0.
+     *   + fields  An array of arrays that PHP's dbase_create() function needs
+     *              to create a new database.  This information is used if the
+     *              dBase file specified in the "database" segment of the DSN
+     *              does not exist.  For more info, see the PHP manual's
+     *              {@link http://php.net/dbase_create dbase_create()} page.
+     *              Available since PEAR DB 1.7.0.
+     *
+     * Example of how to connect and establish a new dBase file if necessary:
+     * <code>
+     * require_once 'DB.php';
+     *
+     * $dsn = array(
+     *     'phptype'  => 'dbase',
+     *     'database' => '/path/and/name/of/dbase/file',
+     *     'mode'     => 2,
+     *     'fields'   => array(
+     *         array('a', 'N', 5, 0),
+     *         array('b', 'C', 40),
+     *         array('c', 'C', 255),
+     *         array('d', 'C', 20),
+     *     ),
+     * );
+     * $options = array(
+     *     'debug'       => 2,
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     *
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('dbase')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        /*
+         * Turn track_errors on for entire script since $php_errormsg
+         * is the only way to find errors from the dbase extension.
+         */
+        ini_set('track_errors', 1);
+        $php_errormsg = '';
+
+        if (!file_exists($dsn['database'])) {
+            $this->dsn['mode'] = 2;
+            if (empty($dsn['fields']) || !is_array($dsn['fields'])) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         'the dbase file does not exist and '
+                                         . 'it could not be created because '
+                                         . 'the "fields" element of the DSN '
+                                         . 'is not properly set');
+            }
+            $this->connection = @dbase_create($dsn['database'],
+                                              $dsn['fields']);
+            if (!$this->connection) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         'the dbase file does not exist and '
+                                         . 'the attempt to create it failed: '
+                                         . $php_errormsg);
+            }
+        } else {
+            if (!isset($this->dsn['mode'])) {
+                $this->dsn['mode'] = 0;
+            }
+            $this->connection = @dbase_open($dsn['database'],
+                                            $this->dsn['mode']);
+            if (!$this->connection) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @dbase_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ &query()
+
+    function &query($query = null)
+    {
+        // emulate result resources
+        $this->res_row[(int)$this->result] = 0;
+        $tmp =& new DB_result($this, $this->result++);
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum === null) {
+            $rownum = $this->res_row[(int)$result]++;
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @dbase_get_record_with_names($this->connection, $rownum);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @dbase_get_record($this->connection, $rownum);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($foo)
+    {
+        return @dbase_numfields($this->connection);
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($foo)
+    {
+        return @dbase_numrecords($this->connection);
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     *                 + null = the string <samp>NULL</samp>
+     *                 + boolean = <samp>T</samp> if true or
+     *                   <samp>F</samp> if false.  Use the <kbd>Logical</kbd>
+     *                   data type.
+     *                 + integer or double = the unquoted number
+     *                 + other (including strings and numeric strings) =
+     *                   the data with single quotes escaped by preceeding
+     *                   single quotes then the whole string is encapsulated
+     *                   between single quotes
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 'T' : 'F';
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about the current database
+     *
+     * @param mixed $result  THIS IS UNUSED IN DBASE.  The current database
+     *                       is examined regardless of what is provided here.
+     * @param int   $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.7.0
+     */
+    function tableInfo($result = null, $mode = null)
+    {
+        if (function_exists('dbase_get_header_info')) {
+            $id = @dbase_get_header_info($this->connection);
+            if (!$id && $php_errormsg) {
+                return $this->raiseError(DB_ERROR,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        } else {
+            /*
+             * This segment for PHP 4 is loosely based on code by
+             * Hadi Rusiah <deegos@yahoo.com> in the comments on
+             * the dBase reference page in the PHP manual.
+             */
+            $db = @fopen($this->dsn['database'], 'r');
+            if (!$db) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+
+            $id = array();
+            $i  = 0;
+
+            $line = fread($db, 32);
+            while (!feof($db)) {
+                $line = fread($db, 32);
+                if (substr($line, 0, 1) == chr(13)) {
+                    break;
+                } else {
+                    $pos = strpos(substr($line, 0, 10), chr(0));
+                    $pos = ($pos == 0 ? 10 : $pos);
+                    $id[$i] = array(
+                        'name'   => substr($line, 0, $pos),
+                        'type'   => $this->types[substr($line, 11, 1)],
+                        'length' => ord(substr($line, 16, 1)),
+                        'precision' => ord(substr($line, 17, 1)),
+                    );
+                }
+                $i++;
+            }
+
+            fclose($db);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $res   = array();
+        $count = count($id);
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $this->dsn['database'],
+                'name'  => $case_func($id[$i]['name']),
+                'type'  => $id[$i]['type'],
+                'len'   => $id[$i]['length'],
+                'flags' => ''
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        return $res;
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/mysqli.php
===================================================================
--- /temp/trunk/data/module/DB/mysqli.php	(revision 1328)
+++ /temp/trunk/data/module/DB/mysqli.php	(revision 1328)
@@ -0,0 +1,1076 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's mysqli extension
+ * for interacting with MySQL databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's mysqli extension
+ * for interacting with MySQL databases
+ *
+ * This is for MySQL versions 4.1 and above.  Requires PHP 5.
+ *
+ * Note that persistent connections no longer exist.
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class functional since Release 1.6.3
+ */
+class DB_mysqli extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'mysqli';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'mysqli';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => false,
+        'prepare'       => false,
+        'ssl'           => true,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        1004 => DB_ERROR_CANNOT_CREATE,
+        1005 => DB_ERROR_CANNOT_CREATE,
+        1006 => DB_ERROR_CANNOT_CREATE,
+        1007 => DB_ERROR_ALREADY_EXISTS,
+        1008 => DB_ERROR_CANNOT_DROP,
+        1022 => DB_ERROR_ALREADY_EXISTS,
+        1044 => DB_ERROR_ACCESS_VIOLATION,
+        1046 => DB_ERROR_NODBSELECTED,
+        1048 => DB_ERROR_CONSTRAINT,
+        1049 => DB_ERROR_NOSUCHDB,
+        1050 => DB_ERROR_ALREADY_EXISTS,
+        1051 => DB_ERROR_NOSUCHTABLE,
+        1054 => DB_ERROR_NOSUCHFIELD,
+        1061 => DB_ERROR_ALREADY_EXISTS,
+        1062 => DB_ERROR_ALREADY_EXISTS,
+        1064 => DB_ERROR_SYNTAX,
+        1091 => DB_ERROR_NOT_FOUND,
+        1100 => DB_ERROR_NOT_LOCKED,
+        1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        1142 => DB_ERROR_ACCESS_VIOLATION,
+        1146 => DB_ERROR_NOSUCHTABLE,
+        1216 => DB_ERROR_CONSTRAINT,
+        1217 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = '';
+
+    /**
+     * Array for converting MYSQLI_*_FLAG constants to text values
+     * @var    array
+     * @access public
+     * @since  Property available since Release 1.6.5
+     */
+    var $mysqli_flags = array(
+        MYSQLI_NOT_NULL_FLAG        => 'not_null',
+        MYSQLI_PRI_KEY_FLAG         => 'primary_key',
+        MYSQLI_UNIQUE_KEY_FLAG      => 'unique_key',
+        MYSQLI_MULTIPLE_KEY_FLAG    => 'multiple_key',
+        MYSQLI_BLOB_FLAG            => 'blob',
+        MYSQLI_UNSIGNED_FLAG        => 'unsigned',
+        MYSQLI_ZEROFILL_FLAG        => 'zerofill',
+        MYSQLI_AUTO_INCREMENT_FLAG  => 'auto_increment',
+        MYSQLI_TIMESTAMP_FLAG       => 'timestamp',
+        MYSQLI_SET_FLAG             => 'set',
+        // MYSQLI_NUM_FLAG             => 'numeric',  // unnecessary
+        // MYSQLI_PART_KEY_FLAG        => 'multiple_key',  // duplicatvie
+        MYSQLI_GROUP_FLAG           => 'group_by'
+    );
+
+    /**
+     * Array for converting MYSQLI_TYPE_* constants to text values
+     * @var    array
+     * @access public
+     * @since  Property available since Release 1.6.5
+     */
+    var $mysqli_types = array(
+        MYSQLI_TYPE_DECIMAL     => 'decimal',
+        MYSQLI_TYPE_TINY        => 'tinyint',
+        MYSQLI_TYPE_SHORT       => 'int',
+        MYSQLI_TYPE_LONG        => 'int',
+        MYSQLI_TYPE_FLOAT       => 'float',
+        MYSQLI_TYPE_DOUBLE      => 'double',
+        // MYSQLI_TYPE_NULL        => 'DEFAULT NULL',  // let flags handle it
+        MYSQLI_TYPE_TIMESTAMP   => 'timestamp',
+        MYSQLI_TYPE_LONGLONG    => 'bigint',
+        MYSQLI_TYPE_INT24       => 'mediumint',
+        MYSQLI_TYPE_DATE        => 'date',
+        MYSQLI_TYPE_TIME        => 'time',
+        MYSQLI_TYPE_DATETIME    => 'datetime',
+        MYSQLI_TYPE_YEAR        => 'year',
+        MYSQLI_TYPE_NEWDATE     => 'date',
+        MYSQLI_TYPE_ENUM        => 'enum',
+        MYSQLI_TYPE_SET         => 'set',
+        MYSQLI_TYPE_TINY_BLOB   => 'tinyblob',
+        MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
+        MYSQLI_TYPE_LONG_BLOB   => 'longblob',
+        MYSQLI_TYPE_BLOB        => 'blob',
+        MYSQLI_TYPE_VAR_STRING  => 'varchar',
+        MYSQLI_TYPE_STRING      => 'char',
+        MYSQLI_TYPE_GEOMETRY    => 'geometry',
+    );
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_mysqli()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's mysqli driver supports the following extra DSN options:
+     *   + When the 'ssl' $option passed to DB::connect() is true:
+     *     + key      The path to the key file.
+     *     + cert     The path to the certificate file.
+     *     + ca       The path to the certificate authority file.
+     *     + capath   The path to a directory that contains trusted SSL
+     *                 CA certificates in pem format.
+     *     + cipher   The list of allowable ciphers for SSL encryption.
+     *
+     * Example of how to connect using SSL:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * $dsn = array(
+     *     'phptype'  => 'mysqli',
+     *     'username' => 'someuser',
+     *     'password' => 'apasswd',
+     *     'hostspec' => 'localhost',
+     *     'database' => 'thedb',
+     *     'key'      => 'client-key.pem',
+     *     'cert'     => 'client-cert.pem',
+     *     'ca'       => 'cacert.pem',
+     *     'capath'   => '/path/to/ca/dir',
+     *     'cipher'   => 'AES',
+     * );
+     * 
+     * $options = array(
+     *     'ssl' => true,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('mysqli')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $ini = ini_get('track_errors');
+        ini_set('track_errors', 1);
+        $php_errormsg = '';
+
+        if ($this->getOption('ssl') === true) {
+            $init = mysqli_init();
+            mysqli_ssl_set(
+                $init,
+                empty($dsn['key'])    ? null : $dsn['key'],
+                empty($dsn['cert'])   ? null : $dsn['cert'],
+                empty($dsn['ca'])     ? null : $dsn['ca'],
+                empty($dsn['capath']) ? null : $dsn['capath'],
+                empty($dsn['cipher']) ? null : $dsn['cipher']
+            );
+            if ($this->connection = @mysqli_real_connect(
+                    $init,
+                    $dsn['hostspec'],
+                    $dsn['username'],
+                    $dsn['password'],
+                    $dsn['database'],
+                    $dsn['port'],
+                    $dsn['socket']))
+            {
+                $this->connection = $init;
+            }
+        } else {
+            $this->connection = @mysqli_connect(
+                $dsn['hostspec'],
+                $dsn['username'],
+                $dsn['password'],
+                $dsn['database'],
+                $dsn['port'],
+                $dsn['socket']
+            );
+        }
+
+        ini_set('track_errors', $ini);
+
+        if (!$this->connection) {
+            if (($err = @mysqli_connect_error()) != '') {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $err);
+            } else {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+
+        if ($dsn['database']) {
+            $this->_db = $dsn['database'];
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @mysqli_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        if ($this->_db) {
+            if (!@mysqli_select_db($this->connection, $this->_db)) {
+                return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
+            }
+        }
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=0');
+                $result = @mysqli_query($this->connection, 'BEGIN');
+                if (!$result) {
+                    return $this->mysqliRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @mysqli_query($this->connection, $query);
+        if (!$result) {
+            return $this->mysqliRaiseError();
+        }
+        if (is_object($result)) {
+            return $result;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal mysql result pointer to the next available result.
+     *
+     * This method has not been implemented yet.
+     *
+     * @param resource $result a valid sql result resource
+     * @return false
+     * @access public
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@mysqli_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @mysqli_fetch_array($result, MYSQLI_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @mysqli_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            /*
+             * Even though this DBMS already trims output, we do this because
+             * a field might have intentional whitespace at the end that
+             * gets removed by DB_PORTABILITY_RTRIM under another driver.
+             */
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @mysqli_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @mysqli_num_fields($result);
+        if (!$cols) {
+            return $this->mysqliRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @mysqli_num_rows($result);
+        if ($rows === null) {
+            return $this->mysqliRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysqli_select_db($this->connection, $this->_db)) {
+                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysqli_query($this->connection, 'COMMIT');
+            $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqliRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysqli_select_db($this->connection, $this->_db)) {
+                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysqli_query($this->connection, 'ROLLBACK');
+            $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqliRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            return @mysqli_affected_rows($this->connection);
+        } else {
+            return 0;
+        }
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_mysqli::createSequence(), DB_mysqli::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query('UPDATE ' . $seqname
+                                   . ' SET id = LAST_INSERT_ID(id + 1)');
+            $this->popErrorHandling();
+            if ($result === DB_OK) {
+                // COMMON CASE
+                $id = @mysqli_insert_id($this->connection);
+                if ($id != 0) {
+                    return $id;
+                }
+
+                // EMPTY SEQ TABLE
+                // Sequence table must be empty for some reason,
+                // so fill it and return 1
+                // Obtain a user-level lock
+                $result = $this->getOne('SELECT GET_LOCK('
+                                        . "'${seqname}_lock', 10)");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                if ($result == 0) {
+                    return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
+                }
+
+                // add the default value
+                $result = $this->query('REPLACE INTO ' . $seqname
+                                       . ' (id) VALUES (0)');
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+
+                // Release the lock
+                $result = $this->getOne('SELECT RELEASE_LOCK('
+                                        . "'${seqname}_lock')");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                // We know what the result will be, so no need to try again
+                return 1;
+
+            } elseif ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE)
+            {
+                // ONDEMAND TABLE CREATION
+                $result = $this->createSequence($seq_name);
+
+                // Since createSequence initializes the ID to be 1,
+                // we do not need to retrieve the ID again (or we will get 2)
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                } else {
+                    // First ID of a newly created sequence is 1
+                    return 1;
+                }
+
+            } elseif (DB::isError($result) &&
+                      $result->getCode() == DB_ERROR_ALREADY_EXISTS)
+            {
+                // BACKWARDS COMPAT
+                // see _BCsequence() comment
+                $result = $this->_BCsequence($seqname);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                $repeat = 1;
+            }
+        } while ($repeat);
+
+        return $this->raiseError($result);
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_mysqli::nextID(), DB_mysqli::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+        if (DB::isError($res)) {
+            return $res;
+        }
+        // insert yields value 1, nextId call will generate ID 2
+        return $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_mysql::nextID(), DB_mysql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ _BCsequence()
+
+    /**
+     * Backwards compatibility with old sequence emulation implementation
+     * (clean up the dupes)
+     *
+     * @param string $seqname  the sequence name to clean up
+     *
+     * @return bool  true on success.  A DB_Error object on failure.
+     *
+     * @access private
+     */
+    function _BCsequence($seqname)
+    {
+        // Obtain a user-level lock... this will release any previous
+        // application locks, but unlike LOCK TABLES, it does not abort
+        // the current transaction and is much less frequently used.
+        $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        if ($result == 0) {
+            // Failed to get the lock, can't do the conversion, bail
+            // with a DB_ERROR_NOT_LOCKED error
+            return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
+        }
+
+        $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
+        if (DB::isError($highest_id)) {
+            return $highest_id;
+        }
+
+        // This should kill all rows except the highest
+        // We should probably do something if $highest_id isn't
+        // numeric, but I'm at a loss as how to handle that...
+        $result = $this->query('DELETE FROM ' . $seqname
+                               . " WHERE id <> $highest_id");
+        if (DB::isError($result)) {
+            return $result;
+        }
+
+        // If another thread has been waiting for this lock,
+        // it will go thru the above procedure, but will have no
+        // real effect
+        $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * MySQL can't handle the backtick character (<kbd>`</kbd>) in
+     * table or column names.
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '`' . $str . '`';
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        return @mysqli_real_escape_string($this->connection, $str);
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if (DB::isManip($query)) {
+            return $query . " LIMIT $count";
+        } else {
+            return $query . " LIMIT $from, $count";
+        }
+    }
+
+    // }}}
+    // {{{ mysqliRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_mysqli::errorNative(), DB_common::errorCode()
+     */
+    function mysqliRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
+                $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
+                $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
+            } else {
+                // Doing this in case mode changes during runtime.
+                $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
+            }
+            $errno = $this->errorCode(mysqli_errno($this->connection));
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 @mysqli_errno($this->connection) . ' ** ' .
+                                 @mysqli_error($this->connection));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        return @mysqli_errno($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @mysqli_query($this->connection,
+                                "SELECT * FROM $result LIMIT 0");
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_a($id, 'mysqli_result')) {
+            return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @mysqli_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $tmp = @mysqli_fetch_field($id);
+
+            $flags = '';
+            foreach ($this->mysqli_flags as $const => $means) {
+                if ($tmp->flags & $const) {
+                    $flags .= $means . ' ';
+                }
+            }
+            if ($tmp->def) {
+                $flags .= 'default_' . rawurlencode($tmp->def);
+            }
+            $flags = trim($flags);
+
+            $res[$i] = array(
+                'table' => $case_func($tmp->table),
+                'name'  => $case_func($tmp->name),
+                'type'  => isset($this->mysqli_types[$tmp->type])
+                                    ? $this->mysqli_types[$tmp->type]
+                                    : 'unknown',
+                'len'   => $tmp->max_length,
+                'flags' => $flags,
+            );
+
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @mysqli_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SHOW TABLES';
+            case 'users':
+                return 'SELECT DISTINCT User FROM mysql.user';
+            case 'databases':
+                return 'SHOW DATABASES';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/mssql.php
===================================================================
--- /temp/trunk/data/module/DB/mssql.php	(revision 1328)
+++ /temp/trunk/data/module/DB/mssql.php	(revision 1328)
@@ -0,0 +1,914 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's mssql extension
+ * for interacting with Microsoft SQL Server databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's mssql extension
+ * for interacting with Microsoft SQL Server databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_mssql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'mssql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'mssql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    // XXX Add here error codes ie: 'S100E' => DB_ERROR_SYNTAX
+    var $errorcode_map = array(
+        110   => DB_ERROR_VALUE_COUNT_ON_ROW,
+        155   => DB_ERROR_NOSUCHFIELD,
+        170   => DB_ERROR_SYNTAX,
+        207   => DB_ERROR_NOSUCHFIELD,
+        208   => DB_ERROR_NOSUCHTABLE,
+        245   => DB_ERROR_INVALID_NUMBER,
+        515   => DB_ERROR_CONSTRAINT_NOT_NULL,
+        547   => DB_ERROR_CONSTRAINT,
+        1913  => DB_ERROR_ALREADY_EXISTS,
+        2627  => DB_ERROR_CONSTRAINT,
+        2714  => DB_ERROR_ALREADY_EXISTS,
+        3701  => DB_ERROR_NOSUCHTABLE,
+        8134  => DB_ERROR_DIVZERO,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = null;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_mssql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('mssql') && !PEAR::loadExtension('sybase')
+            && !PEAR::loadExtension('sybase_ct'))
+        {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array(
+            $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
+            $dsn['username'] ? $dsn['username'] : null,
+            $dsn['password'] ? $dsn['password'] : null,
+        );
+        if ($dsn['port']) {
+            $params[0] .= ((substr(PHP_OS, 0, 3) == 'WIN') ? ',' : ':')
+                        . $dsn['port'];
+        }
+
+        $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect';
+
+        $this->connection = @call_user_func_array($connect_function, $params);
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     @mssql_get_last_message());
+        }
+        if ($dsn['database']) {
+            if (!@mssql_select_db($dsn['database'], $this->connection)) {
+                return $this->raiseError(DB_ERROR_NODBSELECTED,
+                                         null, null, null,
+                                         @mssql_get_last_message());
+            }
+            $this->_db = $dsn['database'];
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @mssql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        if (!@mssql_select_db($this->_db, $this->connection)) {
+            return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $query = $this->modifyQuery($query);
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @mssql_query('BEGIN TRAN', $this->connection);
+                if (!$result) {
+                    return $this->mssqlRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @mssql_query($query, $this->connection);
+        if (!$result) {
+            return $this->mssqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        return $ismanip ? DB_OK : $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal mssql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return @mssql_next_result($result);
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@mssql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @mssql_fetch_array($result, MSSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @mssql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @mssql_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @mssql_num_fields($result);
+        if (!$cols) {
+            return $this->mssqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @mssql_num_rows($result);
+        if ($rows === false) {
+            return $this->mssqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@mssql_select_db($this->_db, $this->connection)) {
+                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @mssql_query('COMMIT TRAN', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mssqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@mssql_select_db($this->_db, $this->connection)) {
+                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @mssql_query('ROLLBACK TRAN', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mssqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            $res = @mssql_query('select @@rowcount', $this->connection);
+            if (!$res) {
+                return $this->mssqlRaiseError();
+            }
+            $ar = @mssql_fetch_row($res);
+            if (!$ar) {
+                $result = 0;
+            } else {
+                @mssql_free_result($res);
+                $result = $ar[0];
+            }
+        } else {
+            $result = 0;
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_mssql::createSequence(), DB_mssql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        if (!@mssql_select_db($this->_db, $this->connection)) {
+            return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
+            {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } elseif (!DB::isError($result)) {
+                $result =& $this->query("SELECT @@IDENTITY FROM $seqname");
+                $repeat = 0;
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        return $result[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_mssql::nextID(), DB_mssql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE TABLE '
+                            . $this->getSequenceName($seq_name)
+                            . ' ([id] [int] IDENTITY (1, 1) NOT NULL,'
+                            . ' [vapor] [int] NULL)');
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_mssql::nextID(), DB_mssql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '[' . str_replace(']', ']]', $str) . ']';
+    }
+
+    // }}}
+    // {{{ mssqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_mssql::errorNative(), DB_mssql::errorCode()
+     */
+    function mssqlRaiseError($code = null)
+    {
+        $message = @mssql_get_last_message();
+        if (!$code) {
+            $code = $this->errorNative();
+        }
+        return $this->raiseError($this->errorCode($code, $message),
+                                 null, null, null, "$code - $message");
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        $res = @mssql_query('select @@ERROR as ErrorCode', $this->connection);
+        if (!$res) {
+            return DB_ERROR;
+        }
+        $row = @mssql_fetch_row($res);
+        return $row[0];
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from mssql's native codes.
+     *
+     * If <var>$nativecode</var> isn't known yet, it will be looked up.
+     *
+     * @param  mixed  $nativecode  mssql error code, if known
+     * @return integer  an error number from a DB error constant
+     * @see errorNative()
+     */
+    function errorCode($nativecode = null, $msg = '')
+    {
+        if (!$nativecode) {
+            $nativecode = $this->errorNative();
+        }
+        if (isset($this->errorcode_map[$nativecode])) {
+            if ($nativecode == 3701
+                && preg_match('/Cannot drop the index/i', $msg))
+            {
+                return DB_ERROR_NOT_FOUND;
+            }
+            return $this->errorcode_map[$nativecode];
+        } else {
+            return DB_ERROR;
+        }
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            if (!@mssql_select_db($this->_db, $this->connection)) {
+                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $id = @mssql_query("SELECT * FROM $result WHERE 1=0",
+                               $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->mssqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @mssql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func(@mssql_field_name($id, $i)),
+                'type'  => @mssql_field_type($id, $i),
+                'len'   => @mssql_field_length($id, $i),
+                // We only support flags for table
+                'flags' => $got_string
+                           ? $this->_mssql_field_flags($result,
+                                                       @mssql_field_name($id, $i))
+                           : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @mssql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ _mssql_field_flags()
+
+    /**
+     * Get a column's flags
+     *
+     * Supports "not_null", "primary_key",
+     * "auto_increment" (mssql identity), "timestamp" (mssql timestamp),
+     * "unique_key" (mssql unique index, unique check or primary_key) and
+     * "multiple_key" (multikey index)
+     *
+     * mssql timestamp is NOT similar to the mysql timestamp so this is maybe
+     * not useful at all - is the behaviour of mysql_field_flags that primary
+     * keys are alway unique? is the interpretation of multiple_key correct?
+     *
+     * @param string $table   the table name
+     * @param string $column  the field name
+     *
+     * @return string  the flags
+     *
+     * @access private
+     * @author Joern Barthel <j_barthel@web.de>
+     */
+    function _mssql_field_flags($table, $column)
+    {
+        static $tableName = null;
+        static $flags = array();
+
+        if ($table != $tableName) {
+
+            $flags = array();
+            $tableName = $table;
+
+            // get unique and primary keys
+            $res = $this->getAll("EXEC SP_HELPINDEX[$table]", DB_FETCHMODE_ASSOC);
+
+            foreach ($res as $val) {
+                $keys = explode(', ', $val['index_keys']);
+
+                if (sizeof($keys) > 1) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'multiple_key');
+                    }
+                }
+
+                if (strpos($val['index_description'], 'primary key')) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'primary_key');
+                    }
+                } elseif (strpos($val['index_description'], 'unique')) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'unique_key');
+                    }
+                }
+            }
+
+            // get auto_increment, not_null and timestamp
+            $res = $this->getAll("EXEC SP_COLUMNS[$table]", DB_FETCHMODE_ASSOC);
+
+            foreach ($res as $val) {
+                $val = array_change_key_case($val, CASE_LOWER);
+                if ($val['nullable'] == '0') {
+                    $this->_add_flag($flags[$val['column_name']], 'not_null');
+                }
+                if (strpos($val['type_name'], 'identity')) {
+                    $this->_add_flag($flags[$val['column_name']], 'auto_increment');
+                }
+                if (strpos($val['type_name'], 'timestamp')) {
+                    $this->_add_flag($flags[$val['column_name']], 'timestamp');
+                }
+            }
+        }
+
+        if (array_key_exists($column, $flags)) {
+            return(implode(' ', $flags[$column]));
+        }
+        return '';
+    }
+
+    // }}}
+    // {{{ _add_flag()
+
+    /**
+     * Adds a string to the flags array if the flag is not yet in there
+     * - if there is no flag present the array is created
+     *
+     * @param array  &$array  the reference to the flag-array
+     * @param string $value   the flag value
+     *
+     * @return void
+     *
+     * @access private
+     * @author Joern Barthel <j_barthel@web.de>
+     */
+    function _add_flag(&$array, $value)
+    {
+        if (!is_array($array)) {
+            $array = array($value);
+        } elseif (!in_array($value, $array)) {
+            array_push($array, $value);
+        }
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return "SELECT name FROM sysobjects WHERE type = 'U'"
+                       . ' ORDER BY name';
+            case 'views':
+                return "SELECT name FROM sysobjects WHERE type = 'V'";
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/sqlite.php
===================================================================
--- /temp/trunk/data/module/DB/sqlite.php	(revision 1328)
+++ /temp/trunk/data/module/DB/sqlite.php	(revision 1328)
@@ -0,0 +1,942 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's sqlite extension
+ * for interacting with SQLite databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Urs Gehrig <urs@circle.ch>
+ * @author     Mika Tuupola <tuupola@appelsiini.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's sqlite extension
+ * for interacting with SQLite databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * NOTICE:  This driver needs PHP's track_errors ini setting to be on.
+ * It is automatically turned on when connecting to the database.
+ * Make sure your scripts don't turn it off.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Urs Gehrig <urs@circle.ch>
+ * @author     Mika Tuupola <tuupola@appelsiini.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_sqlite extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'sqlite';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'sqlite';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     *
+     * {@internal  Error codes according to sqlite_exec.  See the online
+     * manual at http://sqlite.org/c_interface.html for info.
+     * This error handling based on sqlite_exec is not yet implemented.}}
+     *
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * SQLite data types
+     *
+     * @link http://www.sqlite.org/datatypes.html
+     *
+     * @var array
+     */
+    var $keywords = array (
+        'BLOB'      => '',
+        'BOOLEAN'   => '',
+        'CHARACTER' => '',
+        'CLOB'      => '',
+        'FLOAT'     => '',
+        'INTEGER'   => '',
+        'KEY'       => '',
+        'NATIONAL'  => '',
+        'NUMERIC'   => '',
+        'NVARCHAR'  => '',
+        'PRIMARY'   => '',
+        'TEXT'      => '',
+        'TIMESTAMP' => '',
+        'UNIQUE'    => '',
+        'VARCHAR'   => '',
+        'VARYING'   => '',
+    );
+
+    /**
+     * The most recent error message from $php_errormsg
+     * @var string
+     * @access private
+     */
+    var $_lasterror = '';
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_sqlite()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's sqlite driver supports the following extra DSN options:
+     *   + mode  The permissions for the database file, in four digit
+     *            chmod octal format (eg "0600").
+     *
+     * Example of connecting to a database in read-only mode:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * $dsn = 'sqlite:///path/and/name/of/db/file?mode=0400';
+     * $options = array(
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('sqlite')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        if ($dsn['database']) {
+            if (!file_exists($dsn['database'])) {
+                if (!touch($dsn['database'])) {
+                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
+                }
+                if (!isset($dsn['mode']) ||
+                    !is_numeric($dsn['mode']))
+                {
+                    $mode = 0644;
+                } else {
+                    $mode = octdec($dsn['mode']);
+                }
+                if (!chmod($dsn['database'], $mode)) {
+                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
+                }
+                if (!file_exists($dsn['database'])) {
+                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
+                }
+            }
+            if (!is_file($dsn['database'])) {
+                return $this->sqliteRaiseError(DB_ERROR_INVALID);
+            }
+            if (!is_readable($dsn['database'])) {
+                return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
+            }
+        } else {
+            return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
+        }
+
+        $connect_function = $persistent ? 'sqlite_popen' : 'sqlite_open';
+
+        // track_errors must remain on for simpleQuery()
+        ini_set('track_errors', 1);
+        $php_errormsg = '';
+
+        if (!$this->connection = @$connect_function($dsn['database'])) {
+            return $this->raiseError(DB_ERROR_NODBSELECTED,
+                                     null, null, null,
+                                     $php_errormsg);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @sqlite_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * NOTICE:  This method needs PHP's track_errors ini setting to be on.
+     * It is automatically turned on when connecting to the database.
+     * Make sure your scripts don't turn it off.
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+
+        $php_errormsg = '';
+
+        $result = @sqlite_query($query, $this->connection);
+        $this->_lasterror = $php_errormsg ? $php_errormsg : '';
+
+        $this->result = $result;
+        if (!$this->result) {
+            return $this->sqliteRaiseError(null);
+        }
+
+        // sqlite_query() seems to allways return a resource
+        // so cant use that. Using $ismanip instead
+        if (!$ismanip) {
+            $numRows = $this->numRows($result);
+            if (is_object($numRows)) {
+                // we've got PEAR_Error
+                return $numRows;
+            }
+            return $result;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal sqlite result pointer to the next available result
+     *
+     * @param resource $result  the valid sqlite result resource
+     *
+     * @return bool  true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@sqlite_seek($this->result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @sqlite_fetch_array($result, SQLITE_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @sqlite_fetch_array($result, SQLITE_NUM);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            /*
+             * Even though this DBMS already trims output, we do this because
+             * a field might have intentional whitespace at the end that
+             * gets removed by DB_PORTABILITY_RTRIM under another driver.
+             */
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult(&$result)
+    {
+        // XXX No native free?
+        if (!is_resource($result)) {
+            return false;
+        }
+        $result = null;
+        return true;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @sqlite_num_fields($result);
+        if (!$cols) {
+            return $this->sqliteRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @sqlite_num_rows($result);
+        if ($rows === null) {
+            return $this->sqliteRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affected()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        return @sqlite_changes($this->connection);
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_sqlite::nextID(), DB_sqlite::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_sqlite::nextID(), DB_sqlite::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $query   = 'CREATE TABLE ' . $seqname .
+                   ' (id INTEGER UNSIGNED PRIMARY KEY) ';
+        $result  = $this->query($query);
+        if (DB::isError($result)) {
+            return($result);
+        }
+        $query   = "CREATE TRIGGER ${seqname}_cleanup AFTER INSERT ON $seqname
+                    BEGIN
+                        DELETE FROM $seqname WHERE id<LAST_INSERT_ROWID();
+                    END ";
+        $result  = $this->query($query);
+        if (DB::isError($result)) {
+            return($result);
+        }
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_sqlite::createSequence(), DB_sqlite::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("INSERT INTO $seqname (id) VALUES (NULL)");
+            $this->popErrorHandling();
+            if ($result === DB_OK) {
+                $id = @sqlite_last_insert_rowid($this->connection);
+                if ($id != 0) {
+                    return $id;
+                }
+            } elseif ($ondemand && DB::isError($result) &&
+                      $result->getCode() == DB_ERROR_NOSUCHTABLE)
+            {
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                } else {
+                    $repeat = 1;
+                }
+            }
+        } while ($repeat);
+
+        return $this->raiseError($result);
+    }
+
+    // }}}
+    // {{{ getDbFileStats()
+
+    /**
+     * Get the file stats for the current database
+     *
+     * Possible arguments are dev, ino, mode, nlink, uid, gid, rdev, size,
+     * atime, mtime, ctime, blksize, blocks or a numeric key between
+     * 0 and 12.
+     *
+     * @param string $arg  the array key for stats()
+     *
+     * @return mixed  an array on an unspecified key, integer on a passed
+     *                arg and false at a stats error
+     */
+    function getDbFileStats($arg = '')
+    {
+        $stats = stat($this->dsn['database']);
+        if ($stats == false) {
+            return false;
+        }
+        if (is_array($stats)) {
+            if (is_numeric($arg)) {
+                if (((int)$arg <= 12) & ((int)$arg >= 0)) {
+                    return false;
+                }
+                return $stats[$arg ];
+            }
+            if (array_key_exists(trim($arg), $stats)) {
+                return $stats[$arg ];
+            }
+        }
+        return $stats;
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * In SQLite, this makes things safe for inserts/updates, but may
+     * cause problems when performing text comparisons against columns
+     * containing binary data. See the
+     * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @since Method available since Release 1.6.1
+     * @see DB_common::escapeSimple()
+     */
+    function escapeSimple($str)
+    {
+        return @sqlite_escape_string($str);
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        return "$query LIMIT $count OFFSET $from";
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * This little hack lets you know how many rows were deleted
+     * when running a "DELETE FROM table" query.  Only implemented
+     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     * @see DB_common::setOption()
+     */
+    function modifyQuery($query)
+    {
+        if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
+            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
+                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
+                                      'DELETE FROM \1 WHERE 1=1', $query);
+            }
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ sqliteRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_sqlite::errorNative(), DB_sqlite::errorCode()
+     */
+    function sqliteRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+
+        $errorcode = @sqlite_last_error($this->connection);
+        $userinfo = "$errorcode ** $this->last_query";
+
+        return $this->raiseError($errno, null, null, $userinfo, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * {@internal This is used to retrieve more meaningfull error messages
+     * because sqlite_last_error() does not provide adequate info.}}
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return $this->_lasterror;
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message
+     *
+     * @param string $errormsg  the error message returned from the database
+     *
+     * @return integer  the DB error number
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/^no such table:/' => DB_ERROR_NOSUCHTABLE,
+                '/^no such index:/' => DB_ERROR_NOT_FOUND,
+                '/^(table|index) .* already exists$/' => DB_ERROR_ALREADY_EXISTS,
+                '/PRIMARY KEY must be unique/i' => DB_ERROR_CONSTRAINT,
+                '/is not unique/' => DB_ERROR_CONSTRAINT,
+                '/columns .* are not unique/i' => DB_ERROR_CONSTRAINT,
+                '/uniqueness constraint failed/' => DB_ERROR_CONSTRAINT,
+                '/may not be NULL/' => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/^no such column:/' => DB_ERROR_NOSUCHFIELD,
+                '/column not present in both tables/i' => DB_ERROR_NOSUCHFIELD,
+                '/^near ".*": syntax error$/' => DB_ERROR_SYNTAX,
+                '/[0-9]+ values for [0-9]+ columns/i' => DB_ERROR_VALUE_COUNT_ON_ROW,
+            );
+        }
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        // Fall back to DB_ERROR if there was no mapping.
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table
+     *
+     * @param string         $result  a string containing the name of a table
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.7.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @sqlite_array_query($this->connection,
+                                      "PRAGMA table_info('$result');",
+                                      SQLITE_ASSOC);
+            $got_string = true;
+        } else {
+            $this->last_query = '';
+            return $this->raiseError(DB_ERROR_NOT_CAPABLE, null, null, null,
+                                     'This DBMS can not obtain tableInfo' .
+                                     ' from result sets');
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = count($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            if (strpos($id[$i]['type'], '(') !== false) {
+                $bits = explode('(', $id[$i]['type']);
+                $type = $bits[0];
+                $len  = rtrim($bits[1],')');
+            } else {
+                $type = $id[$i]['type'];
+                $len  = 0;
+            }
+
+            $flags = '';
+            if ($id[$i]['pk']) {
+                $flags .= 'primary_key ';
+            }
+            if ($id[$i]['notnull']) {
+                $flags .= 'not_null ';
+            }
+            if ($id[$i]['dflt_value'] !== null) {
+                $flags .= 'default_' . rawurlencode($id[$i]['dflt_value']);
+            }
+            $flags = trim($flags);
+
+            $res[$i] = array(
+                'table' => $case_func($result),
+                'name'  => $case_func($id[$i]['name']),
+                'type'  => $type,
+                'len'   => $len,
+                'flags' => $flags,
+            );
+
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     * @param array  $args  SQLITE DRIVER ONLY: a private array of arguments
+     *                       used by the getSpecialQuery().  Do not use
+     *                       this directly.
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type, $args = array())
+    {
+        if (!is_array($args)) {
+            return $this->raiseError('no key specified', null, null, null,
+                                     'Argument has to be an array.');
+        }
+
+        switch ($type) {
+            case 'master':
+                return 'SELECT * FROM sqlite_master;';
+            case 'tables':
+                return "SELECT name FROM sqlite_master WHERE type='table' "
+                       . 'UNION ALL SELECT name FROM sqlite_temp_master '
+                       . "WHERE type='table' ORDER BY name;";
+            case 'schema':
+                return 'SELECT sql FROM (SELECT * FROM sqlite_master '
+                       . 'UNION ALL SELECT * FROM sqlite_temp_master) '
+                       . "WHERE type!='meta' "
+                       . 'ORDER BY tbl_name, type DESC, name;';
+            case 'schemax':
+            case 'schema_x':
+                /*
+                 * Use like:
+                 * $res = $db->query($db->getSpecialQuery('schema_x',
+                 *                   array('table' => 'table3')));
+                 */
+                return 'SELECT sql FROM (SELECT * FROM sqlite_master '
+                       . 'UNION ALL SELECT * FROM sqlite_temp_master) '
+                       . "WHERE tbl_name LIKE '{$args['table']}' "
+                       . "AND type!='meta' "
+                       . 'ORDER BY type DESC, name;';
+            case 'alter':
+                /*
+                 * SQLite does not support ALTER TABLE; this is a helper query
+                 * to handle this. 'table' represents the table name, 'rows'
+                 * the news rows to create, 'save' the row(s) to keep _with_
+                 * the data.
+                 *
+                 * Use like:
+                 * $args = array(
+                 *     'table' => $table,
+                 *     'rows'  => "id INTEGER PRIMARY KEY, firstname TEXT, surname TEXT, datetime TEXT",
+                 *     'save'  => "NULL, titel, content, datetime"
+                 * );
+                 * $res = $db->query( $db->getSpecialQuery('alter', $args));
+                 */
+                $rows = strtr($args['rows'], $this->keywords);
+
+                $q = array(
+                    'BEGIN TRANSACTION',
+                    "CREATE TEMPORARY TABLE {$args['table']}_backup ({$args['rows']})",
+                    "INSERT INTO {$args['table']}_backup SELECT {$args['save']} FROM {$args['table']}",
+                    "DROP TABLE {$args['table']}",
+                    "CREATE TABLE {$args['table']} ({$args['rows']})",
+                    "INSERT INTO {$args['table']} SELECT {$rows} FROM {$args['table']}_backup",
+                    "DROP TABLE {$args['table']}_backup",
+                    'COMMIT',
+                );
+
+                /*
+                 * This is a dirty hack, since the above query will not get
+                 * executed with a single query call so here the query method
+                 * will be called directly and return a select instead.
+                 */
+                foreach ($q as $query) {
+                    $this->query($query);
+                }
+                return "SELECT * FROM {$args['table']};";
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/oci8.php
===================================================================
--- /temp/trunk/data/module/DB/oci8.php	(revision 1328)
+++ /temp/trunk/data/module/DB/oci8.php	(revision 1328)
@@ -0,0 +1,1117 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's oci8 extension
+ * for interacting with Oracle databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     James L. Pine <jlp@valinux.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's oci8 extension
+ * for interacting with Oracle databases
+ *
+ * Definitely works with versions 8 and 9 of Oracle.
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * Be aware...  OCIError() only appears to return anything when given a
+ * statement, so functions return the generic DB_ERROR instead of more
+ * useful errors that have to do with feedback from the database.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     James L. Pine <jlp@valinux.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_oci8 extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'oci8';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'oci8';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => '5.0.0',
+        'numrows'       => 'subquery',
+        'pconnect'      => true,
+        'prepare'       => true,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        1    => DB_ERROR_CONSTRAINT,
+        900  => DB_ERROR_SYNTAX,
+        904  => DB_ERROR_NOSUCHFIELD,
+        913  => DB_ERROR_VALUE_COUNT_ON_ROW,
+        921  => DB_ERROR_SYNTAX,
+        923  => DB_ERROR_SYNTAX,
+        942  => DB_ERROR_NOSUCHTABLE,
+        955  => DB_ERROR_ALREADY_EXISTS,
+        1400 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        1401 => DB_ERROR_INVALID,
+        1407 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        1418 => DB_ERROR_NOT_FOUND,
+        1476 => DB_ERROR_DIVZERO,
+        1722 => DB_ERROR_INVALID_NUMBER,
+        2289 => DB_ERROR_NOSUCHTABLE,
+        2291 => DB_ERROR_CONSTRAINT,
+        2292 => DB_ERROR_CONSTRAINT,
+        2449 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * Stores the $data passed to execute() in the oci8 driver
+     *
+     * Gets reset to array() when simpleQuery() is run.
+     *
+     * Needed in case user wants to call numRows() after prepare/execute
+     * was used.
+     *
+     * @var array
+     * @access private
+     */
+    var $_data = array();
+
+    /**
+     * The result or statement handle from the most recently executed query
+     * @var resource
+     */
+    var $last_stmt;
+
+    /**
+     * Is the given prepared statement a data manipulation query?
+     * @var array
+     * @access private
+     */
+    var $manip_query = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_oci8()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * If PHP is at version 5.0.0 or greater:
+     *   + Generally, oci_connect() or oci_pconnect() are used.
+     *   + But if the new_link DSN option is set to true, oci_new_connect()
+     *     is used.
+     *
+     * When using PHP version 4.x, OCILogon() or OCIPLogon() are used.
+     *
+     * PEAR DB's oci8 driver supports the following extra DSN options:
+     *   + charset       The character set to be used on the connection.
+     *                    Only used if PHP is at version 5.0.0 or greater
+     *                    and the Oracle server is at 9.2 or greater.
+     *                    Available since PEAR DB 1.7.0.
+     *   + new_link      If set to true, causes subsequent calls to
+     *                    connect() to return a new connection link
+     *                    instead of the existing one.  WARNING: this is
+     *                    not portable to other DBMS's.
+     *                    Available since PEAR DB 1.7.0.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('oci8')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        if (function_exists('oci_connect')) {
+            if (isset($dsn['new_link'])
+                && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
+            {
+                $connect_function = 'oci_new_connect';
+            } else {
+                $connect_function = $persistent ? 'oci_pconnect'
+                                    : 'oci_connect';
+            }
+
+            // Backwards compatibility with DB < 1.7.0
+            if (empty($dsn['database']) && !empty($dsn['hostspec'])) {
+                $db = $dsn['hostspec'];
+            } else {
+                $db = $dsn['database'];
+            }
+
+            $char = empty($dsn['charset']) ? null : $dsn['charset'];
+            $this->connection = @$connect_function($dsn['username'],
+                                                   $dsn['password'],
+                                                   $db,
+                                                   $char);
+            $error = OCIError();
+            if (!empty($error) && $error['code'] == 12541) {
+                // Couldn't find TNS listener.  Try direct connection.
+                $this->connection = @$connect_function($dsn['username'],
+                                                       $dsn['password'],
+                                                       null,
+                                                       $char);
+            }
+        } else {
+            $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon';
+            if ($dsn['hostspec']) {
+                $this->connection = @$connect_function($dsn['username'],
+                                                       $dsn['password'],
+                                                       $dsn['hostspec']);
+            } elseif ($dsn['username'] || $dsn['password']) {
+                $this->connection = @$connect_function($dsn['username'],
+                                                       $dsn['password']);
+            }
+        }
+
+        if (!$this->connection) {
+            $error = OCIError();
+            $error = (is_array($error)) ? $error['message'] : null;
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $error);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        if (function_exists('oci_close')) {
+            $ret = @oci_close($this->connection);
+        } else {
+            $ret = @OCILogOff($this->connection);
+        }
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * To determine how many rows of a result set get buffered using
+     * ocisetprefetch(), see the "result_buffering" option in setOptions().
+     * This option was added in Release 1.7.0.
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->_data = array();
+        $this->last_parameters = array();
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @OCIParse($this->connection, $query);
+        if (!$result) {
+            return $this->oci8RaiseError();
+        }
+        if ($this->autocommit) {
+            $success = @OCIExecute($result,OCI_COMMIT_ON_SUCCESS);
+        } else {
+            $success = @OCIExecute($result,OCI_DEFAULT);
+        }
+        if (!$success) {
+            return $this->oci8RaiseError($result);
+        }
+        $this->last_stmt = $result;
+        if (DB::isManip($query)) {
+            return DB_OK;
+        } else {
+            @ocisetprefetch($result, $this->options['result_buffering']);
+            return $result;
+        }
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal oracle result pointer to the next available result
+     *
+     * @param a valid oci8 result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE &&
+                $moredata)
+            {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $moredata = OCIFetchInto($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS);
+        }
+        if (!$moredata) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @OCIFreeStatement($result);
+    }
+
+    /**
+     * Frees the internal resources associated with a prepared query
+     *
+     * @param resource $stmt           the prepared statement's resource
+     * @param bool     $free_resource  should the PHP resource be freed too?
+     *                                  Use false if you need to get data
+     *                                  from the result set later.
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_oci8::prepare()
+     */
+    function freePrepared($stmt, $free_resource = true)
+    {
+        if (!is_resource($stmt)) {
+            return false;
+        }
+        if ($free_resource) {
+            @ocifreestatement($stmt);
+        }
+        if (isset($this->prepare_types[(int)$stmt])) {
+            unset($this->prepare_types[(int)$stmt]);
+            unset($this->manip_query[(int)$stmt]);
+        } else {
+            return false;
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * Only works if the DB_PORTABILITY_NUMROWS portability option
+     * is turned on.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows(), DB_common::setOption()
+     */
+    function numRows($result)
+    {
+        // emulate numRows for Oracle.  yuck.
+        if ($this->options['portability'] & DB_PORTABILITY_NUMROWS &&
+            $result === $this->last_stmt)
+        {
+            $countquery = 'SELECT COUNT(*) FROM ('.$this->last_query.')';
+            $save_query = $this->last_query;
+            $save_stmt = $this->last_stmt;
+
+            if (count($this->_data)) {
+                $smt = $this->prepare('SELECT COUNT(*) FROM ('.$this->last_query.')');
+                $count = $this->execute($smt, $this->_data);
+            } else {
+                $count =& $this->query($countquery);
+            }
+
+            if (DB::isError($count) ||
+                DB::isError($row = $count->fetchRow(DB_FETCHMODE_ORDERED)))
+            {
+                $this->last_query = $save_query;
+                $this->last_stmt = $save_stmt;
+                return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+            }
+            return $row[0];
+        }
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @OCINumCols($result);
+        if (!$cols) {
+            return $this->oci8RaiseError($result);
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ prepare()
+
+    /**
+     * Prepares a query for multiple execution with execute().
+     *
+     * With oci8, this is emulated.
+     *
+     * prepare() requires a generic query as string like <code>
+     *    INSERT INTO numbers VALUES (?, ?, ?)
+     * </code>.  The <kbd>?</kbd> characters are placeholders.
+     *
+     * Three types of placeholders can be used:
+     *   + <kbd>?</kbd>  a quoted scalar value, i.e. strings, integers
+     *   + <kbd>!</kbd>  value is inserted 'as is'
+     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
+     *                     inserted into the query (i.e. saving binary
+     *                     data in a db)
+     *
+     * Use backslashes to escape placeholder characters if you don't want
+     * them to be interpreted as placeholders.  Example: <code>
+     *    "UPDATE foo SET col=? WHERE col='over \& under'"
+     * </code>
+     *
+     * @param string $query  the query to be prepared
+     *
+     * @return mixed  DB statement resource on success. DB_Error on failure.
+     *
+     * @see DB_oci8::execute()
+     */
+    function prepare($query)
+    {
+        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
+                               PREG_SPLIT_DELIM_CAPTURE);
+        $binds    = count($tokens) - 1;
+        $token    = 0;
+        $types    = array();
+        $newquery = '';
+
+        foreach ($tokens as $key => $val) {
+            switch ($val) {
+                case '?':
+                    $types[$token++] = DB_PARAM_SCALAR;
+                    unset($tokens[$key]);
+                    break;
+                case '&':
+                    $types[$token++] = DB_PARAM_OPAQUE;
+                    unset($tokens[$key]);
+                    break;
+                case '!':
+                    $types[$token++] = DB_PARAM_MISC;
+                    unset($tokens[$key]);
+                    break;
+                default:
+                    $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
+                    if ($key != $binds) {
+                        $newquery .= $tokens[$key] . ':bind' . $token;
+                    } else {
+                        $newquery .= $tokens[$key];
+                    }
+            }
+        }
+
+        $this->last_query = $query;
+        $newquery = $this->modifyQuery($newquery);
+        if (!$stmt = @OCIParse($this->connection, $newquery)) {
+            return $this->oci8RaiseError();
+        }
+        $this->prepare_types[(int)$stmt] = $types;
+        $this->manip_query[(int)$stmt] = DB::isManip($query);
+        return $stmt;
+    }
+
+    // }}}
+    // {{{ execute()
+
+    /**
+     * Executes a DB statement prepared with prepare().
+     *
+     * To determine how many rows of a result set get buffered using
+     * ocisetprefetch(), see the "result_buffering" option in setOptions().
+     * This option was added in Release 1.7.0.
+     *
+     * @param resource  $stmt  a DB statement resource returned from prepare()
+     * @param mixed  $data  array, string or numeric data to be used in
+     *                      execution of the statement.  Quantity of items
+     *                      passed must match quantity of placeholders in
+     *                      query:  meaning 1 for non-array items or the
+     *                      quantity of elements in the array.
+     *
+     * @return mixed  returns an oic8 result resource for successful SELECT
+     *                queries, DB_OK for other successful queries.
+     *                A DB error object is returned on failure.
+     *
+     * @see DB_oci8::prepare()
+     */
+    function &execute($stmt, $data = array())
+    {
+        $data = (array)$data;
+        $this->last_parameters = $data;
+        $this->_data = $data;
+
+        $types =& $this->prepare_types[(int)$stmt];
+        if (count($types) != count($data)) {
+            $tmp =& $this->raiseError(DB_ERROR_MISMATCH);
+            return $tmp;
+        }
+
+        $i = 0;
+        foreach ($data as $key => $value) {
+            if ($types[$i] == DB_PARAM_MISC) {
+                /*
+                 * Oracle doesn't seem to have the ability to pass a
+                 * parameter along unchanged, so strip off quotes from start
+                 * and end, plus turn two single quotes to one single quote,
+                 * in order to avoid the quotes getting escaped by
+                 * Oracle and ending up in the database.
+                 */
+                $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
+                $data[$key] = str_replace("''", "'", $data[$key]);
+            } elseif ($types[$i] == DB_PARAM_OPAQUE) {
+                $fp = @fopen($data[$key], 'rb');
+                if (!$fp) {
+                    $tmp =& $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                    return $tmp;
+                }
+                $data[$key] = fread($fp, filesize($data[$key]));
+                fclose($fp);
+            }
+            if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) {
+                $tmp = $this->oci8RaiseError($stmt);
+                return $tmp;
+            }
+            $i++;
+        }
+        if ($this->autocommit) {
+            $success = @OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS);
+        } else {
+            $success = @OCIExecute($stmt, OCI_DEFAULT);
+        }
+        if (!$success) {
+            $tmp = $this->oci8RaiseError($stmt);
+            return $tmp;
+        }
+        $this->last_stmt = $stmt;
+        if ($this->manip_query[(int)$stmt]) {
+            $tmp = DB_OK;
+        } else {
+            @ocisetprefetch($stmt, $this->options['result_buffering']);
+            $tmp =& new DB_result($this, $stmt);
+        }
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        $this->autocommit = (bool)$onoff;;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        $result = @OCICommit($this->connection);
+        if (!$result) {
+            return $this->oci8RaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        $result = @OCIRollback($this->connection);
+        if (!$result) {
+            return $this->oci8RaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if ($this->last_stmt === false) {
+            return $this->oci8RaiseError();
+        }
+        $result = @OCIRowCount($this->last_stmt);
+        if ($result === false) {
+            return $this->oci8RaiseError($this->last_stmt);
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * "SELECT 2+2" must be "SELECT 2+2 FROM dual" in Oracle.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     */
+    function modifyQuery($query)
+    {
+        if (preg_match('/^\s*SELECT/i', $query) &&
+            !preg_match('/\sFROM\s/i', $query)) {
+            $query .= ' FROM dual';
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        // Let Oracle return the name of the columns instead of
+        // coding a "home" SQL parser
+
+        if (count($params)) {
+            $result = $this->prepare("SELECT * FROM ($query) "
+                                     . 'WHERE NULL = NULL');
+            $tmp =& $this->execute($result, $params);
+        } else {
+            $q_fields = "SELECT * FROM ($query) WHERE NULL = NULL";
+
+            if (!$result = @OCIParse($this->connection, $q_fields)) {
+                $this->last_query = $q_fields;
+                return $this->oci8RaiseError();
+            }
+            if (!@OCIExecute($result, OCI_DEFAULT)) {
+                $this->last_query = $q_fields;
+                return $this->oci8RaiseError($result);
+            }
+        }
+
+        $ncols = OCINumCols($result);
+        $cols  = array();
+        for ( $i = 1; $i <= $ncols; $i++ ) {
+            $cols[] = '"' . OCIColumnName($result, $i) . '"';
+        }
+        $fields = implode(', ', $cols);
+        // XXX Test that (tip by John Lim)
+        //if (preg_match('/^\s*SELECT\s+/is', $query, $match)) {
+        //    // Introduce the FIRST_ROWS Oracle query optimizer
+        //    $query = substr($query, strlen($match[0]), strlen($query));
+        //    $query = "SELECT /* +FIRST_ROWS */ " . $query;
+        //}
+
+        // Construct the query
+        // more at: http://marc.theaimsgroup.com/?l=php-db&m=99831958101212&w=2
+        // Perhaps this could be optimized with the use of Unions
+        $query = "SELECT $fields FROM".
+                 "  (SELECT rownum as linenum, $fields FROM".
+                 "      ($query)".
+                 '  WHERE rownum <= '. ($from + $count) .
+                 ') WHERE linenum >= ' . ++$from;
+        return $query;
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_oci8::createSequence(), DB_oci8::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = 0;
+        do {
+            $this->expectError(DB_ERROR_NOSUCHTABLE);
+            $result =& $this->query("SELECT ${seqname}.nextval FROM dual");
+            $this->popExpect();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        return $arr[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_oci8::nextID(), DB_oci8::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE SEQUENCE '
+                            . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_oci8::nextID(), DB_oci8::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP SEQUENCE '
+                            . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ oci8RaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_oci8::errorNative(), DB_oci8::errorCode()
+     */
+    function oci8RaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $error = @OCIError($this->connection);
+            return $this->raiseError($this->errorCode($error['code']),
+                                     null, null, null, $error['message']);
+        } elseif (is_resource($errno)) {
+            $error = @OCIError($errno);
+            return $this->raiseError($this->errorCode($error['code']),
+                                     null, null, null, $error['message']);
+        }
+        return $this->raiseError($this->errorCode($errno));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code.  FALSE if the code could not be
+     *               determined
+     */
+    function errorNative()
+    {
+        if (is_resource($this->last_stmt)) {
+            $error = @OCIError($this->last_stmt);
+        } else {
+            $error = @OCIError($this->connection);
+        }
+        if (is_array($error)) {
+            return $error['code'];
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * NOTE: flags won't contain index information.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $res = array();
+
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $result = strtoupper($result);
+            $q_fields = 'SELECT column_name, data_type, data_length, '
+                        . 'nullable '
+                        . 'FROM user_tab_columns '
+                        . "WHERE table_name='$result' ORDER BY column_id";
+
+            $this->last_query = $q_fields;
+
+            if (!$stmt = @OCIParse($this->connection, $q_fields)) {
+                return $this->oci8RaiseError(DB_ERROR_NEED_MORE_DATA);
+            }
+            if (!@OCIExecute($stmt, OCI_DEFAULT)) {
+                return $this->oci8RaiseError($stmt);
+            }
+
+            $i = 0;
+            while (@OCIFetch($stmt)) {
+                $res[$i] = array(
+                    'table' => $case_func($result),
+                    'name'  => $case_func(@OCIResult($stmt, 1)),
+                    'type'  => @OCIResult($stmt, 2),
+                    'len'   => @OCIResult($stmt, 3),
+                    'flags' => (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '',
+                );
+                if ($mode & DB_TABLEINFO_ORDER) {
+                    $res['order'][$res[$i]['name']] = $i;
+                }
+                if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                    $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+                }
+                $i++;
+            }
+
+            if ($mode) {
+                $res['num_fields'] = $i;
+            }
+            @OCIFreeStatement($stmt);
+
+        } else {
+            if (isset($result->result)) {
+                /*
+                 * Probably received a result object.
+                 * Extract the result resource identifier.
+                 */
+                $result = $result->result;
+            }
+
+            $res = array();
+
+            if ($result === $this->last_stmt) {
+                $count = @OCINumCols($result);
+                if ($mode) {
+                    $res['num_fields'] = $count;
+                }
+                for ($i = 0; $i < $count; $i++) {
+                    $res[$i] = array(
+                        'table' => '',
+                        'name'  => $case_func(@OCIColumnName($result, $i+1)),
+                        'type'  => @OCIColumnType($result, $i+1),
+                        'len'   => @OCIColumnSize($result, $i+1),
+                        'flags' => '',
+                    );
+                    if ($mode & DB_TABLEINFO_ORDER) {
+                        $res['order'][$res[$i]['name']] = $i;
+                    }
+                    if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                        $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+                    }
+                }
+            } else {
+                return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+            }
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT table_name FROM user_tables';
+            case 'synonyms':
+                return 'SELECT synonym_name FROM user_synonyms';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/ibase.php
===================================================================
--- /temp/trunk/data/module/DB/ibase.php	(revision 1328)
+++ /temp/trunk/data/module/DB/ibase.php	(revision 1328)
@@ -0,0 +1,1071 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's interbase extension
+ * for interacting with Interbase and Firebird databases
+ *
+ * While this class works with PHP 4, PHP's InterBase extension is
+ * unstable in PHP 4.  Use PHP 5.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's interbase extension
+ * for interacting with Interbase and Firebird databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * While this class works with PHP 4, PHP's InterBase extension is
+ * unstable in PHP 4.  Use PHP 5.
+ *
+ * NOTICE:  limitQuery() only works for Firebird.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class became stable in Release 1.7.0
+ */
+class DB_ibase extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'ibase';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'ibase';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * NOTE: only firebird supports limit.
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => false,
+        'new_link'      => false,
+        'numrows'       => 'emulate',
+        'pconnect'      => true,
+        'prepare'       => true,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        -104 => DB_ERROR_SYNTAX,
+        -150 => DB_ERROR_ACCESS_VIOLATION,
+        -151 => DB_ERROR_ACCESS_VIOLATION,
+        -155 => DB_ERROR_NOSUCHTABLE,
+        -157 => DB_ERROR_NOSUCHFIELD,
+        -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        -170 => DB_ERROR_MISMATCH,
+        -171 => DB_ERROR_MISMATCH,
+        -172 => DB_ERROR_INVALID,
+        // -204 =>  // Covers too many errors, need to use regex on msg
+        -205 => DB_ERROR_NOSUCHFIELD,
+        -206 => DB_ERROR_NOSUCHFIELD,
+        -208 => DB_ERROR_INVALID,
+        -219 => DB_ERROR_NOSUCHTABLE,
+        -297 => DB_ERROR_CONSTRAINT,
+        -303 => DB_ERROR_INVALID,
+        -413 => DB_ERROR_INVALID_NUMBER,
+        -530 => DB_ERROR_CONSTRAINT,
+        -551 => DB_ERROR_ACCESS_VIOLATION,
+        -552 => DB_ERROR_ACCESS_VIOLATION,
+        // -607 =>  // Covers too many errors, need to use regex on msg
+        -625 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        -803 => DB_ERROR_CONSTRAINT,
+        -804 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        -904 => DB_ERROR_CONNECT_FAILED,
+        -922 => DB_ERROR_NOSUCHDB,
+        -923 => DB_ERROR_CONNECT_FAILED,
+        -924 => DB_ERROR_CONNECT_FAILED
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     * @access private
+     */
+    var $affected = 0;
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The prepared statement handle from the most recently executed statement
+     *
+     * {@internal  Mainly here because the InterBase/Firebird API is only
+     * able to retrieve data from result sets if the statemnt handle is
+     * still in scope.}}
+     *
+     * @var resource
+     */
+    var $last_stmt;
+
+    /**
+     * Is the given prepared statement a data manipulation query?
+     * @var array
+     * @access private
+     */
+    var $manip_query = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_ibase()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's ibase driver supports the following extra DSN options:
+     *   + buffers    The number of database buffers to allocate for the
+     *                 server-side cache.
+     *   + charset    The default character set for a database.
+     *   + dialect    The default SQL dialect for any statement
+     *                 executed within a connection.  Defaults to the
+     *                 highest one supported by client libraries.
+     *                 Functional only with InterBase 6 and up.
+     *   + role       Functional only with InterBase 5 and up.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('interbase')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+        if ($this->dbsyntax == 'firebird') {
+            $this->features['limit'] = 'alter';
+        }
+
+        $params = array(
+            $dsn['hostspec']
+                    ? ($dsn['hostspec'] . ':' . $dsn['database'])
+                    : $dsn['database'],
+            $dsn['username'] ? $dsn['username'] : null,
+            $dsn['password'] ? $dsn['password'] : null,
+            isset($dsn['charset']) ? $dsn['charset'] : null,
+            isset($dsn['buffers']) ? $dsn['buffers'] : null,
+            isset($dsn['dialect']) ? $dsn['dialect'] : null,
+            isset($dsn['role'])    ? $dsn['role'] : null,
+        );
+
+        $connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
+
+        $this->connection = @call_user_func_array($connect_function, $params);
+        if (!$this->connection) {
+            return $this->ibaseRaiseError(DB_ERROR_CONNECT_FAILED);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @ibase_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @ibase_query($this->connection, $query);
+
+        if (!$result) {
+            return $this->ibaseRaiseError();
+        }
+        if ($this->autocommit && $ismanip) {
+            @ibase_commit($this->connection);
+        }
+        if ($ismanip) {
+            $this->affected = $result;
+            return DB_OK;
+        } else {
+            $this->affected = 0;
+            return $result;
+        }
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * Only works with Firebird.
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if ($this->dsn['dbsyntax'] == 'firebird') {
+            $query = preg_replace('/^([\s(])*SELECT/i',
+                                  "SELECT FIRST $count SKIP $from", $query);
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal ibase result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            if (function_exists('ibase_fetch_assoc')) {
+                $arr = @ibase_fetch_assoc($result);
+            } else {
+                $arr = get_object_vars(ibase_fetch_object($result));
+            }
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @ibase_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @ibase_free_result($result);
+    }
+
+    // }}}
+    // {{{ freeQuery()
+
+    function freeQuery($query)
+    {
+        @ibase_free_query($query);
+        return true;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (is_integer($this->affected)) {
+            return $this->affected;
+        }
+        return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @ibase_num_fields($result);
+        if (!$cols) {
+            return $this->ibaseRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ prepare()
+
+    /**
+     * Prepares a query for multiple execution with execute().
+     *
+     * prepare() requires a generic query as string like <code>
+     *    INSERT INTO numbers VALUES (?, ?, ?)
+     * </code>.  The <kbd>?</kbd> characters are placeholders.
+     *
+     * Three types of placeholders can be used:
+     *   + <kbd>?</kbd>  a quoted scalar value, i.e. strings, integers
+     *   + <kbd>!</kbd>  value is inserted 'as is'
+     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
+     *                     inserted into the query (i.e. saving binary
+     *                     data in a db)
+     *
+     * Use backslashes to escape placeholder characters if you don't want
+     * them to be interpreted as placeholders.  Example: <code>
+     *    "UPDATE foo SET col=? WHERE col='over \& under'"
+     * </code>
+     *
+     * @param string $query query to be prepared
+     * @return mixed DB statement resource on success. DB_Error on failure.
+     */
+    function prepare($query)
+    {
+        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
+                               PREG_SPLIT_DELIM_CAPTURE);
+        $token    = 0;
+        $types    = array();
+        $newquery = '';
+
+        foreach ($tokens as $key => $val) {
+            switch ($val) {
+                case '?':
+                    $types[$token++] = DB_PARAM_SCALAR;
+                    break;
+                case '&':
+                    $types[$token++] = DB_PARAM_OPAQUE;
+                    break;
+                case '!':
+                    $types[$token++] = DB_PARAM_MISC;
+                    break;
+                default:
+                    $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
+                    $newquery .= $tokens[$key] . '?';
+            }
+        }
+
+        $newquery = substr($newquery, 0, -1);
+        $this->last_query = $query;
+        $newquery = $this->modifyQuery($newquery);
+        $stmt = @ibase_prepare($this->connection, $newquery);
+        $this->prepare_types[(int)$stmt] = $types;
+        $this->manip_query[(int)$stmt]   = DB::isManip($query);
+        return $stmt;
+    }
+
+    // }}}
+    // {{{ execute()
+
+    /**
+     * Executes a DB statement prepared with prepare().
+     *
+     * @param resource  $stmt  a DB statement resource returned from prepare()
+     * @param mixed  $data  array, string or numeric data to be used in
+     *                      execution of the statement.  Quantity of items
+     *                      passed must match quantity of placeholders in
+     *                      query:  meaning 1 for non-array items or the
+     *                      quantity of elements in the array.
+     * @return object  a new DB_Result or a DB_Error when fail
+     * @see DB_ibase::prepare()
+     * @access public
+     */
+    function &execute($stmt, $data = array())
+    {
+        $data = (array)$data;
+        $this->last_parameters = $data;
+
+        $types =& $this->prepare_types[(int)$stmt];
+        if (count($types) != count($data)) {
+            $tmp =& $this->raiseError(DB_ERROR_MISMATCH);
+            return $tmp;
+        }
+
+        $i = 0;
+        foreach ($data as $key => $value) {
+            if ($types[$i] == DB_PARAM_MISC) {
+                /*
+                 * ibase doesn't seem to have the ability to pass a
+                 * parameter along unchanged, so strip off quotes from start
+                 * and end, plus turn two single quotes to one single quote,
+                 * in order to avoid the quotes getting escaped by
+                 * ibase and ending up in the database.
+                 */
+                $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
+                $data[$key] = str_replace("''", "'", $data[$key]);
+            } elseif ($types[$i] == DB_PARAM_OPAQUE) {
+                $fp = @fopen($data[$key], 'rb');
+                if (!$fp) {
+                    $tmp =& $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                    return $tmp;
+                }
+                $data[$key] = fread($fp, filesize($data[$key]));
+                fclose($fp);
+            }
+            $i++;
+        }
+
+        array_unshift($data, $stmt);
+
+        $res = call_user_func_array('ibase_execute', $data);
+        if (!$res) {
+            $tmp =& $this->ibaseRaiseError();
+            return $tmp;
+        }
+        /* XXX need this?
+        if ($this->autocommit && $this->manip_query[(int)$stmt]) {
+            @ibase_commit($this->connection);
+        }*/
+        $this->last_stmt = $stmt;
+        if ($this->manip_query[(int)$stmt]) {
+            $tmp = DB_OK;
+        } else {
+            $tmp =& new DB_result($this, $res);
+        }
+        return $tmp;
+    }
+
+    /**
+     * Frees the internal resources associated with a prepared query
+     *
+     * @param resource $stmt           the prepared statement's PHP resource
+     * @param bool     $free_resource  should the PHP resource be freed too?
+     *                                  Use false if you need to get data
+     *                                  from the result set later.
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_ibase::prepare()
+     */
+    function freePrepared($stmt, $free_resource = true)
+    {
+        if (!is_resource($stmt)) {
+            return false;
+        }
+        if ($free_resource) {
+            @ibase_free_query($stmt);
+        }
+        unset($this->prepare_tokens[(int)$stmt]);
+        unset($this->prepare_types[(int)$stmt]);
+        unset($this->manip_query[(int)$stmt]);
+        return true;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        $this->autocommit = $onoff ? 1 : 0;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        return @ibase_commit($this->connection);
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        return @ibase_rollback($this->connection);
+    }
+
+    // }}}
+    // {{{ transactionInit()
+
+    function transactionInit($trans_args = 0)
+    {
+        return $trans_args
+                ? @ibase_trans($trans_args, $this->connection)
+                : @ibase_trans();
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_ibase::createSequence(), DB_ibase::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $sqn = strtoupper($this->getSequenceName($seq_name));
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result =& $this->query("SELECT GEN_ID(${sqn}, 1) "
+                                   . 'FROM RDB$GENERATORS '
+                                   . "WHERE RDB\$GENERATOR_NAME='${sqn}'");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result)) {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $result;
+                }
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        $result->free();
+        return $arr[0];
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_ibase::nextID(), DB_ibase::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $sqn = strtoupper($this->getSequenceName($seq_name));
+        $this->pushErrorHandling(PEAR_ERROR_RETURN);
+        $result = $this->query("CREATE GENERATOR ${sqn}");
+        $this->popErrorHandling();
+
+        return $result;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_ibase::nextID(), DB_ibase::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DELETE FROM RDB$GENERATORS '
+                            . "WHERE RDB\$GENERATOR_NAME='"
+                            . strtoupper($this->getSequenceName($seq_name))
+                            . "'");
+    }
+
+    // }}}
+    // {{{ _ibaseFieldFlags()
+
+    /**
+     * Get the column's flags
+     *
+     * Supports "primary_key", "unique_key", "not_null", "default",
+     * "computed" and "blob".
+     *
+     * @param string $field_name  the name of the field
+     * @param string $table_name  the name of the table
+     *
+     * @return string  the flags
+     *
+     * @access private
+     */
+    function _ibaseFieldFlags($field_name, $table_name)
+    {
+        $sql = 'SELECT R.RDB$CONSTRAINT_TYPE CTYPE'
+               .' FROM RDB$INDEX_SEGMENTS I'
+               .'  JOIN RDB$RELATION_CONSTRAINTS R ON I.RDB$INDEX_NAME=R.RDB$INDEX_NAME'
+               .' WHERE I.RDB$FIELD_NAME=\'' . $field_name . '\''
+               .'  AND UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\'';
+
+        $result = @ibase_query($this->connection, $sql);
+        if (!$result) {
+            return $this->ibaseRaiseError();
+        }
+
+        $flags = '';
+        if ($obj = @ibase_fetch_object($result)) {
+            @ibase_free_result($result);
+            if (isset($obj->CTYPE)  && trim($obj->CTYPE) == 'PRIMARY KEY') {
+                $flags .= 'primary_key ';
+            }
+            if (isset($obj->CTYPE)  && trim($obj->CTYPE) == 'UNIQUE') {
+                $flags .= 'unique_key ';
+            }
+        }
+
+        $sql = 'SELECT R.RDB$NULL_FLAG AS NFLAG,'
+               .'  R.RDB$DEFAULT_SOURCE AS DSOURCE,'
+               .'  F.RDB$FIELD_TYPE AS FTYPE,'
+               .'  F.RDB$COMPUTED_SOURCE AS CSOURCE'
+               .' FROM RDB$RELATION_FIELDS R '
+               .'  JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME'
+               .' WHERE UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\''
+               .'  AND R.RDB$FIELD_NAME=\'' . $field_name . '\'';
+
+        $result = @ibase_query($this->connection, $sql);
+        if (!$result) {
+            return $this->ibaseRaiseError();
+        }
+        if ($obj = @ibase_fetch_object($result)) {
+            @ibase_free_result($result);
+            if (isset($obj->NFLAG)) {
+                $flags .= 'not_null ';
+            }
+            if (isset($obj->DSOURCE)) {
+                $flags .= 'default ';
+            }
+            if (isset($obj->CSOURCE)) {
+                $flags .= 'computed ';
+            }
+            if (isset($obj->FTYPE)  && $obj->FTYPE == 261) {
+                $flags .= 'blob ';
+            }
+        }
+
+        return trim($flags);
+    }
+
+    // }}}
+    // {{{ ibaseRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_ibase::errorNative(), DB_ibase::errorCode()
+     */
+    function &ibaseRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $errno = $this->errorCode($this->errorNative());
+        }
+        $tmp =& $this->raiseError($errno, null, null, null, @ibase_errmsg());
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code.  NULL if there is no error code.
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function errorNative()
+    {
+        if (function_exists('ibase_errcode')) {
+            return @ibase_errcode();
+        }
+        if (preg_match('/^Dynamic SQL Error SQL error code = ([0-9-]+)/i',
+                       @ibase_errmsg(), $m)) {
+            return (int)$m[1];
+        }
+        return null;
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Maps native error codes to DB's portable ones
+     *
+     * @param int $nativecode  the error code returned by the DBMS
+     *
+     * @return int  the portable DB error code.  Return DB_ERROR if the
+     *               current driver doesn't have a mapping for the
+     *               $nativecode submitted.
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function errorCode($nativecode = null)
+    {
+        if (isset($this->errorcode_map[$nativecode])) {
+            return $this->errorcode_map[$nativecode];
+        }
+
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/generator .* is not defined/'
+                    => DB_ERROR_SYNTAX,  // for compat. w ibase_errcode()
+                '/table.*(not exist|not found|unknown)/i'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/table .* already exists/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/unsuccessful metadata update .* failed attempt to store duplicate value/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/unsuccessful metadata update .* not found/i'
+                    => DB_ERROR_NOT_FOUND,
+                '/validation error for column .* value "\*\*\* null/i'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/violation of [\w ]+ constraint/i'
+                    => DB_ERROR_CONSTRAINT,
+                '/conversion error from string/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/no permission for/i'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/arithmetic exception, numeric overflow, or string truncation/i'
+                    => DB_ERROR_INVALID,
+            );
+        }
+
+        $errormsg = @ibase_errmsg();
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @ibase_query($this->connection,
+                               "SELECT * FROM $result WHERE 1=0");
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->ibaseRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @ibase_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $info = @ibase_field_info($id, $i);
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func($info['name']),
+                'type'  => $info['type'],
+                'len'   => $info['length'],
+                'flags' => ($got_string)
+                            ? $this->_ibaseFieldFlags($info['name'], $result)
+                            : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @ibase_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT DISTINCT R.RDB$RELATION_NAME FROM '
+                       . 'RDB$RELATION_FIELDS R WHERE R.RDB$SYSTEM_FLAG=0';
+            case 'views':
+                return 'SELECT DISTINCT RDB$VIEW_NAME from RDB$VIEW_RELATIONS';
+            case 'users':
+                return 'SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/storage.php
===================================================================
--- /temp/trunk/data/module/DB/storage.php	(revision 1328)
+++ /temp/trunk/data/module/DB/storage.php	(revision 1328)
@@ -0,0 +1,504 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Provides an object interface to a table row
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <stig@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB class so it can be extended from
+ */
+require_once 'DB.php';
+
+/**
+ * Provides an object interface to a table row
+ *
+ * It lets you add, delete and change rows using objects rather than SQL
+ * statements.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <stig@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_storage extends PEAR
+{
+    // {{{ properties
+
+    /** the name of the table (or view, if the backend database supports
+        updates in views) we hold data from */
+    var $_table = null;
+
+    /** which column(s) in the table contains primary keys, can be a
+        string for single-column primary keys, or an array of strings
+        for multiple-column primary keys */
+    var $_keycolumn = null;
+
+    /** DB connection handle used for all transactions */
+    var $_dbh = null;
+
+    /** an assoc with the names of database fields stored as properties
+        in this object */
+    var $_properties = array();
+
+    /** an assoc with the names of the properties in this object that
+        have been changed since they were fetched from the database */
+    var $_changes = array();
+
+    /** flag that decides if data in this object can be changed.
+        objects that don't have their table's key column in their
+        property lists will be flagged as read-only. */
+    var $_readonly = false;
+
+    /** function or method that implements a validator for fields that
+        are set, this validator function returns true if the field is
+        valid, false if not */
+    var $_validator = null;
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * Constructor
+     *
+     * @param $table string the name of the database table
+     *
+     * @param $keycolumn mixed string with name of key column, or array of
+     * strings if the table has a primary key of more than one column
+     *
+     * @param $dbh object database connection object
+     *
+     * @param $validator mixed function or method used to validate
+     * each new value, called with three parameters: the name of the
+     * field/column that is changing, a reference to the new value and
+     * a reference to this object
+     *
+     */
+    function DB_storage($table, $keycolumn, &$dbh, $validator = null)
+    {
+        $this->PEAR('DB_Error');
+        $this->_table = $table;
+        $this->_keycolumn = $keycolumn;
+        $this->_dbh = $dbh;
+        $this->_readonly = false;
+        $this->_validator = $validator;
+    }
+
+    // }}}
+    // {{{ _makeWhere()
+
+    /**
+     * Utility method to build a "WHERE" clause to locate ourselves in
+     * the table.
+     *
+     * XXX future improvement: use rowids?
+     *
+     * @access private
+     */
+    function _makeWhere($keyval = null)
+    {
+        if (is_array($this->_keycolumn)) {
+            if ($keyval === null) {
+                for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
+                    $keyval[] = $this->{$this->_keycolumn[$i]};
+                }
+            }
+            $whereclause = '';
+            for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
+                if ($i > 0) {
+                    $whereclause .= ' AND ';
+                }
+                $whereclause .= $this->_keycolumn[$i];
+                if (is_null($keyval[$i])) {
+                    // there's not much point in having a NULL key,
+                    // but we support it anyway
+                    $whereclause .= ' IS NULL';
+                } else {
+                    $whereclause .= ' = ' . $this->_dbh->quote($keyval[$i]);
+                }
+            }
+        } else {
+            if ($keyval === null) {
+                $keyval = @$this->{$this->_keycolumn};
+            }
+            $whereclause = $this->_keycolumn;
+            if (is_null($keyval)) {
+                // there's not much point in having a NULL key,
+                // but we support it anyway
+                $whereclause .= ' IS NULL';
+            } else {
+                $whereclause .= ' = ' . $this->_dbh->quote($keyval);
+            }
+        }
+        return $whereclause;
+    }
+
+    // }}}
+    // {{{ setup()
+
+    /**
+     * Method used to initialize a DB_storage object from the
+     * configured table.
+     *
+     * @param $keyval mixed the key[s] of the row to fetch (string or array)
+     *
+     * @return int DB_OK on success, a DB error if not
+     */
+    function setup($keyval)
+    {
+        $whereclause = $this->_makeWhere($keyval);
+        $query = 'SELECT * FROM ' . $this->_table . ' WHERE ' . $whereclause;
+        $sth = $this->_dbh->query($query);
+        if (DB::isError($sth)) {
+            return $sth;
+        }
+        $row = $sth->fetchRow(DB_FETCHMODE_ASSOC);
+        if (DB::isError($row)) {
+            return $row;
+        }
+        if (!$row) {
+            return $this->raiseError(null, DB_ERROR_NOT_FOUND, null, null,
+                                     $query, null, true);
+        }
+        foreach ($row as $key => $value) {
+            $this->_properties[$key] = true;
+            $this->$key = $value;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ insert()
+
+    /**
+     * Create a new (empty) row in the configured table for this
+     * object.
+     */
+    function insert($newpk)
+    {
+        if (is_array($this->_keycolumn)) {
+            $primarykey = $this->_keycolumn;
+        } else {
+            $primarykey = array($this->_keycolumn);
+        }
+        settype($newpk, "array");
+        for ($i = 0; $i < sizeof($primarykey); $i++) {
+            $pkvals[] = $this->_dbh->quote($newpk[$i]);
+        }
+
+        $sth = $this->_dbh->query("INSERT INTO $this->_table (" .
+                                  implode(",", $primarykey) . ") VALUES(" .
+                                  implode(",", $pkvals) . ")");
+        if (DB::isError($sth)) {
+            return $sth;
+        }
+        if (sizeof($newpk) == 1) {
+            $newpk = $newpk[0];
+        }
+        $this->setup($newpk);
+    }
+
+    // }}}
+    // {{{ toString()
+
+    /**
+     * Output a simple description of this DB_storage object.
+     * @return string object description
+     */
+    function toString()
+    {
+        $info = strtolower(get_class($this));
+        $info .= " (table=";
+        $info .= $this->_table;
+        $info .= ", keycolumn=";
+        if (is_array($this->_keycolumn)) {
+            $info .= "(" . implode(",", $this->_keycolumn) . ")";
+        } else {
+            $info .= $this->_keycolumn;
+        }
+        $info .= ", dbh=";
+        if (is_object($this->_dbh)) {
+            $info .= $this->_dbh->toString();
+        } else {
+            $info .= "null";
+        }
+        $info .= ")";
+        if (sizeof($this->_properties)) {
+            $info .= " [loaded, key=";
+            $keyname = $this->_keycolumn;
+            if (is_array($keyname)) {
+                $info .= "(";
+                for ($i = 0; $i < sizeof($keyname); $i++) {
+                    if ($i > 0) {
+                        $info .= ",";
+                    }
+                    $info .= $this->$keyname[$i];
+                }
+                $info .= ")";
+            } else {
+                $info .= $this->$keyname;
+            }
+            $info .= "]";
+        }
+        if (sizeof($this->_changes)) {
+            $info .= " [modified]";
+        }
+        return $info;
+    }
+
+    // }}}
+    // {{{ dump()
+
+    /**
+     * Dump the contents of this object to "standard output".
+     */
+    function dump()
+    {
+        foreach ($this->_properties as $prop => $foo) {
+            print "$prop = ";
+            print htmlentities($this->$prop);
+            print "<br />\n";
+        }
+    }
+
+    // }}}
+    // {{{ &create()
+
+    /**
+     * Static method used to create new DB storage objects.
+     * @param $data assoc. array where the keys are the names
+     *              of properties/columns
+     * @return object a new instance of DB_storage or a subclass of it
+     */
+    function &create($table, &$data)
+    {
+        $classname = strtolower(get_class($this));
+        $obj =& new $classname($table);
+        foreach ($data as $name => $value) {
+            $obj->_properties[$name] = true;
+            $obj->$name = &$value;
+        }
+        return $obj;
+    }
+
+    // }}}
+    // {{{ loadFromQuery()
+
+    /**
+     * Loads data into this object from the given query.  If this
+     * object already contains table data, changes will be saved and
+     * the object re-initialized first.
+     *
+     * @param $query SQL query
+     *
+     * @param $params parameter list in case you want to use
+     * prepare/execute mode
+     *
+     * @return int DB_OK on success, DB_WARNING_READ_ONLY if the
+     * returned object is read-only (because the object's specified
+     * key column was not found among the columns returned by $query),
+     * or another DB error code in case of errors.
+     */
+// XXX commented out for now
+/*
+    function loadFromQuery($query, $params = null)
+    {
+        if (sizeof($this->_properties)) {
+            if (sizeof($this->_changes)) {
+                $this->store();
+                $this->_changes = array();
+            }
+            $this->_properties = array();
+        }
+        $rowdata = $this->_dbh->getRow($query, DB_FETCHMODE_ASSOC, $params);
+        if (DB::isError($rowdata)) {
+            return $rowdata;
+        }
+        reset($rowdata);
+        $found_keycolumn = false;
+        while (list($key, $value) = each($rowdata)) {
+            if ($key == $this->_keycolumn) {
+                $found_keycolumn = true;
+            }
+            $this->_properties[$key] = true;
+            $this->$key = &$value;
+            unset($value); // have to unset, or all properties will
+                           // refer to the same value
+        }
+        if (!$found_keycolumn) {
+            $this->_readonly = true;
+            return DB_WARNING_READ_ONLY;
+        }
+        return DB_OK;
+    }
+ */
+
+    // }}}
+    // {{{ set()
+
+    /**
+     * Modify an attriute value.
+     */
+    function set($property, $newvalue)
+    {
+        // only change if $property is known and object is not
+        // read-only
+        if ($this->_readonly) {
+            return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
+                                     null, null, null, true);
+        }
+        if (@isset($this->_properties[$property])) {
+            if (empty($this->_validator)) {
+                $valid = true;
+            } else {
+                $valid = @call_user_func($this->_validator,
+                                         $this->_table,
+                                         $property,
+                                         $newvalue,
+                                         $this->$property,
+                                         $this);
+            }
+            if ($valid) {
+                $this->$property = $newvalue;
+                if (empty($this->_changes[$property])) {
+                    $this->_changes[$property] = 0;
+                } else {
+                    $this->_changes[$property]++;
+                }
+            } else {
+                return $this->raiseError(null, DB_ERROR_INVALID, null,
+                                         null, "invalid field: $property",
+                                         null, true);
+            }
+            return true;
+        }
+        return $this->raiseError(null, DB_ERROR_NOSUCHFIELD, null,
+                                 null, "unknown field: $property",
+                                 null, true);
+    }
+
+    // }}}
+    // {{{ &get()
+
+    /**
+     * Fetch an attribute value.
+     *
+     * @param string attribute name
+     *
+     * @return attribute contents, or null if the attribute name is
+     * unknown
+     */
+    function &get($property)
+    {
+        // only return if $property is known
+        if (isset($this->_properties[$property])) {
+            return $this->$property;
+        }
+        $tmp = null;
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ _DB_storage()
+
+    /**
+     * Destructor, calls DB_storage::store() if there are changes
+     * that are to be kept.
+     */
+    function _DB_storage()
+    {
+        if (sizeof($this->_changes)) {
+            $this->store();
+        }
+        $this->_properties = array();
+        $this->_changes = array();
+        $this->_table = null;
+    }
+
+    // }}}
+    // {{{ store()
+
+    /**
+     * Stores changes to this object in the database.
+     *
+     * @return DB_OK or a DB error
+     */
+    function store()
+    {
+        foreach ($this->_changes as $name => $foo) {
+            $params[] = &$this->$name;
+            $vars[] = $name . ' = ?';
+        }
+        if ($vars) {
+            $query = 'UPDATE ' . $this->_table . ' SET ' .
+                implode(', ', $vars) . ' WHERE ' .
+                $this->_makeWhere();
+            $stmt = $this->_dbh->prepare($query);
+            $res = $this->_dbh->execute($stmt, $params);
+            if (DB::isError($res)) {
+                return $res;
+            }
+            $this->_changes = array();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ remove()
+
+    /**
+     * Remove the row represented by this object from the database.
+     *
+     * @return mixed DB_OK or a DB error
+     */
+    function remove()
+    {
+        if ($this->_readonly) {
+            return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
+                                     null, null, null, true);
+        }
+        $query = 'DELETE FROM ' . $this->_table .' WHERE '.
+            $this->_makeWhere();
+        $res = $this->_dbh->query($query);
+        if (DB::isError($res)) {
+            return $res;
+        }
+        foreach ($this->_properties as $prop => $foo) {
+            unset($this->$prop);
+        }
+        $this->_properties = array();
+        $this->_changes = array();
+        return DB_OK;
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/DB/mysql.php
===================================================================
--- /temp/trunk/data/module/DB/mysql.php	(revision 1328)
+++ /temp/trunk/data/module/DB/mysql.php	(revision 1328)
@@ -0,0 +1,1034 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's mysql extension
+ * for interacting with MySQL databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's mysql extension
+ * for interacting with MySQL databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_mysql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'mysql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'mysql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => '4.2.0',
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        1004 => DB_ERROR_CANNOT_CREATE,
+        1005 => DB_ERROR_CANNOT_CREATE,
+        1006 => DB_ERROR_CANNOT_CREATE,
+        1007 => DB_ERROR_ALREADY_EXISTS,
+        1008 => DB_ERROR_CANNOT_DROP,
+        1022 => DB_ERROR_ALREADY_EXISTS,
+        1044 => DB_ERROR_ACCESS_VIOLATION,
+        1046 => DB_ERROR_NODBSELECTED,
+        1048 => DB_ERROR_CONSTRAINT,
+        1049 => DB_ERROR_NOSUCHDB,
+        1050 => DB_ERROR_ALREADY_EXISTS,
+        1051 => DB_ERROR_NOSUCHTABLE,
+        1054 => DB_ERROR_NOSUCHFIELD,
+        1061 => DB_ERROR_ALREADY_EXISTS,
+        1062 => DB_ERROR_ALREADY_EXISTS,
+        1064 => DB_ERROR_SYNTAX,
+        1091 => DB_ERROR_NOT_FOUND,
+        1100 => DB_ERROR_NOT_LOCKED,
+        1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        1142 => DB_ERROR_ACCESS_VIOLATION,
+        1146 => DB_ERROR_NOSUCHTABLE,
+        1216 => DB_ERROR_CONSTRAINT,
+        1217 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = '';
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_mysql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's mysql driver supports the following extra DSN options:
+     *   + new_link      If set to true, causes subsequent calls to connect()
+     *                    to return a new connection link instead of the
+     *                    existing one.  WARNING: this is not portable to
+     *                    other DBMS's. Available since PEAR DB 1.7.0.
+     *   + client_flags  Any combination of MYSQL_CLIENT_* constants.
+     *                    Only used if PHP is at version 4.3.0 or greater.
+     *                    Available since PEAR DB 1.7.0.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('mysql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array();
+        if ($dsn['protocol'] && $dsn['protocol'] == 'unix') {
+            $params[0] = ':' . $dsn['socket'];
+        } else {
+            $params[0] = $dsn['hostspec'] ? $dsn['hostspec']
+                         : 'localhost';
+            if ($dsn['port']) {
+                $params[0] .= ':' . $dsn['port'];
+            }
+        }
+        $params[] = $dsn['username'] ? $dsn['username'] : null;
+        $params[] = $dsn['password'] ? $dsn['password'] : null;
+
+        if (!$persistent) {
+            if (isset($dsn['new_link'])
+                && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
+            {
+                $params[] = true;
+            } else {
+                $params[] = false;
+            }
+        }
+        if (version_compare(phpversion(), '4.3.0', '>=')) {
+            $params[] = isset($dsn['client_flags'])
+                        ? $dsn['client_flags'] : null;
+        }
+
+        $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            if (($err = @mysql_error()) != '') {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null, 
+                                         $err);
+            } else {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+
+        if ($dsn['database']) {
+            if (!@mysql_select_db($dsn['database'], $this->connection)) {
+                return $this->mysqlRaiseError();
+            }
+            $this->_db = $dsn['database'];
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @mysql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * Generally uses mysql_query().  If you want to use
+     * mysql_unbuffered_query() set the "result_buffering" option to 0 using
+     * setOptions().  This option was added in Release 1.7.0.
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        if ($this->_db) {
+            if (!@mysql_select_db($this->_db, $this->connection)) {
+                return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+        }
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @mysql_query('SET AUTOCOMMIT=0', $this->connection);
+                $result = @mysql_query('BEGIN', $this->connection);
+                if (!$result) {
+                    return $this->mysqlRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        if (!$this->options['result_buffering']) {
+            $result = @mysql_unbuffered_query($query, $this->connection);
+        } else {
+            $result = @mysql_query($query, $this->connection);
+        }
+        if (!$result) {
+            return $this->mysqlRaiseError();
+        }
+        if (is_resource($result)) {
+            return $result;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal mysql result pointer to the next available result
+     *
+     * This method has not been implemented yet.
+     *
+     * @param a valid sql result resource
+     *
+     * @return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@mysql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @mysql_fetch_array($result, MYSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @mysql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            /*
+             * Even though this DBMS already trims output, we do this because
+             * a field might have intentional whitespace at the end that
+             * gets removed by DB_PORTABILITY_RTRIM under another driver.
+             */
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @mysql_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @mysql_num_fields($result);
+        if (!$cols) {
+            return $this->mysqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @mysql_num_rows($result);
+        if ($rows === null) {
+            return $this->mysqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysql_select_db($this->_db, $this->connection)) {
+                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysql_query('COMMIT', $this->connection);
+            $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysql_select_db($this->_db, $this->connection)) {
+                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysql_query('ROLLBACK', $this->connection);
+            $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            return @mysql_affected_rows($this->connection);
+        } else {
+            return 0;
+        }
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_mysql::createSequence(), DB_mysql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("UPDATE ${seqname} ".
+                                   'SET id=LAST_INSERT_ID(id+1)');
+            $this->popErrorHandling();
+            if ($result === DB_OK) {
+                // COMMON CASE
+                $id = @mysql_insert_id($this->connection);
+                if ($id != 0) {
+                    return $id;
+                }
+                // EMPTY SEQ TABLE
+                // Sequence table must be empty for some reason, so fill
+                // it and return 1 and obtain a user-level lock
+                $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                if ($result == 0) {
+                    // Failed to get the lock
+                    return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
+                }
+
+                // add the default value
+                $result = $this->query("REPLACE INTO ${seqname} (id) VALUES (0)");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+
+                // Release the lock
+                $result = $this->getOne('SELECT RELEASE_LOCK('
+                                        . "'${seqname}_lock')");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                // We know what the result will be, so no need to try again
+                return 1;
+
+            } elseif ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE)
+            {
+                // ONDEMAND TABLE CREATION
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                } else {
+                    $repeat = 1;
+                }
+
+            } elseif (DB::isError($result) &&
+                      $result->getCode() == DB_ERROR_ALREADY_EXISTS)
+            {
+                // BACKWARDS COMPAT
+                // see _BCsequence() comment
+                $result = $this->_BCsequence($seqname);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                $repeat = 1;
+            }
+        } while ($repeat);
+
+        return $this->raiseError($result);
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_mysql::nextID(), DB_mysql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+        if (DB::isError($res)) {
+            return $res;
+        }
+        // insert yields value 1, nextId call will generate ID 2
+        $res = $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
+        if (DB::isError($res)) {
+            return $res;
+        }
+        // so reset to zero
+        return $this->query("UPDATE ${seqname} SET id = 0");
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_mysql::nextID(), DB_mysql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ _BCsequence()
+
+    /**
+     * Backwards compatibility with old sequence emulation implementation
+     * (clean up the dupes)
+     *
+     * @param string $seqname  the sequence name to clean up
+     *
+     * @return bool  true on success.  A DB_Error object on failure.
+     *
+     * @access private
+     */
+    function _BCsequence($seqname)
+    {
+        // Obtain a user-level lock... this will release any previous
+        // application locks, but unlike LOCK TABLES, it does not abort
+        // the current transaction and is much less frequently used.
+        $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        if ($result == 0) {
+            // Failed to get the lock, can't do the conversion, bail
+            // with a DB_ERROR_NOT_LOCKED error
+            return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
+        }
+
+        $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
+        if (DB::isError($highest_id)) {
+            return $highest_id;
+        }
+        // This should kill all rows except the highest
+        // We should probably do something if $highest_id isn't
+        // numeric, but I'm at a loss as how to handle that...
+        $result = $this->query('DELETE FROM ' . $seqname
+                               . " WHERE id <> $highest_id");
+        if (DB::isError($result)) {
+            return $result;
+        }
+
+        // If another thread has been waiting for this lock,
+        // it will go thru the above procedure, but will have no
+        // real effect
+        $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * MySQL can't handle the backtick character (<kbd>`</kbd>) in
+     * table or column names.
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '`' . $str . '`';
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * @deprecated  Deprecated in release 1.6.0
+     */
+    function quote($str)
+    {
+        return $this->quoteSmart($str);
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        if (function_exists('mysql_real_escape_string')) {
+            return @mysql_real_escape_string($str, $this->connection);
+        } else {
+            return @mysql_escape_string($str);
+        }
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * This little hack lets you know how many rows were deleted
+     * when running a "DELETE FROM table" query.  Only implemented
+     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     * @see DB_common::setOption()
+     */
+    function modifyQuery($query)
+    {
+        if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
+            // "DELETE FROM table" gives 0 affected rows in MySQL.
+            // This little hack lets you know how many rows were deleted.
+            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
+                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
+                                      'DELETE FROM \1 WHERE 1=1', $query);
+            }
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if (DB::isManip($query)) {
+            return $query . " LIMIT $count";
+        } else {
+            return $query . " LIMIT $from, $count";
+        }
+    }
+
+    // }}}
+    // {{{ mysqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_mysql::errorNative(), DB_common::errorCode()
+     */
+    function mysqlRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
+                $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
+                $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
+            } else {
+                // Doing this in case mode changes during runtime.
+                $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
+            }
+            $errno = $this->errorCode(mysql_errno($this->connection));
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 @mysql_errno($this->connection) . ' ** ' .
+                                 @mysql_error($this->connection));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        return @mysql_errno($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @mysql_list_fields($this->dsn['database'],
+                                     $result, $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->mysqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @mysql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $case_func(@mysql_field_table($id, $i)),
+                'name'  => $case_func(@mysql_field_name($id, $i)),
+                'type'  => @mysql_field_type($id, $i),
+                'len'   => @mysql_field_len($id, $i),
+                'flags' => @mysql_field_flags($id, $i),
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @mysql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SHOW TABLES';
+            case 'users':
+                return 'SELECT DISTINCT User FROM mysql.user';
+            case 'databases':
+                return 'SHOW DATABASES';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/trunk/data/module/Mail.php
===================================================================
--- /temp/trunk/data/module/Mail.php	(revision 1328)
+++ /temp/trunk/data/module/Mail.php	(revision 1328)
@@ -0,0 +1,212 @@
+<?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Chuck Hagenbuch <chuck@horde.org>                            |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+
+require_once 'PEAR.php';
+
+/**
+ * PEAR's Mail:: interface. Defines the interface for implementing
+ * mailers under the PEAR hierarchy, and provides supporting functions
+ * useful in multiple mailer backends.
+ *
+ * @access public
+ * @version $Revision$
+ * @package Mail
+ */
+class Mail
+{
+    /**
+     * Line terminator used for separating header lines.
+     * @var string
+     */
+    var $sep = "\r\n";
+
+    /**
+     * Provides an interface for generating Mail:: objects of various
+     * types
+     *
+     * @param string $driver The kind of Mail:: object to instantiate.
+     * @param array  $params The parameters to pass to the Mail:: object.
+     * @return object Mail a instance of the driver class or if fails a PEAR Error
+     * @access public
+     */
+    function &factory($driver, $params = array())
+    {
+        $driver = strtolower($driver);
+        @include_once 'Mail/' . $driver . '.php';
+        $class = 'Mail_' . $driver;
+        if (class_exists($class)) {
+            $mailer = new $class($params);
+            return $mailer;
+        } else {
+            return PEAR::raiseError('Unable to find class for driver ' . $driver);
+        }
+    }
+
+    /**
+     * Implements Mail::send() function using php's built-in mail()
+     * command.
+     *
+     * @param mixed $recipients Either a comma-seperated list of recipients
+     *              (RFC822 compliant), or an array of recipients,
+     *              each RFC822 valid. This may contain recipients not
+     *              specified in the headers, for Bcc:, resending
+     *              messages, etc.
+     *
+     * @param array $headers The array of headers to send with the mail, in an
+     *              associative array, where the array key is the
+     *              header name (ie, 'Subject'), and the array value
+     *              is the header value (ie, 'test'). The header
+     *              produced from those values would be 'Subject:
+     *              test'.
+     *
+     * @param string $body The full text of the message body, including any
+     *               Mime parts, etc.
+     *
+     * @return mixed Returns true on success, or a PEAR_Error
+     *               containing a descriptive error message on
+     *               failure.
+     * @access public
+     * @deprecated use Mail_mail::send instead
+     */
+    function send($recipients, $headers, $body)
+    {
+        // if we're passed an array of recipients, implode it.
+        if (is_array($recipients)) {
+            $recipients = implode(', ', $recipients);
+        }
+
+        // get the Subject out of the headers array so that we can
+        // pass it as a seperate argument to mail().
+        $subject = '';
+        if (isset($headers['Subject'])) {
+            $subject = $headers['Subject'];
+            unset($headers['Subject']);
+        }
+
+        // flatten the headers out.
+        list(,$text_headers) = Mail::prepareHeaders($headers);
+
+        return mail($recipients, $subject, $body, $text_headers);
+
+    }
+
+    /**
+     * Take an array of mail headers and return a string containing
+     * text usable in sending a message.
+     *
+     * @param array $headers The array of headers to prepare, in an associative
+     *              array, where the array key is the header name (ie,
+     *              'Subject'), and the array value is the header
+     *              value (ie, 'test'). The header produced from those
+     *              values would be 'Subject: test'.
+     *
+     * @return mixed Returns false if it encounters a bad address,
+     *               otherwise returns an array containing two
+     *               elements: Any From: address found in the headers,
+     *               and the plain text version of the headers.
+     * @access private
+     */
+    function prepareHeaders($headers)
+    {
+        $lines = array();
+        $from = null;
+
+        foreach ($headers as $key => $value) {
+            if (strcasecmp($key, 'From') === 0) {
+                include_once 'Mail/RFC822.php';
+                $parser = &new Mail_RFC822();
+                $addresses = $parser->parseAddressList($value, 'localhost', false);
+                if (PEAR::isError($addresses)) {
+                    return $addresses;
+                }
+
+                $from = $addresses[0]->mailbox . '@' . $addresses[0]->host;
+
+                // Reject envelope From: addresses with spaces.
+                if (strstr($from, ' ')) {
+                    return false;
+                }
+
+                $lines[] = $key . ': ' . $value;
+            } elseif (strcasecmp($key, 'Received') === 0) {
+                $received = array();
+                if (is_array($value)) {
+                    foreach ($value as $line) {
+                        $received[] = $key . ': ' . $line;
+                    }
+                }
+                else {
+                    $received[] = $key . ': ' . $value;
+                }
+                // Put Received: headers at the top.  Spam detectors often
+                // flag messages with Received: headers after the Subject:
+                // as spam.
+                $lines = array_merge($received, $lines);
+            } else {
+                // If $value is an array (i.e., a list of addresses), convert
+                // it to a comma-delimited string of its elements (addresses).
+                if (is_array($value)) {
+                    $value = implode(', ', $value);
+                }
+                $lines[] = $key . ': ' . $value;
+            }
+        }
+
+        return array($from, join($this->sep, $lines) . $this->sep);
+    }
+
+    /**
+     * Take a set of recipients and parse them, returning an array of
+     * bare addresses (forward paths) that can be passed to sendmail
+     * or an smtp server with the rcpt to: command.
+     *
+     * @param mixed Either a comma-seperated list of recipients
+     *              (RFC822 compliant), or an array of recipients,
+     *              each RFC822 valid.
+     *
+     * @return array An array of forward paths (bare addresses).
+     * @access private
+     */
+    function parseRecipients($recipients)
+    {
+        include_once 'Mail/RFC822.php';
+
+        // if we're passed an array, assume addresses are valid and
+        // implode them before parsing.
+        if (is_array($recipients)) {
+            $recipients = implode(', ', $recipients);
+        }
+
+        // Parse recipients, leaving out all personal info. This is
+        // for smtp recipients, etc. All relevant personal information
+        // should already be in the headers.
+        $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
+        $recipients = array();
+        if (is_array($addresses)) {
+            foreach ($addresses as $ob) {
+                $recipients[] = $ob->mailbox . '@' . $ob->host;
+            }
+        }
+
+        return $recipients;
+    }
+
+}
+?>
Index: /temp/trunk/data/lib/slib.php
===================================================================
--- /temp/trunk/data/lib/slib.php	(revision 1328)
+++ /temp/trunk/data/lib/slib.php	(revision 1328)
@@ -0,0 +1,2287 @@
+<?php
+
+//---¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê
+$INC_PATH = realpath( dirname( __FILE__) );
+require_once( $INC_PATH ."/../conf/conf.php" );
+require_once( $INC_PATH ."/../class/SC_DbConn.php" );
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
+sfInitInstall();
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤ÇÀ¸À®¤µ¤ì¤¿PHP¤òÆÉ¤ß½Ð¤¹
+sfLoadUpdateModule();
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
+function sfInitInstall() {
+	if(!defined('ECCUBE_INSTALL')) {
+		if(!ereg("^/install/", $_SERVER['PHP_SELF'])) {
+			header("Location: /install/");
+		}	
+	}
+}
+
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤ÇÀ¸À®¤µ¤ì¤¿PHP¤òÆÉ¤ß½Ð¤·
+function sfLoadUpdateModule() {
+	//DB¤«¤éÀßÄê¾ðÊó¤ò¼èÆÀ
+	$objConn = new SC_DbConn(DEFAULT_DSN);
+	$arrRet = $objConn->getAll("SELECT extern_php FROM dtb_update WHERE main_php = ?",array($_SERVER['PHP_SELF']));
+		
+	if($arrRet[0]['extern_php'] != "") {
+		$path = ROOT_DIR . $arrRet[0]['extern_php'];
+		if(file_exists($path)) {
+			require_once($path);
+		}
+	}
+}
+
+function sf_getBasisData() {
+	//DB¤«¤éÀßÄê¾ðÊó¤ò¼èÆÀ
+	$objConn = new SC_DbConn(DEFAULT_DSN);
+	$result = $objConn->getAll("SELECT * FROM dtb_baseinfo");
+	if(is_array($result[0])) {
+		foreach ( $result[0] as $key=>$value ){
+			$CONF["$key"] = $value;
+		}
+	} else {
+		sfErrorHeader(">> ´ÉÍý²èÌÌ¤«¤é´ðËÜ¾ðÊó¤òÅÐÏ¿¤·¤Æ¤¯¤À¤µ¤¤¡£");
+	}
+	return $CONF;
+}
+
+// Áõ¾þÉÕ¤­¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÉ½¼¨
+function sfErrorHeader($mess) {
+	print("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary=' '>");
+	print("	<tr>");
+	print("<td bgcolor='#ffddaa' height='50' colspan='2' align='center'>");
+	print("<span class='red'><span class='fs12'>" . $mess . "</span></span>");
+	print("</td>");
+	print("	</tr>");
+	print("</table>");	
+}
+
+/* ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨ */
+function sfDispError($type) {
+	
+	class LC_ErrorPage {
+		function LC_ErrorPage() {
+			$this->tpl_mainpage = 'login_error.tpl';
+			$this->tpl_title = '¥¨¥é¡¼';
+		}
+	}
+
+	$objPage = new LC_ErrorPage();
+	$objView = new SC_AdminView();
+	
+	switch ($type) {
+	    case LOGIN_ERROR:
+			$objPage->tpl_error="£É£Ä¤Þ¤¿¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+	    	break;
+		case ACCESS_ERROR:
+			$objPage->tpl_error="¥í¥°¥¤¥óÇ§¾Ú¤ÎÍ­¸ú´ü¸ÂÀÚ¤ì¤Î²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		case AUTH_ERROR:
+			$objPage->tpl_error="¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥¢¥¯¥»¥¹¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		case PAGE_ERROR:
+			$objPage->tpl_error="ÉÔÀµ¤Ê¥Ú¡¼¥¸°ÜÆ°¤Ç¤¹¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		default:
+	    	$objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+	}
+	
+	$objView->assignobj($objPage);
+	$objView->display(LOGIN_FRAME);
+	
+	exit;
+}
+
+/* ¥µ¥¤¥È¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨ */
+function sfDispSiteError($type, $objSiteSess = "") {
+	
+	if ($objSiteSess != "") {
+		$objSiteSess->setNowPage('error');
+	}
+	
+	class LC_ErrorPage {
+		function LC_ErrorPage() {
+			$this->tpl_mainpage = 'error.tpl';
+			$this->tpl_css = '/css/layout/error.css';
+			$this->tpl_title = '¥¨¥é¡¼';
+		}
+	}
+	
+	$objPage = new LC_ErrorPage();
+	$objView = new SC_SiteView();
+	
+	switch ($type) {
+	    case PRODUCT_NOT_FOUND:
+			$objPage->tpl_error="¤´»ØÄê¤Î¥Ú¡¼¥¸¤Ï¤´¤¶¤¤¤Þ¤»¤ó¡£";
+			break;
+		case PAGE_ERROR:
+			$objPage->tpl_error="ÉÔÀµ¤Ê¥Ú¡¼¥¸°ÜÆ°¤Ç¤¹¡£";
+			break;
+		case CART_EMPTY:
+			$objPage->tpl_error="¥«¡¼¥È¤Ë¾¦ÉÊ¤¬¤¬¤¢¤ê¤Þ¤»¤ó¡£";
+			break;
+	    case CART_ADD_ERROR:
+			$objPage->tpl_error="¹ØÆþ½èÍýÃæ¤Ï¡¢¥«¡¼¥È¤Ë¾¦ÉÊ¤òÄÉ²Ã¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£";
+			break;
+		case CANCEL_PURCHASE:
+			$objPage->tpl_error="¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£°Ê²¼¤ÎÍ×°ø¤¬¹Í¤¨¤é¤ì¤Þ¤¹¡£<br />¡¦¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÍ­¸ú´ü¸Â¤¬ÀÚ¤ì¤Æ¤ë¾ì¹ç<br />¡¦¹ØÆþ¼êÂ³¤­Ãæ¤Ë¿·¤·¤¤¹ØÆþ¼êÂ³¤­¤ò¼Â¹Ô¤·¤¿¾ì¹ç<br />¡¦¤¹¤Ç¤Ë¹ØÆþ¼êÂ³¤­¤ò´°Î»¤·¤Æ¤¤¤ë¾ì¹ç";
+			break;
+		case CATEGORY_NOT_FOUND:
+			$objPage->tpl_error="¤´»ØÄê¤Î¥«¥Æ¥´¥ê¤ÏÂ¸ºß¤·¤Þ¤»¤ó¡£";
+			break;
+		case SITE_LOGIN_ERROR:
+			$objPage->tpl_error="¥á¡¼¥ë¥¢¥É¥ì¥¹¤â¤·¤¯¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£";
+			break;
+		case TEMP_LOGIN_ERROR:
+			$objPage->tpl_error="¥á¡¼¥ë¥¢¥É¥ì¥¹¤â¤·¤¯¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />ËÜÅÐÏ¿¤¬¤ªºÑ¤ß¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢²¾ÅÐÏ¿¥á¡¼¥ë¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë<br />URL¤è¤êËÜÅÐÏ¿¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		case CUSTOMER_ERROR:
+			$objPage->tpl_error="ÉÔÀµ¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
+			break;
+		case SOLD_OUT:
+			$objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¤´¹ØÆþ¤ÎÄ¾Á°¤ÇÇä¤êÀÚ¤ì¤¿¾¦ÉÊ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
+			break;
+		case CART_NOT_FOUND:
+			$objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ¾ðÊó¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
+			break;
+		case LACK_POINT:
+			$objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¥Ý¥¤¥ó¥È¤¬ÉÔÂ­¤·¤Æ¤ª¤ê¤Þ¤¹¡£¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
+			break;
+		case FAVORITE_ERROR:
+			$objPage->tpl_error="´û¤Ë¤ªµ¤¤ËÆþ¤ê¤ËÄÉ²Ã¤µ¤ì¤Æ¤¤¤ë¾¦ÉÊ¤Ç¤¹¡£";
+			break;
+		case EXTRACT_ERROR:
+			$objPage->tpl_error="¥Õ¥¡¥¤¥ë¤Î²òÅà¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n»ØÄê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë½ñ¤­¹þ¤ß¸¢¸Â¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+			break;
+		case FTP_DOWNLOAD_ERROR:
+			$objPage->tpl_error="¥Õ¥¡¥¤¥ë¤ÎFTP¥À¥¦¥ó¥í¡¼¥É¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			break;
+		case FTP_LOGIN_ERROR:
+			$objPage->tpl_error="FTP¥í¥°¥¤¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			break;
+		case FTP_CONNECT_ERROR:
+			$objPage->tpl_error="FTP¥í¥°¥¤¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			break;
+		case CREATE_DB_ERROR:
+			$objPage->tpl_error="DB¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n»ØÄê¤Î¥æ¡¼¥¶¡¼¤Ë¤Ï¡¢DBºîÀ®¤Î¸¢¸Â¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+			break;
+		case DB_IMPORT_ERROR:
+			$objPage->tpl_error="¥Ç¡¼¥¿¥Ù¡¼¥¹¹½Â¤¤Î¥¤¥ó¥Ý¡¼¥È¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\nsql¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤ë²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+			break;
+		case FILE_NOT_FOUND:
+			$objPage->tpl_error="»ØÄê¤Î¥Ñ¥¹¤Ë¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£";
+			break;
+		case WRITE_FILE_ERROR:
+			$objPage->tpl_error="ÀßÄê¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤á¤Þ¤»¤ó¡£\nÀßÄê¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤ß¸¢¸Â¤òÍ¿¤¨¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+ 		default:
+	    	$objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+			break;
+	}
+	
+	$objView->assignobj($objPage);
+	$objView->display(SITE_FRAME);
+	exit;
+}
+
+/* Ç§¾Ú¤Î²ÄÈÝÈ½Äê */
+function sfIsSuccess($objSess, $disp_error = true) { 
+	$ret = $objSess->IsSuccess();
+	if($ret != SUCCESS) {
+		if($disp_error) {
+			// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+			sfDispError($ret);
+		}
+		return false;
+	}
+	return true;		
+}
+
+/* Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¤¬¹Ô¤ï¤ì¤¿¤«È½Äê */
+function sfIsPrePage($objSiteSess) {
+	$ret = $objSiteSess->isPrePage();
+	if($ret != true) {
+		// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+		sfDispSiteError(PAGE_ERROR, $objSiteSess);
+	}
+}
+
+function sfCheckNormalAccess($objSiteSess, $objCartSess) {
+	// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+	$uniqid = $objSiteSess->getUniqId();
+	// ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤¿»þ¤Î¥«¡¼¥ÈÆâÍÆ¤¬¥³¥Ô¡¼¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¤ß¥³¥Ô¡¼¤¹¤ë¡£
+	$objCartSess->saveCurrentCart($uniqid);
+	// POST¤Î¥æ¥Ë¡¼¥¯ID¤È¥»¥Ã¥·¥ç¥ó¤Î¥æ¥Ë¡¼¥¯ID¤òÈæ³Ó(¥æ¥Ë¡¼¥¯ID¤¬POST¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¹¥ë¡¼)
+	$ret = $objSiteSess->checkUniqId();
+	if($ret != true) {
+		// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+		sfDispSiteError(CANCEL_PURCHASE, $objSiteSess);
+	}
+	
+	// ¥«¡¼¥ÈÆâ¤¬¶õ¤Ç¤Ê¤¤¤« || ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤«¤éÊÑ²½¤¬¤Ê¤¤¤«
+	$quantity = $objCartSess->getTotalQuantity();
+	$ret = $objCartSess->checkChangeCart();
+	if($ret == true || !($quantity > 0)) {
+		// ¥«¡¼¥È¾ðÊóÉ½¼¨¤Ë¶¯À©°ÜÆ°¤¹¤ë
+		header("Location: ".URL_CART_TOP);
+		exit;
+	}
+	return $uniqid;
+}
+
+/* DBÍÑÆüÉÕÊ¸»úÎó¼èÆÀ */
+function sfGetTimestamp($year, $month, $day, $last = false) {
+	if($year != "" && $month != "" && $day != "") {	
+		if($last) {
+			$time = "23:59:59";
+		} else {
+			$time = "00:00:00";
+		}
+		$date = $year."-".$month."-".$day." ".$time;
+	} else {
+		$date = "";
+	}
+	return 	$date;
+}
+
+// INT·¿¤Î¿ôÃÍ¥Á¥§¥Ã¥¯
+function sfIsInt($value) {
+	if($value != "" && strlen($value) <= INT_LEN && is_numeric($value)) {
+		return true;
+	}
+	return false;
+}
+
+function sfCSVDownload($data, $prefix = ""){
+	
+	if($prefix == "") {
+		$dir_name = sfUpDirName();
+		$file_name = $dir_name . date("ymdHis") .".csv";
+	} else {
+		$file_name = $prefix . date("ymdHis") .".csv";
+	}
+	
+	/* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */
+	Header("Content-disposition: attachment; filename=${file_name}");
+	Header("Content-type: application/octet-stream; name=${file_name}");
+	Header("Cache-Control: ");
+	Header("Pragma: ");
+	
+	
+	/* i18n¢· ¤À¤ÈÀµ¾ï¤ËÆ°ºî¤·¤Ê¤¤¤¿¤á¡¢mb¢· ¤ËÊÑ¹¹
+	if (i18n_discover_encoding($data) == 'EUC-JP'){
+		$data = i18n_convert($data,'SJIS','EUC-JP');
+	}
+	*/
+	if (mb_internal_encoding() == 'EUC-JP'){
+		$data = mb_convert_encoding($data,'SJIS','EUC-JP');
+	}
+	
+	/* ¥Ç¡¼¥¿¤ò½ÐÎÏ */
+	echo $data;
+}
+
+/* 1³¬ÁØ¾å¤Î¥Ç¥£¥ì¥¯¥È¥êÌ¾¤ò¼èÆÀ¤¹¤ë */
+function sfUpDirName() {
+	$path = $_SERVER['PHP_SELF'];
+	$arrVal = split("/", $path);
+	$cnt = count($arrVal);
+	return $arrVal[($cnt - 2)];
+}
+
+// ¸½ºß¤Î¥µ¥¤¥È¤ò¹¹¿·¡Ê¤¿¤À¤·¥Ý¥¹¥È¤Ï¹Ô¤ï¤Ê¤¤¡Ë
+function sfReload($get = "") {
+	if ($_SERVER["SERVER_PORT"] == "443" ){
+		$protocol = "https";
+	} else {
+		$protocol = "http";
+	}
+		
+	if($get != "") {
+		header("Location: ".$protocol."://" .$_SERVER["SERVER_NAME"] . $_SERVER['PHP_SELF'] . "?" . $get);
+	} else {
+		header("Location: ".$protocol."://" .$_SERVER["SERVER_NAME"] . $_SERVER['PHP_SELF']);
+	}
+	exit;
+}
+
+// ¥é¥ó¥­¥ó¥°¤ò¾å¤²¤ë¡£
+function sfRankUp($table, $colname, $id, $andwhere = "") {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$where = "$colname = ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	// ÂÐ¾Ý¹àÌÜ¤Î¥é¥ó¥¯¤ò¼èÆÀ
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+	// ¥é¥ó¥¯¤ÎºÇÂçÃÍ¤ò¼èÆÀ
+	$maxrank = $objQuery->max($table, "rank", $andwhere);
+	// ¥é¥ó¥¯¤¬ºÇÂçÃÍ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank < $maxrank) {
+		// ¥é¥ó¥¯¤¬°ì¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$where = "rank = ?";
+		if($andwhere != "") {
+			$where.= " AND $andwhere";
+		}
+		$uprank = $rank + 1;
+		$up_id = $objQuery->get($table, $colname, $where, array($uprank));
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$sqlup = "UPDATE $table SET rank = ?, update_date = Now() WHERE $colname = ?";
+		$objQuery->exec($sqlup, array($rank + 1, $id));
+		$objQuery->exec($sqlup, array($rank, $up_id));
+	}
+	$objQuery->commit();
+}
+
+// ¥é¥ó¥­¥ó¥°¤ò²¼¤²¤ë¡£
+function sfRankDown($table, $colname, $id, $andwhere = "") {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$where = "$colname = ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	// ÂÐ¾Ý¹àÌÜ¤Î¥é¥ó¥¯¤ò¼èÆÀ
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+		
+	// ¥é¥ó¥¯¤¬1(ºÇ¾®ÃÍ)¤è¤ê¤âÂç¤­¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank > 1) {
+		// ¥é¥ó¥¯¤¬°ì¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$where = "rank = ?";
+		if($andwhere != "") {
+			$where.= " AND $andwhere";
+		}
+		$downrank = $rank - 1;
+		$down_id = $objQuery->get($table, $colname, $where, array($downrank));
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$sqlup = "UPDATE $table SET rank = ?, update_date = Now() WHERE $colname = ?";
+		$objQuery->exec($sqlup, array($rank - 1, $id));
+		$objQuery->exec($sqlup, array($rank, $down_id));
+	}
+	$objQuery->commit();
+}
+
+//----¡¡»ØÄê½ç°Ì¤Ø°ÜÆ°
+function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = "") {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+		
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë
+	$rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ?", array($keyId));	
+	$max = $objQuery->max($tableName, "rank", $where);
+		
+	// ÃÍ¤ÎÄ´À°¡ÊµÕ½ç¡Ë
+	if($pos > $max) {
+		$position = 1;
+	} else if($pos < 1) {
+		$position = $max;
+	} else {
+		$position = $max - $pos + 1;
+	}
+	
+	if( $position > $rank ) $term = "rank - 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤êÂç¤­¤¤¾ì¹ç
+	if( $position < $rank ) $term = "rank + 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤ê¾®¤µ¤¤¾ì¹ç
+
+	//--¡¡»ØÄê¤·¤¿½ç°Ì¤Î¾¦ÉÊ¤«¤é°ÜÆ°¤µ¤»¤ë¾¦ÉÊ¤Þ¤Ç¤Îrank¤ò£±¤Ä¤º¤é¤¹
+	$sql = "UPDATE $tableName SET rank = $term, update_date = NOW() WHERE rank BETWEEN ? AND ? AND delete = 0";
+	if($where != "") {
+		$sql.= " AND $where";
+	}
+	
+	if( $position > $rank ) $objQuery->exec( $sql, array( $rank + 1, $position ));
+	if( $position < $rank ) $objQuery->exec( $sql, array( $position, $rank - 1 ));
+
+	//-- »ØÄê¤·¤¿½ç°Ì¤Ørank¤ò½ñ¤­´¹¤¨¤ë¡£
+	$sql  = "UPDATE $tableName SET rank = ?, update_date = NOW() WHERE $keyIdColumn = ? AND delete = 0 ";
+	if($where != "") {
+		$sql.= " AND $where";
+	}
+	
+	$objQuery->exec( $sql, array( $position, $keyId ) );
+	$objQuery->commit();
+}
+
+// ¥é¥ó¥¯¤ò´Þ¤à¥ì¥³¡¼¥É¤Îºï½ü
+// ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¾ì¹ç¤Ï¡¢$delete¤òtrue¤Ë¤¹¤ë¡£
+function sfDeleteRankRecord($table, $colname, $id, $andwhere = "", $delete = false) {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	// ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£		
+	$where = "$colname = ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+
+	if(!$delete) {
+		// ¥é¥ó¥¯¤òºÇ²¼°Ì¤Ë¤¹¤ë¡¢DEL¥Õ¥é¥°ON
+		$sqlup = "UPDATE $table SET rank = 0, delete = 1, update_date = Now() ";
+		$sqlup.= "WHERE $colname = ?";
+		// UPDATE¤Î¼Â¹Ô
+		$objQuery->exec($sqlup, array($id));
+	} else {
+		$objQuery->delete($table, "$colname = ?", array($id));
+	}
+	
+	// ÄÉ²Ã¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤º¤é¤¹¡£
+	$where = "rank > ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	$sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where";
+	$objQuery->exec($sqlup, array($rank));
+	$objQuery->commit();
+}
+
+// ¥ì¥³¡¼¥É¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+function sfIsRecord($table, $col, $arrval, $addwhere = "") {
+	$objQuery = new SC_Query();
+	$arrCol = split("[, ]", $col);
+		
+	$where = "delete = 0";
+	
+	if($addwhere != "") {
+		$where.= " AND $addwhere";
+	}
+		
+	foreach($arrCol as $val) {
+		if($val != "") {
+			if($where == "") {
+				$where = "$val = ?";
+			} else {
+				$where.= " AND $val = ?";
+			}
+		}
+	}
+	$ret = $objQuery->get($table, $col, $where, $arrval);
+	
+	if($ret != "") {
+		return true;
+	}
+	return false;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Þ¡¼¥¸
+function sfMergeCBValue($keyname, $max) {
+	$conv = "";
+	$cnt = 1;
+	for($cnt = 1; $cnt <= $max; $cnt++) {
+		if ($_POST[$keyname . $cnt] == "1") {
+			$conv.= "1";
+		} else {
+			$conv.= "0";
+		}
+	}
+	return $conv;
+}
+
+// html_checkboxes¤ÎÃÍ¤ò¥Þ¡¼¥¸¤·¤Æ2¿Ê¿ô·Á¼°¤ËÊÑ¹¹¤¹¤ë¡£
+function sfMergeCheckBoxes($array, $max) {
+	$ret = "";
+	if(is_array($array)) {	
+		foreach($array as $val) {
+			$arrTmp[$val] = "1";
+		}
+	}
+	for($i = 1; $i <= $max; $i++) {	
+		if($arrTmp[$i] == "1") {
+			$ret.= "1";
+		} else {
+			$ret.= "0";
+		}
+	}
+	return $ret;
+}
+
+
+// html_checkboxes¤ÎÃÍ¤ò¥Þ¡¼¥¸¤·¤Æ¡Ö-¡×¤Ç¤Ä¤Ê¤²¤ë¡£
+function sfMergeParamCheckBoxes($array) {
+	if(is_array($array)) {
+		foreach($array as $val) {
+			if($ret != "") {
+				$ret.= "-$val";
+			} else {
+				$ret = $val;			
+			}
+		}
+	} else {
+		$ret = $array;
+	}
+	return $ret;
+}
+
+// html_checkboxes¤ÎÃÍ¤ò¥Þ¡¼¥¸¤·¤ÆSQL¸¡º÷ÍÑ¤ËÊÑ¹¹¤¹¤ë¡£
+function sfSearchCheckBoxes($array) {
+	$max = 0;
+	$ret = "";
+	foreach($array as $val) {
+		$arrTmp[$val] = "1";
+		if($val > $max) {
+			$max = $val;
+		}
+	}
+	for($i = 1; $i <= $max; $i++) {	
+		if($arrTmp[$i] == "1") {
+			$ret.= "1";
+		} else {
+			$ret.= "_";
+		}
+	}
+	
+	if($ret != "") {	
+		$ret.= "%";
+	}
+	return $ret;
+}
+
+// 2¿Ê¿ô·Á¼°¤ÎÃÍ¤òhtml_checkboxesÂÐ±þ¤ÎÃÍ¤ËÀÚ¤êÂØ¤¨¤ë
+function sfSplitCheckBoxes($val) {
+	$len = strlen($val);
+	for($i = 0; $i < $len; $i++) {
+		if(substr($val, $i, 1) == "1") {
+			$arrRet[] = ($i + 1);
+		}
+	}
+	return $arrRet;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Þ¡¼¥¸
+function sfMergeCBSearchValue($keyname, $max) {
+	$conv = "";
+	$cnt = 1;
+	for($cnt = 1; $cnt <= $max; $cnt++) {
+		if ($_POST[$keyname . $cnt] == "1") {
+			$conv.= "1";
+		} else {
+			$conv.= "_";
+		}
+	}
+	return $conv;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤òÊ¬²ò
+function sfSplitCBValue($val, $keyname = "") {
+	$len = strlen($val);
+	$no = 1;
+	for ($cnt = 0; $cnt < $len; $cnt++) {
+		if($keyname != "") {
+			$arr[$keyname . $no] = substr($val, $cnt, 1);
+		} else {
+			$arr[] = substr($val, $cnt, 1);
+		}
+		$no++;
+	}
+	return $arr;
+}
+
+// ¥­¡¼¤ÈÃÍ¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ
+function sfArrKeyValue($arrList, $keyname, $valname, $len_max = "", $keysize = "") {
+	
+	$max = count($arrList);
+	
+	if($len_max != "" && $max > $len_max) {
+		$max = $len_max;
+	}
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($keysize != "") {
+			$key = sfCutString($arrList[$cnt][$keyname], $keysize);
+		} else {
+			$key = $arrList[$cnt][$keyname];
+		}
+		$val = $arrList[$cnt][$valname];
+		
+		if(!isset($arrRet[$key])) {
+			$arrRet[$key] = $val;
+		}
+		
+	}
+	return $arrRet;
+}
+
+// ¥­¡¼¤ÈÃÍ¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ(ÃÍ¤¬Ê£¿ô¤Î¾ì¹ç)
+function sfArrKeyValues($arrList, $keyname, $valname, $len_max = "", $keysize = "", $connect = "") {
+	
+	$max = count($arrList);
+	
+	if($len_max != "" && $max > $len_max) {
+		$max = $len_max;
+	}
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($keysize != "") {
+			$key = sfCutString($arrList[$cnt][$keyname], $keysize);
+		} else {
+			$key = $arrList[$cnt][$keyname];
+		}
+		$val = $arrList[$cnt][$valname];
+		
+		if($connect != "") {
+			$arrRet[$key].= "$val".$connect;
+		} else {
+			$arrRet[$key][] = $val;		
+		}
+	}
+	return $arrRet;
+}
+
+// ÇÛÎó¤ÎÃÍ¤ò¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊÖ¤¹¡£
+function sfGetCommaList($array) {
+	if (count($array) > 0) {
+		foreach($array as $val) {
+			$line .= $val . ", ";
+		}
+		$line = ereg_replace(", $", "", $line);
+		return $line;
+	}else{
+		return false;
+	}
+	
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤òCSV¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎÏ¤¹¤ë¡£*/
+function sfGetCSVList($array) {
+	if (count($array) > 0) {
+		foreach($array as $key => $val) {
+			$line .= "\"".$val."\",";
+		}
+		$line = ereg_replace(",$", "\n", $line);
+		return $line;
+	}else{
+		return false;
+	}
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤òPDF¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎÏ¤¹¤ë¡£*/
+function sfGetPDFList($array) {
+	foreach($array as $key => $val) {
+		$line .= "\t".$val;
+	}
+	$line.="\n";
+	return $line;
+}
+
+
+
+/*-----------------------------------------------------------------*/
+/*	check_set_term
+/*	Ç¯·îÆü¤ËÊÌ¤ì¤¿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ­¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ­¤È´ü´Ö¤òÊÖ¤¹
+/*¡¡°ú¿ô (³«»ÏÇ¯,³«»Ï·î,³«»ÏÆü,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü)
+/*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
+/*  		£±¡¥³«»ÏÇ¯·îÆü (YYYY/MM/DD 000000)
+/*			£²¡¥½ªÎ»Ç¯·îÆü (YYYY/MM/DD 235959)
+/*			£³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
+/*-----------------------------------------------------------------*/
+function sfCheckSetTerm ( $start_year, $start_month, $start_day, $end_year, $end_month, $end_day ) {
+
+	// ´ü´Ö»ØÄê
+	$error = 0;
+	if ( $start_month || $start_day || $start_year){
+		if ( ! checkdate($start_month, $start_day , $start_year) ) $error = 1;
+	} else {
+		$error = 1;
+	}
+	if ( $end_month || $end_day || $end_year){
+		if ( ! checkdate($end_month ,$end_day ,$end_year) ) $error = 2;
+	}
+	if ( ! $error ){
+		$date1 = $start_year ."/".sprintf("%02d",$start_month) ."/".sprintf("%02d",$start_day) ." 000000";
+		$date2 = $end_year   ."/".sprintf("%02d",$end_month)   ."/".sprintf("%02d",$end_day)   ." 235959";
+		if ($date1 > $date2) $error = 3;
+	} else {
+		$error = 1;
+	}
+	return array($date1, $date2, $error);
+}
+
+// ¥¨¥é¡¼²Õ½ê¤ÎÇØ·Ê¿§¤òÊÑ¹¹¤¹¤ë¤¿¤á¤Îfunction SC_View¤ÇÆÉ¤ß¹þ¤à
+function sfSetErrorStyle(){
+	return 'style="background-color:'.ERR_COLOR.'"';
+}
+
+/* DB¤ËÅÏ¤¹¿ôÃÍ¤Î¥Á¥§¥Ã¥¯
+ * 10·å°Ê¾å¤Ï¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥¨¥é¡¼¤òµ¯¤³¤¹¤Î¤Ç¡£
+ */
+function sfCheckNumLength( $value ){
+	if ( ! is_numeric($value)  ){
+		return false;
+	} 
+	
+	if ( strlen($value) > 9 ) {
+		return false;
+	}
+	
+	return true;
+}
+
+// °ìÃ×¤·¤¿ÃÍ¤Î¥­¡¼Ì¾¤ò¼èÆÀ
+function sfSearchKey($array, $word, $default) {
+	foreach($array as $key => $val) {
+		if($val == $word) {
+			return $key;
+		}
+	}
+	return $default;
+}
+
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ($products_check:true¾¦ÉÊÅÐÏ¿ºÑ¤ß¤Î¤â¤Î¤À¤±¼èÆÀ)
+function sfGetCategoryList($addwhere = "", $products_check = false) {
+	$objQuery = new SC_Query();
+	$where = "delete = 0";
+	
+	if($addwhere != "") {
+		$where.= " AND $addwhere";
+	}
+		
+	$objQuery->setoption("ORDER BY rank DESC");
+	
+	if($products_check) {
+		$col = "T1.category_id, category_name, level";
+		$from = "dtb_category AS T1 LEFT JOIN dtb_category_total_count AS T2 ON T1.category_id = T2.category_id";
+		$where .= " AND product_count > 0";
+	} else {
+		$col = "category_id, category_name, level";
+		$from = "dtb_category";
+	}
+	
+	$arrRet = $objQuery->select($col, $from, $where);
+			
+	$max = count($arrRet);
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		$id = $arrRet[$cnt]['category_id'];
+		$name = $arrRet[$cnt]['category_name'];
+		$arrList[$id] = "";
+		for($n = 1; $n < $arrRet[$cnt]['level']; $n++) {
+			$arrList[$id].= "¡¡";
+		}
+		if($arrRet[$cnt]['level'] != LEVEL_MAX) {
+			$arrList[$id].= CATEGORY_HEAD;
+		}
+		$arrList[$id].= $name;
+	}
+	return $arrList;
+}
+
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ¡Ê¿Æ¥«¥Æ¥´¥ê¤ÎValue:0)
+function sfGetLevelCatList() {
+	$objQuery = new SC_Query();
+	$col = "category_id, category_name, level";
+	$where = "delete = 0";
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, "dtb_category", $where);
+	$max = count($arrRet);
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($arrRet[$cnt]['level'] == LEVEL_MAX) {
+			$arrValue[$cnt] = $arrRet[$cnt]['category_id'];
+		} else {
+			$arrValue[$cnt] = ""; 
+		}
+		
+		$arrOutput[$cnt] = "";
+			 		
+		for($n = 1; $n < $arrRet[$cnt]['level']; $n++) {
+			$arrOutput[$cnt].= "¡¡";
+		}
+		
+		if($arrRet[$cnt]['level'] != LEVEL_MAX) {
+			$arrOutput[$cnt].= CATEGORY_HEAD;
+		}
+		$arrOutput[$cnt].= $arrRet[$cnt]['category_name'];
+	}
+	return array($arrValue, $arrOutput);
+}
+
+function sfGetErrorColor($val) {
+	if($val != "") {
+		return "background-color:" . ERR_COLOR;
+	}
+	return "";
+}
+
+
+function sfGetEnabled($val) {
+	if( ! $val ) {
+		return " disabled=\"disabled\"";
+	}
+	return "";
+}
+
+function sfGetChecked($param, $value) {
+	if($param == $value) {
+		return "checked=\"checked\"";
+	}
+	return "";
+}
+
+// SELECT¥Ü¥Ã¥¯¥¹ÍÑ¥ê¥¹¥È¤ÎºîÀ®
+function sfGetIDValueList($table, $keyname, $valname) {
+	$objQuery = new SC_Query();
+	$col = "$keyname, $valname";
+	$objQuery->setwhere("delete = 0");
+	$objQuery->setorder("rank DESC");
+	$arrList = $objQuery->select($col, $table);
+	$count = count($arrList);
+	for($cnt = 0; $cnt < $count; $cnt++) {
+		$key = $arrList[$cnt][$keyname];
+		$val = $arrList[$cnt][$valname];
+		$arrRet[$key] = $val;
+	}
+	return $arrRet;
+}
+
+function sfTrim($str) {
+	$ret = ereg_replace("^[¡¡ \n\r]*", "", $str);
+	$ret = ereg_replace("[¡¡ \n\r]*$", "", $ret);
+	return $ret;
+}
+
+/* ½êÂ°¤¹¤ë¤¹¤Ù¤Æ¤Î³¬ÁØ¤Î¿ÆID¤òÇÛÎó¤ÇÊÖ¤¹ */
+function sfGetParents($objQuery, $table, $pid_name, $id_name, $id) {
+	$arrRet = sfGetParentsArray($table, $pid_name, $id_name, $id);
+	// ÇÛÎó¤ÎÀèÆ¬1¤Ä¤òºï½ü¤¹¤ë¡£
+	array_shift($arrRet);
+	return $arrRet;
+}
+
+
+/* ¿ÆID¤ÎÇÛÎó¤ò¸µ¤ËÆÃÄê¤Î¥«¥é¥à¤ò¼èÆÀ¤¹¤ë¡£*/
+function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId ) {
+	$col = $col_name;
+	$len = count($arrId);
+	$where = "";
+	
+	for($cnt = 0; $cnt < $len; $cnt++) {
+		if($where == "") {
+			$where = "$id_name = ?";
+		} else {
+			$where.= " OR $id_name = ?";
+		}
+	}
+	
+	$objQuery->setorder("level");
+	$arrRet = $objQuery->select($col, $table, $where, $arrId);
+	return $arrRet;	
+}
+
+/* »ÒID¤ÎÇÛÎó¤òÊÖ¤¹ */
+function sfGetChildsID($table, $pid_name, $id_name, $id) {
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);
+	return $arrRet;
+}
+
+/* ¥«¥Æ¥´¥êÊÑ¹¹»þ¤Î°ÜÆ°½èÍý */
+function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id) {
+	if ($old_catid == $new_catid) {
+		return;
+	}
+	// µì¥«¥Æ¥´¥ê¤Ç¤Î¥é¥ó¥¯ºï½ü½èÍý
+	// °ÜÆ°¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£		
+	$where = "$id_name = ?";
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+	// ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä²¼¤Ë¤º¤é¤¹¡£
+	$where = "rank > ? AND $cat_name = ?";
+	$sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where";
+	$objQuery->exec($sqlup, array($rank, $old_catid));
+	// ¿·¥«¥Æ¥´¥ê¤Ç¤ÎÅÐÏ¿½èÍý
+	// ¿·¥«¥Æ¥´¥ê¤ÎºÇÂç¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$max_rank = $objQuery->max($table, "rank", "$cat_name = ?", array($new_catid)) + 1;
+	$where = "$id_name = ?";
+	$sqlup = "UPDATE $table SET rank = ? WHERE $where";
+	$objQuery->exec($sqlup, array($max_rank, $id));
+}
+
+/* ÀÇ¶â·×»» */
+function sfTax($price, $tax, $tax_rule) {
+	$real_tax = $tax / 100;
+	$ret = $price * $real_tax;
+	switch($tax_rule) {
+	// »Í¼Î¸ÞÆþ
+	case 1:
+		$ret = round($ret);
+		break;
+	// ÀÚ¤ê¼Î¤Æ
+	case 2:
+		$ret = floor($ret);
+		break;
+	// ÀÚ¤ê¾å¤²
+	case 3:
+		$ret = ceil($ret);
+		break;
+	// ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
+	default:
+		$ret = ceil($ret);
+		break;
+	}
+	return $ret;
+}
+
+/* ÀÇ¶âÉÕÍ¿ */
+function sfPreTax($price, $tax, $tax_rule) {
+	$real_tax = $tax / 100;
+	$ret = $price * (1 + $real_tax);
+	switch($tax_rule) {
+	// »Í¼Î¸ÞÆþ
+	case 1:
+		$ret = round($ret);
+		break;
+	// ÀÚ¤ê¼Î¤Æ
+	case 2:
+		$ret = floor($ret);
+		break;
+	// ÀÚ¤ê¾å¤²
+	case 3:
+		$ret = ceil($ret);
+		break;
+	// ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
+	default:
+		$ret = ceil($ret);
+		break;
+	}
+	return $ret;
+}
+
+/* ¥Ý¥¤¥ó¥ÈÉÕÍ¿ */
+function sfPrePoint($price, $point_rate, $rule = POINT_RULE, $product_id = "") {
+	if(sfIsInt($product_id)) {
+		$objQuery = new SC_Query();
+		$where = "to_char(now(),'YYYY/MM/DD/HH24') >= to_char(start_date,'YYYY/MM/DD/HH24') AND ";
+		$where .= "to_char(now(),'YYYY/MM/DD/HH24') < to_char(end_date,'YYYY/MM/DD/HH24') AND ";
+		$where .= "delete = 0 AND campaign_id IN (SELECT campaign_id FROM dtb_campaign_detail where product_id = ? )";
+		//ÅÐÏ¿(¹¹¿·)ÆüÉÕ½ç
+		$objQuery->setorder('update_date DESC');
+		//¥­¥ã¥ó¥Ú¡¼¥ó¥Ý¥¤¥ó¥È¤Î¼èÆÀ
+		$arrRet = $objQuery->select("campaign_name, campaign_point_rate", "dtb_campaign", $where, array($product_id));
+	}
+	//Ê£¿ô¤Î¥­¥ã¥ó¥Ú¡¼¥ó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾¦ÉÊ¤Ï¡¢ºÇ¿·¤Î¥­¥ã¥ó¥Ú¡¼¥ó¤«¤é¥Ý¥¤¥ó¥È¤ò¼èÆÀ
+	if($arrRet[0]['campaign_point_rate'] != "") {
+		$campaign_point_rate = $arrRet[0]['campaign_point_rate'];
+		$real_point = $campaign_point_rate / 100;
+	} else {
+		$real_point = $point_rate / 100;
+	}
+	$ret = $price * $real_point;
+	switch($rule) {
+	// »Í¼Î¸ÞÆþ
+	case 1:
+		$ret = round($ret);
+		break;
+	// ÀÚ¤ê¼Î¤Æ
+	case 2:
+		$ret = floor($ret);
+		break;
+	// ÀÚ¤ê¾å¤²
+	case 3:
+		$ret = ceil($ret);
+		break;
+	// ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
+	default:
+		$ret = ceil($ret);
+		break;
+	}
+	//¥­¥ã¥ó¥Ú¡¼¥ó¾¦ÉÊ¤Î¾ì¹ç
+	if($campaign_point_rate != "") {
+		$ret = "(".$arrRet[0]['campaign_name']."¥Ý¥¤¥ó¥ÈÎ¨".$campaign_point_rate."%)".$ret;
+	}
+	return $ret;
+}
+
+/* µ¬³ÊÊ¬Îà¤Î·ï¿ô¼èÆÀ */
+function sfGetClassCatCount() {
+	$sql = "select count(dtb_class.class_id), dtb_class.class_id ";
+	$sql.= "from dtb_class inner join dtb_classcategory on dtb_class.class_id = dtb_classcategory.class_id ";
+	$sql.= "where dtb_class.delete = 0 AND dtb_classcategory.delete = 0 ";
+	$sql.= "group by dtb_class.class_id, dtb_class.name;";
+	$objQuery = new SC_Query();
+	$arrList = $objQuery->getall($sql);
+	// ¥­¡¼¤ÈÃÍ¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ
+	$arrRet = sfArrKeyValue($arrList, 'class_id', 'count');
+	return $arrRet;
+}
+
+/* µ¬³Ê¤ÎÅÐÏ¿ */
+function sfInsertProductClass($objQuery, $arrList, $product_id) {
+	// ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	$where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
+	$count = $objQuery->count("dtb_products_class", $where,  array($product_id));
+	
+	// ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤Ê¤¤¾ì¹ç
+	if($count == 0) {
+		// ´ûÂ¸µ¬³Ê¤Îºï½ü
+		$where = "product_id = ?";
+		$objQuery->delete("dtb_products_class", $where, array($product_id));
+		$sqlval['product_id'] = $product_id;
+		$sqlval['classcategory_id1'] = '0';
+		$sqlval['classcategory_id2'] = '0';
+		$sqlval['product_code'] = $arrList["product_code"];
+		$sqlval['stock'] = $arrList["stock"];
+		$sqlval['stock_unlimited'] = $arrList["stock_unlimited"];
+		$sqlval['price01'] = $arrList['price01'];
+		$sqlval['price02'] = $arrList['price02'];
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		
+		if($_SESSION['member_id'] == "") {
+			$sqlval['creator_id'] = '0';
+		}
+		
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_products_class", $sqlval);
+	}
+}
+
+function sfGetProductClassId($product_id, $classcategory_id1, $classcategory_id2) {
+	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+	$objQuery = new SC_Query();
+	$ret = $objQuery->get("dtb_products_class", "product_class_id", $where, Array($product_id, $classcategory_id1, $classcategory_id2));
+	return $ret;
+}
+
+/* Ê¸Ëö¤Î¡Ö/¡×¤ò¤Ê¤¯¤¹ */
+function sfTrimURL($url) {
+	$ret = ereg_replace("[/]+$", "", $url);
+	return $ret;
+}
+
+/* ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ */
+function sfGetProductsClass($arrID) {
+	list($product_id, $classcategory_id1, $classcategory_id2) = $arrID;	
+	
+	if($classcategory_id1 == "") {
+		$classcategory_id1 = '0';
+	}
+	if($classcategory_id2 == "") {
+		$classcategory_id2 = '0';
+	}
+		
+	// ¾¦ÉÊµ¬³Ê¼èÆÀ
+	$objQuery = new SC_Query();
+	$col = "product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit, sale_unlimited";
+	$table = "vw_product_class";
+	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+	$objQuery->setorder("rank1 DESC, rank2 DESC");
+	$arrRet = $objQuery->select($col, $table, $where, array($product_id, $classcategory_id1, $classcategory_id2));
+	return $arrRet[0];
+}
+
+/* ½¸·×¾ðÊó¤ò¸µ¤ËºÇ½ª·×»» */
+function sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer = "") {
+	// ¾¦ÉÊ¤Î¹ç·×¸Ä¿ô
+	$total_quantity = $objCartSess->getTotalQuantity(true);
+	
+	// ÀÇ¶â¤Î¼èÆÀ
+	$arrData['tax'] = $objPage->tpl_total_tax;
+	// ¾®·×¤Î¼èÆÀ
+	$arrData['subtotal'] = $objPage->tpl_total_pretax;	
+	
+	// ¹ç·×Á÷ÎÁ¤Î¼èÆÀ
+	$arrData['deliv_fee'] = 0;
+		
+	// ¾¦ÉÊ¤´¤È¤ÎÁ÷ÎÁ¤¬Í­¸ú¤Î¾ì¹ç
+	if (OPTION_PRODUCT_DELIV_FEE == 1) {
+		$arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee();
+	}
+	
+	// ÇÛÁ÷¶È¼Ô¤ÎÁ÷ÎÁ¤¬Í­¸ú¤Î¾ì¹ç
+	if (OPTION_DELIV_FEE == 1) {
+		// Á÷ÎÁ¤Î¹ç·×¤ò·×»»¤¹¤ë
+		$arrData['deliv_fee']+= sfGetDelivFee($arrData['deliv_pref'], $arrData['payment_id']);
+	}
+	
+	// Á÷ÎÁÌµÎÁ¤Î¹ØÆþ¿ô¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if(DELIV_FREE_AMOUNT > 0) {
+		if($total_quantity >= DELIV_FREE_AMOUNT) {
+			$arrData['deliv_fee'] = 0;
+		}	
+	}
+		
+	// Á÷ÎÁÌµÎÁ¾ò·ï¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if($arrInfo['free_rule'] > 0) {
+		// ¾®·×¤¬ÌµÎÁ¾ò·ï¤òÄ¶¤¨¤Æ¤¤¤ë¾ì¹ç
+		if($arrData['subtotal'] >= $arrInfo['free_rule']) {
+			$arrData['deliv_fee'] = 0;
+		}
+	}
+
+	// ¹ç·×¤Î·×»»
+	$arrData['total'] = $objPage->tpl_total_pretax;	// ¾¦ÉÊ¹ç·×
+	$arrData['total']+= $arrData['deliv_fee'];		// Á÷ÎÁ
+	$arrData['total']+= $arrData['charge'];			// ¼ê¿ôÎÁ
+	// ¤ª»ÙÊ§¤¤¹ç·×
+	$arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE);
+	// ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»
+	$arrData['add_point'] = sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo);
+	
+	if($objCustomer != "") {
+		// ÃÂÀ¸Æü·î¤Ç¤¢¤Ã¤¿¾ì¹ç
+		if($objCustomer->isBirthMonth()) {
+			$arrData['birth_point'] = BIRTH_MONTH_POINT;
+			$arrData['add_point'] += $arrData['birth_point'];
+		}
+	}
+	
+	if($arrData['add_point'] < 0) {
+		$arrData['add_point'] = 0;
+	}
+	
+	return $arrData;
+}
+
+/* ¥«¡¼¥ÈÆâ¾¦ÉÊ¤Î½¸·×½èÍý */
+function sfTotalCart($objPage, $objCartSess, $arrInfo) {
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	
+	$objPage->tpl_total_pretax = 0;		// ÈñÍÑ¹ç·×(ÀÇ¹þ¤ß)
+	$objPage->tpl_total_tax = 0;		// ¾ÃÈñÀÇ¹ç·×
+	$objPage->tpl_total_point = 0;		// ¥Ý¥¤¥ó¥È¹ç·×
+	
+	// ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
+	$arrCart = $objCartSess->getCartList();
+	$max = count($arrCart);
+	$cnt = 0;
+
+	for ($i = 0; $i < $max; $i++) {
+		// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+		$arrData = sfGetProductsClass($arrCart[$i]['id']);
+				
+		// DB¤ËÂ¸ºß¤¹¤ë¾¦ÉÊ
+		if (count($arrData) > 0) {
+			
+			// ¹ØÆþÀ©¸Â¿ô¤òµá¤á¤ë¡£			
+			if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') {
+				if($arrData['sale_limit'] < $arrData['stock']) {
+					$limit = $arrData['sale_limit'];
+				} else {
+					$limit = $arrData['stock'];
+				}
+			} else {
+				if ($arrData['sale_unlimited'] != '1') {
+					$limit = $arrData['sale_limit'];
+				}
+				if ($arrData['stock_unlimited'] != '1') {
+					$limit = $arrData['stock'];
+				}
+			}
+						
+			if($limit != "" && $limit < $arrCart[$i]['quantity']) {
+				// ¥«¡¼¥ÈÆâ¾¦ÉÊ¿ô¤òÀ©¸Â¤Ë¹ç¤ï¤»¤ë
+				$objCartSess->setProductValue($arrCart[$i]['id'], 'quantity', $limit);
+				$quantity = $limit;
+				$objPage->tpl_message = "¢¨¡Ö" . $arrData['name'] . "¡×¤ÏÈÎÇäÀ©¸Â¤·¤Æ¤ª¤ê¤Þ¤¹¡¢°ìÅÙ¤Ë¤³¤ì°Ê¾å¤Î¹ØÆþ¤Ï¤Ç¤­¤Þ¤»¤ó¡£";
+			} else {
+				$quantity = $arrCart[$i]['quantity'];
+			}
+			
+			$objPage->arrProductsClass[$cnt] = $arrData;
+			$objPage->arrProductsClass[$cnt]['quantity'] = $quantity;
+			$objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart[$i]['cart_no'];
+			$objPage->arrProductsClass[$cnt]['class_name1'] = $arrClassName[$arrData['class_id1']];
+			$objPage->arrProductsClass[$cnt]['class_name2'] = $arrClassName[$arrData['class_id2']];
+			$objPage->arrProductsClass[$cnt]['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
+			$objPage->arrProductsClass[$cnt]['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
+			
+			// ²Á³Ê¤ÎÅÐÏ¿
+			if ($arrData['price02'] != "") {
+				$objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price02']);
+				$objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price02'];
+			} else {
+				$objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price01']);
+				$objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price01'];
+			}
+			// ¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨¤ÎÅÐÏ¿
+			$objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']);
+			// ¾¦ÉÊ¤´¤È¤Î¹ç·×¶â³Û
+			$objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrInfo, $arrCart[$i]['id']);
+			// Á÷ÎÁ¤Î¹ç·×¤ò·×»»¤¹¤ë
+			$objPage->tpl_total_deliv_fee+= ($arrData['deliv_fee'] * $arrCart[$i]['quantity']);
+			$cnt++;
+		} else {
+			// DB¤Ë¾¦ÉÊ¤¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¤Ï¥«¡¼¥È¾¦ÉÊ¤Îºï½ü
+			$objCartSess->delProductKey('id', $arrCart[$i]['id']);
+		}
+	}
+	
+	// Á´¾¦ÉÊ¹ç·×¶â³Û(ÀÇ¹þ¤ß)
+	$objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+	// Á´¾¦ÉÊ¹ç·×¾ÃÈñÀÇ
+	$objPage->tpl_total_tax = $objCartSess->getAllProductsTax($arrInfo);
+	// Á´¾¦ÉÊ¹ç·×¥Ý¥¤¥ó¥È
+	$objPage->tpl_total_point = $objCartSess->getAllProductsPoint();
+	
+	return $objPage;	
+}
+
+/* DB¤«¤é¼è¤ê½Ð¤·¤¿ÆüÉÕ¤ÎÊ¸»úÎó¤òÄ´À°¤¹¤ë¡£*/
+function sfDispDBDate($dbdate, $time = true) {
+	list($y, $m, $d, $H, $M) = split("[- :]", $dbdate);
+
+	if(strlen($y) > 0 && strlen($m) > 0 && strlen($d) > 0) {
+		if ($time) {
+			$str = sprintf("%04d/%02d/%02d %02d:%02d", $y, $m, $d, $H, $M);
+		} else {
+			$str = sprintf("%04d/%02d/%02d", $y, $m, $d, $H, $M);						
+		}
+	} else {
+		$str = "";
+	}
+	return $str;
+}
+
+function sfGetDelivTime($payment_id = "") {
+	$objQuery = new SC_Query();
+	
+	$deliv_id = "";
+	
+	if($payment_id != "") {
+		$where = "delete = 0 AND payment_id = ?";
+		$arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
+		$deliv_id = $arrRet[0]['deliv_id'];
+	}
+	
+	if($deliv_id != "") {
+		$objQuery->setorder("time_id");
+		$where = "deliv_id = ?";
+		$arrRet= $objQuery->select("time_id, time", "dtb_delivtime", $where, array($deliv_id));
+	}
+	return $arrRet;	
+}
+
+
+// ÅÔÆ»ÉÜ¸©¡¢»ÙÊ§¤¤ÊýË¡¤«¤éÇÛÁ÷ÎÁ¶â¤ò¼èÆÀ¤¹¤ë
+function sfGetDelivFee($pref, $payment_id = "") {
+	$objQuery = new SC_Query();
+	
+	$deliv_id = "";
+	
+	// »ÙÊ§¤¤ÊýË¡¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ÂÐ±þ¤·¤¿ÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
+	if($payment_id != "") {
+		$where = "delete = 0 AND payment_id = ?";
+		$arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
+		$deliv_id = $arrRet[0]['deliv_id'];
+	// »ÙÊ§¤¤ÊýË¡¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÀèÆ¬¤ÎÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
+	} else {
+		$where = "delete = 0";
+		$objQuery->setOrder("rank DESC");
+		$objQuery->setLimitOffset(1);
+		$arrRet = $objQuery->select("deliv_id", "dtb_deliv", $where);
+		$deliv_id = $arrRet[0]['deliv_id'];	
+	}
+	
+	// ÇÛÁ÷¶È¼Ô¤«¤éÇÛÁ÷ÎÁ¤ò¼èÆÀ
+	if($deliv_id != "") {
+		
+		// ÅÔÆ»ÉÜ¸©¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÅìµþÅÔ¤ÎÈÖ¹æ¤ò»ØÄê¤·¤Æ¤ª¤¯
+		if($pref == "") {
+			$pref = 13;
+		}
+		
+		$objQuery = new SC_Query();
+		$where = "deliv_id = ? AND pref = ?";
+		$arrRet= $objQuery->select("fee", "dtb_delivfee", $where, array($deliv_id, $pref));
+	}	
+	return $arrRet[0]['fee'];	
+}
+
+/* »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ */
+function sfGetPayment() {
+	$objQuery = new SC_Query();
+	// ¹ØÆþ¶â³Û¤¬¾ò·ï³Û°Ê²¼¤Î¹àÌÜ¤ò¼èÆÀ
+	$where = "delete = 0";
+	$objQuery->setorder("fix, rank DESC");
+	$arrRet = $objQuery->select("payment_id, payment_method, rule", "dtb_payment", $where);
+	return $arrRet;	
+}
+
+/* ÇÛÎó¤ò¥­¡¼Ì¾¤´¤È¤ÎÇÛÎó¤ËÊÑ¹¹¤¹¤ë */
+function sfSwapArray($array) {
+	$max = count($array);
+	for($i = 0; $i < $max; $i++) {
+		foreach($array[$i] as $key => $val) {
+			$arrRet[$key][] = $val;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¤«¤±»»¤ò¤¹¤ë¡ÊSmartyÍÑ) */
+function sfMultiply($num1, $num2) {
+	return ($num1 * $num2);
+}
+
+/* DB¤ËÅÐÏ¿¤µ¤ì¤¿¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ë¤ÎÁ÷¿® */
+function sfSendTemplateMail($to, $to_name, $template_id, $objPage) {
+	global $arrMAILTPLPATH;
+	$objQuery = new SC_Query();
+	// ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ
+	$where = "template_id = ?";
+	$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id));
+	$objPage->tpl_header = $arrRet[0]['header'];
+	$objPage->tpl_footer = $arrRet[0]['footer'];
+	$tmp_subject = $arrRet[0]['subject'];
+	
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	
+	$objMailView = new SC_SiteView();
+	// ¥á¡¼¥ëËÜÊ¸¤Î¼èÆÀ
+	$objMailView->assignobj($objPage);
+	$body = $objMailView->fetch($arrMAILTPLPATH[$template_id]);
+	
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	$tosubject = $tmp_subject;
+	$objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error);
+	$objSendMail->setTo($to, $to_name);
+	$objSendMail->sendMail();	// ¥á¡¼¥ëÁ÷¿®
+}
+
+/* ¼õÃí´°Î»¥á¡¼¥ëÁ÷¿® */
+function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) {
+	global $arrMAILTPLPATH;
+	
+	$objPage = new LC_Page();
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	$objPage->arrInfo = $arrInfo;
+	
+	$objQuery = new SC_Query();
+		
+	if($subject == "" && $header == "" && $footer == "") {
+		// ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ
+		$where = "template_id = ?";
+		$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array('1'));
+		$objPage->tpl_header = $arrRet[0]['header'];
+		$objPage->tpl_footer = $arrRet[0]['footer'];
+		$tmp_subject = $arrRet[0]['subject'];
+	} else {
+		$objPage->tpl_header = $header;
+		$objPage->tpl_footer = $footer;
+		$tmp_subject = $subject;
+	}
+	
+	// ¼õÃí¾ðÊó¤Î¼èÆÀ
+	$where = "order_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
+	$arrOrder = $arrRet[0];
+	$arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id));
+	
+	// ¸ÜµÒ¾ðÊó¤Î¼èÆÀ
+	$customer_id = $arrOrder['customer_id'];
+	$arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
+	$arrCustomer = $arrRet[0];
+	
+	$objPage->arrCustomer = $arrCustomer;
+	$objPage->arrOrder = $arrOrder;
+
+	//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó
+	if($arrOrder['conveni_data'] != "") {
+		global $arrCONVENIENCE;
+		global $arrCONVENIMESSAGE;
+		$objPage->arrCONVENIENCE = $arrCONVENIENCE;
+		$objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+		$arrConv = unserialize($arrOrder['conveni_data']);
+		$objPage->arrConv = $arrConv;
+	}
+
+	// ÅÔÆ»ÉÜ¸©ÊÑ´¹
+	global $arrPref;
+	$objPage->arrOrder['deliv_pref'] = $arrPref[$objPage->arrOrder['deliv_pref']];
+	
+	$objPage->arrOrderDetail = $arrOrderDetail;
+	
+	$objCustomer = new SC_Customer();
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+		
+	$objMailView = new SC_SiteView();
+	// ¥á¡¼¥ëËÜÊ¸¤Î¼èÆÀ
+	$objMailView->assignobj($objPage);
+	$body = $objMailView->fetch($arrMAILTPLPATH[$template_id]);
+	
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$bcc = $arrInfo['email01'];
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	
+	$tosubject = sfMakeSubject($tmp_subject);
+	
+	$objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+	$objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " ". $arrOrder["order_name02"] ." ÍÍ");
+	
+	// Á÷¿®¥Õ¥é¥°:true¤Î¾ì¹ç¤Ï¡¢Á÷¿®¤¹¤ë¡£
+	if($send) {
+		if ($objSendMail->sendMail()) {
+			sfSaveMailHistory($order_id, $template_id, $tosubject, $body);
+		}
+	}
+	
+	return $objSendMail;
+}
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤·¤¿¥á¡¼¥ë¤ÎÁ÷¿®
+function sfSendTplMail($to, $subject, $tplpath, $objPage) {
+	$objMailView = new SC_SiteView();
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	// ¥á¡¼¥ëËÜÊ¸¤Î¼èÆÀ
+	$objPage->tpl_shopname=$arrInfo['shop_name'];
+	$objPage->tpl_infoemail = $arrInfo['email02'];
+	$objMailView->assignobj($objPage);
+	$body = $objMailView->fetch($tplpath);
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$to = mb_encode_mimeheader($to);
+	$bcc = $arrInfo['email01'];
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	$objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+	$objSendMail->sendMail();	
+}
+
+// ÄÌ¾ï¤Î¥á¡¼¥ëÁ÷¿®
+function sfSendMail($to, $subject, $body) {
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$bcc = $arrInfo['email01'];
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	$objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+	$objSendMail->sendMail();
+}
+
+//·ïÌ¾¤Ë¥Æ¥ó¥×¥ì¡¼¥È¤òÍÑ¤¤¤ë
+function sfMakeSubject($subject){
+	
+	$objQuery = new SC_Query();
+	$objMailView = new SC_SiteView();
+	$objPage = new LC_Page();
+	
+	$arrInfo = $objQuery->select("*","dtb_baseinfo");
+	$arrInfo = $arrInfo[0];
+	$objPage->tpl_shopname=$arrInfo['shop_name'];
+	$objPage->tpl_infoemail=$subject;
+	$objMailView->assignobj($objPage);
+	$mailtitle = $objMailView->fetch('mail_templates/mail_title.tpl');
+	$ret = $mailtitle.$subject;
+	return $ret; 
+}
+
+// ¥á¡¼¥ëÇÛ¿®ÍúÎò¤Ø¤ÎÅÐÏ¿
+function sfSaveMailHistory($order_id, $template_id, $subject, $body) {
+	$sqlval['subject'] = $subject;
+	$sqlval['order_id'] = $order_id;
+	$sqlval['template_id'] = $template_id;
+	$sqlval['send_date'] = "Now()";
+	if($_SESSION['member_id'] != "") {
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+	} else {
+		$sqlval['creator_id'] = '0';
+	}
+	$sqlval['mail_body'] = $body;
+	
+	$objQuery = new SC_Query();
+	$objQuery->insert("dtb_mail_history", $sqlval);
+}
+
+/* ²ñ°÷¾ðÊó¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+function sfGetCustomerSqlVal($uniqid, $sqlval) {
+	$objCustomer = new SC_Customer();
+	// ²ñ°÷¾ðÊóÅÐÏ¿½èÍý
+	if ($objCustomer->isLoginSuccess()) {
+		// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+		$sqlval['order_temp_id'] = $uniqid;
+		$sqlval['update_date'] = 'Now()';
+		$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+	    $sqlval['order_name01'] = $objCustomer->getValue('name01');
+	    $sqlval['order_name02'] = $objCustomer->getValue('name02');
+	    $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
+	    $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
+	    $sqlval['order_sex'] = $objCustomer->getValue('sex');
+	    $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
+	    $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
+	    $sqlval['order_pref'] = $objCustomer->getValue('pref');
+	    $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
+	    $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
+	    $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
+	    $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
+		$sqlval['order_tel03'] = $objCustomer->getValue('tel03');
+		$sqlval['order_email'] = $objCustomer->getValue('email');
+		$sqlval['order_job'] = $objCustomer->getValue('job');
+		$sqlval['order_birth'] = $objCustomer->getValue('birth');
+	}
+	return $sqlval;
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ø¤Î½ñ¤­¹þ¤ß½èÍý
+function sfRegistTempOrder($uniqid, $sqlval) {
+	if($uniqid != "") {
+		// ´ûÂ¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
+		$objQuery = new SC_Query();
+		$where = "order_temp_id = ?";
+		$cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
+		// ´ûÂ¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
+		if ($cnt == 0) {
+			// ½é²ó½ñ¤­¹þ¤ß»þ¤Ë²ñ°÷¤ÎÅÐÏ¿ºÑ¤ß¾ðÊó¤ò¼è¤ê¹þ¤à
+			$sqlval = sfGetCustomerSqlVal($uniqid, $sqlval);
+			$objQuery->insert("dtb_order_temp", $sqlval);
+		} else {
+			$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+		}
+	}
+}
+
+/* ²ñ°÷¤Î¥á¥ë¥Þ¥¬ÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯(²¾²ñ°÷¤ò´Þ¤Þ¤Ê¤¤) */
+function sfCheckCustomerMailMaga($email) {
+	$col = "T1.email, T1.mail_flag, T2.customer_id";
+	$from = "dtb_customer_mail AS T1 LEFT JOIN dtb_customer AS T2 ON T1.email = T2.email";
+	$where = "T1.email = ? AND T2.status = 2";
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select($col, $from, $where, array($email));
+	// ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë
+	if($arrRet[0]['customer_id'] != "") {
+		return true;
+	}
+	return false;
+}
+
+// ¥«¡¼¥É¤Î½èÍý·ë²Ì¤òÊÖ¤¹
+function sfGetAuthonlyResult($dir, $file_name, $name01, $name02, $card_no, $card_exp, $amount, $order_id, $jpo_info = "10"){
+
+	$path = $dir .$file_name;		// cgi¥Õ¥¡¥¤¥ë¤Î¥Õ¥ë¥Ñ¥¹À¸À®
+	$now_dir = getcwd();			// require¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Î¤Ç¡¢cgi¼Â¹Ô¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤¹¤ë
+	chdir($dir);
+	
+	// ¥Ñ¥¤¥×ÅÏ¤·¤Ç¥³¥Þ¥ó¥É¥é¥¤¥ó¤«¤écgiµ¯Æ°
+	$cmd = "$path card_no=$card_no name01=$name01 name02=$name02 card_exp=$card_exp amount=$amount order_id=$order_id jpo_info=$jpo_info";
+
+	$tmpResult = popen($cmd, "r");
+	
+	// ·ë²Ì¼èÆÀ
+	while( ! FEOF ( $tmpResult ) ) {
+		$result .= FGETS($tmpResult);
+	}
+	pclose($tmpResult);				// 	¥Ñ¥¤¥×¤òÊÄ¤¸¤ë
+	chdir($now_dir);				//¡¡¸µ¤Ë¤¤¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ëµ¢¤ë
+	
+	// ·ë²Ì¤òÏ¢ÁÛÇÛÎó¤Ø³ÊÇ¼
+	$result = ereg_replace("&$", "", $result);
+	foreach (explode("&",$result) as $data) {
+		list($key, $val) = explode("=", $data, 2);
+		$return[$key] = $val;
+	}
+	
+	return $return;
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¾ðÊó¤ò¼èÆÀ¤¹¤ë
+function sfGetOrderTemp($order_temp_id) {
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($order_temp_id));
+	return $arrRet[0];
+}
+
+// ¥«¥Æ¥´¥êID¼èÆÀÈ½ÄêÍÑ¤Î¥°¥í¡¼¥Ð¥ëÊÑ¿ô(°ìÅÙ¼èÆÀ¤µ¤ì¤Æ¤¤¤¿¤éºÆ¼èÆÀ¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë)
+$g_category_on = false;
+$g_category_id = "";
+
+/* ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤ò¼èÆÀ¤¹¤ë */
+function sfGetCategoryId($product_id, $category_id) {
+	global $g_category_on;
+	global $g_category_id;
+	if(!$g_category_on)	{
+		$g_category_on = true;
+		if(sfIsInt($category_id) && sfIsRecord("dtb_category","category_id", $category_id)) {
+			$g_category_id = $category_id;
+		} else if (sfIsInt($product_id) && sfIsRecord("dtb_products","product_id", $product_id, "status = 1")) {
+			$objQuery = new SC_Query();
+			$where = "product_id = ?";
+			$category_id = $objQuery->get("dtb_products", "category_id", $where, array($product_id));
+			$g_category_id = $category_id;
+		} else {
+			// ÉÔÀµ¤Ê¾ì¹ç¤Ï¡¢0¤òÊÖ¤¹¡£
+			$g_category_id = 0;
+		}
+	}
+	return $g_category_id;
+}
+
+// ROOTID¼èÆÀÈ½ÄêÍÑ¤Î¥°¥í¡¼¥Ð¥ëÊÑ¿ô(°ìÅÙ¼èÆÀ¤µ¤ì¤Æ¤¤¤¿¤éºÆ¼èÆÀ¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë)
+$g_root_on = false;
+$g_root_id = "";
+
+/* ÁªÂòÃæ¤Î¥¢¥¤¥Æ¥à¤Î¥ë¡¼¥È¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë */
+function sfGetRootId() {
+	global $g_root_on;
+	global $g_root_id;
+	if(!$g_root_on)	{
+		$g_root_on = true;
+		$objQuery = new SC_Query();
+		if($_GET['product_id'] != "" || $_GET['category_id'] != "") {
+			// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+			$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+			// ROOT¥«¥Æ¥´¥êID¤Î¼èÆÀ
+			 $arrRet = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id);
+			 $root_id = $arrRet[0];
+		} else {
+			// ROOT¥«¥Æ¥´¥êID¤ò¤Ê¤·¤ËÀßÄê¤¹¤ë
+			$root_id = "";
+		}
+		$g_root_id = $root_id;
+	}
+	return $g_root_id;
+}
+
+/* ¥«¥Æ¥´¥ê¤«¤é¾¦ÉÊ¤ò¸¡º÷¤¹¤ë¾ì¹ç¤ÎWHEREÊ¸¤ÈÃÍ¤òÊÖ¤¹ */
+function sfGetCatWhere($category_id) {
+	// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+	$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $category_id);
+	$tmp_where = "";
+	foreach ($arrRet as $val) {
+		if($tmp_where == "") {
+			$tmp_where.= " category_id IN ( ? ";
+		} else {
+			$tmp_where.= " ,? ";
+		}
+		$arrval[] = $val;
+	}
+	$tmp_where.= " ) ";
+	return array($tmp_where, $arrval);
+}
+
+/* ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»¼° */
+function sfGetAddPoint($totalpoint, $use_point, $arrInfo) {
+	// ¹ØÆþ¾¦ÉÊ¤Î¹ç·×¥Ý¥¤¥ó¥È¤«¤éÍøÍÑ¤·¤¿¥Ý¥¤¥ó¥È¤Î¥Ý¥¤¥ó¥È´¹»»²ÁÃÍ¤ò°ú¤¯Êý¼°
+	$add_point = $totalpoint - intval($use_point * ($arrInfo['point_rate'] / 100));
+	
+	if($add_point < 0) {
+		$add_point = '0';
+	}
+	return $add_point;
+}
+
+/* °ì°Õ¤«¤ÄÍ½Â¬¤µ¤ì¤Ë¤¯¤¤ID */
+function sfGetUniqRandomId($head = "") {
+	// Í½Â¬¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¥é¥ó¥À¥àÊ¸»úÎó¤òÉÕÍ¿¤¹¤ë¡£
+	$random = gfMakePassword(8);
+	// Æ±°ì¥Û¥¹¥ÈÆâ¤Ç°ì°Õ¤ÊID¤òÀ¸À®
+	$id = uniqid($head);
+	return ($id . $random);
+}
+
+// ¥«¥Æ¥´¥êÊÌ¥ª¥¹¥¹¥áÉÊ¤Î¼èÆÀ
+function sfGetBestProducts( $conn, $category_id = 0){
+	// ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë
+	$sql = "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,
+			 A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass as B 
+			USING (product_id) WHERE A.category_id = ? AND A.delete = 0 AND status = 1 ORDER BY A.rank";
+	$arrItems = $conn->getAll($sql, array($category_id));
+	return $arrItems;
+}
+
+// ÆÃ¼ìÀ©¸æÊ¸»ú¤Î¼êÆ°¥¨¥¹¥±¡¼¥×
+function sfManualEscape($data) {
+	// ÇÛÎó¤Ç¤Ê¤¤¾ì¹ç
+	if(!is_array($data)) {			
+		$ret = pg_escape_string($data);
+		$ret = ereg_replace("%", "\\%", $ret);
+		$ret = ereg_replace("_", "\\_", $ret);
+		return $ret;
+	}
+	
+	// ÇÛÎó¤Î¾ì¹ç
+	foreach($data as $val) {
+		$ret = pg_escape_string($val);
+		$ret = ereg_replace("%", "\\%", $ret);
+		$ret = ereg_replace("_", "\\_", $ret);
+		$arrRet[] = $ret;
+	}
+	return $arrRet;
+}
+
+// ¼õÃíÈÖ¹æ¡¢ÍøÍÑ¥Ý¥¤¥ó¥È¡¢²Ã»»¥Ý¥¤¥ó¥È¤«¤éºÇ½ª¥Ý¥¤¥ó¥È¤ò¼èÆÀ
+function sfGetCustomerPoint($order_id, $use_point, $add_point) {
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id));
+	$customer_id = $arrRet[0]['customer_id'];
+	if($customer_id != "" && $customer_id >= 1) {
+		$arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
+		$point = $arrRet[0]['point'];
+		$total_point = $arrRet[0]['point'] - $use_point + $add_point;
+	} else {
+		$total_point = "";
+		$point = "";
+	}
+	return array($point, $total_point);
+}
+
+/* ¥É¥á¥¤¥ó´Ö¤ÇÍ­¸ú¤Ê¥»¥Ã¥·¥ç¥ó¤Î¥¹¥¿¡¼¥È */
+function sfDomainSessionStart() {
+	$ret = session_id();
+/*
+	¥Ø¥Ã¥À¡¼¤òÁ÷¿®¤·¤Æ¤¤¤Æ¤âsession_start()¤¬É¬Í×¤Ê¥Ú¡¼¥¸¤¬¤¢¤ë¤Î¤Ç
+	¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ¤ª¤¯
+	if($ret == "" && !headers_sent()) {
+*/
+	if($ret == "") {
+		/* ¥»¥Ã¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤Î»ØÄê
+		 ¡¦¥Ö¥é¥¦¥¶¤òÊÄ¤¸¤ë¤Þ¤ÇÍ­¸ú
+		 ¡¦¤¹¤Ù¤Æ¤Î¥Ñ¥¹¤ÇÍ­¸ú
+		 ¡¦Æ±¤¸¥É¥á¥¤¥ó´Ö¤Ç¶¦Í­ */
+		session_set_cookie_params (0, "/", DOMAIN_NAME);
+		// ¥»¥Ã¥·¥ç¥ó³«»Ï
+		session_start();
+	}
+}
+
+/* Ê¸»úÎó¤Ë¶¯À©Åª¤Ë²þ¹Ô¤òÆþ¤ì¤ë */
+function sfPutBR($str, $size) {
+	$i = 0;
+	$cnt = 0;
+	$line = array();
+	$ret = "";
+	
+	while($str[$i] != "") {
+		$line[$cnt].=$str[$i];
+		$i++;
+		if(strlen($line[$cnt]) > $size) {
+			$line[$cnt].="<br />";
+			$cnt++;
+		}
+	}
+	
+	foreach($line as $val) {
+		$ret.=$val;
+	}
+	return $ret;
+}
+
+// Æó²ó°Ê¾å·«¤êÊÖ¤µ¤ì¤Æ¤¤¤ë¥¹¥é¥Ã¥·¥å[/]¤ò°ì¤Ä¤ËÊÑ´¹¤¹¤ë¡£
+function sfRmDupSlash($istr){
+	if(ereg("^http://", $istr)) {
+		$str = substr($istr, 7);
+		$head = "http://";
+	} else if(ereg("^https://", $istr)) {
+		$str = substr($istr, 8);
+		$head = "https://";
+	} else {
+		$str = $istr;
+	}
+	$str = ereg_replace("[/]+", "/", $str);
+	$ret = $head . $str;
+	return $ret;	
+}
+
+function sfEncodeFile($filepath, $enc_type, $out_dir) {
+	$ifp = fopen($filepath, "r");
+	
+	$basename = basename($filepath);
+	$outpath = $out_dir . "enc_" . $basename;
+	
+	$ofp = fopen($outpath, "w+");
+	
+	while(!feof($ifp)) {
+		$line = fgets($ifp);
+		$line = mb_convert_encoding($line, $enc_type, "auto");
+		fwrite($ofp,  $line);
+	}
+	
+	fclose($ofp);
+	fclose($ifp);
+	
+	return 	$outpath;
+}
+
+function sfCutString($str, $len, $byte = true) {
+	if($byte) {
+		if(strlen($str) > ($len + 2)) {
+			$ret =substr($str, 0, $len) . "...";
+		} else {
+			$ret = $str;
+		}
+	} else {
+		if(mb_strlen($str) > ($len + 1)) {
+			$ret = mb_substr($str, 0, $len) . "...";
+		} else {
+			$ret = $str;
+		}
+	}
+	return $ret;
+}
+
+// Ç¯¡¢·î¡¢Äù¤áÆü¤«¤é¡¢Àè·î¤ÎÄù¤áÆü+1¡¢º£·î¤ÎÄù¤áÆü¤òµá¤á¤ë¡£
+function sfTermMonth($year, $month, $close_day) {
+	$end_year = $year;
+	$end_month = $month;
+	
+	// ³«»Ï·î¤¬½ªÎ»·î¤ÈÆ±¤¸¤«ÈÝ¤«
+	$same_month = false;
+	
+	// ³ºÅö·î¤ÎËöÆü¤òµá¤á¤ë¡£
+	$end_last_day = date("d", mktime(0, 0, 0, $month + 1, 0, $year));
+	
+	// ·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç
+	if($end_last_day < $close_day) {
+		// Äù¤áÆü¤ò·îËöÆü¤Ë¹ç¤ï¤»¤ë
+		$end_day = $end_last_day;
+	} else {
+		$end_day = $close_day;
+	}
+	
+	// Á°·î¤Î¼èÆÀ
+	$tmp_year = date("Y", mktime(0, 0, 0, $month, 0, $year));
+	$tmp_month = date("m", mktime(0, 0, 0, $month, 0, $year));
+	// Á°·î¤ÎËöÆü¤òµá¤á¤ë¡£
+	$start_last_day = date("d", mktime(0, 0, 0, $month, 0, $year));
+	
+	// Á°·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç
+	if ($start_last_day < $close_day) {
+		// ·îËöÆü¤Ë¹ç¤ï¤»¤ë
+		$tmp_day = $start_last_day;
+	} else {
+		$tmp_day = $close_day;
+	}
+	
+	// Àè·î¤ÎËöÆü¤ÎÍâÆü¤ò¼èÆÀ¤¹¤ë
+	$start_year = date("Y", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
+	$start_month = date("m", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
+	$start_day = date("d", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
+	
+	// ÆüÉÕ¤ÎºîÀ®
+	$start_date = sprintf("%d/%d/%d 00:00:00", $start_year, $start_month, $start_day);
+	$end_date = sprintf("%d/%d/%d 23:59:59", $end_year, $end_month, $end_day);
+	
+	return array($start_date, $end_date);
+}
+
+// PDFÍÑ¤ÎRGB¥«¥é¡¼¤òÊÖ¤¹
+function sfGetPdfRgb($hexrgb) {
+	$hex = substr($hexrgb, 0, 2);
+	$r = hexdec($hex) / 255;
+	
+	$hex = substr($hexrgb, 2, 2);
+	$g = hexdec($hex) / 255;
+	
+	$hex = substr($hexrgb, 4, 2);
+	$b = hexdec($hex) / 255;
+	
+	return array($r, $g, $b);	
+}
+
+//¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤È¥á¡¼¥ëÇÛ¿®
+function sfRegistTmpMailData($mail_flag, $email){
+	$objQuery = new SC_Query();
+	$objConn = new SC_DBConn();
+	$objPage = new LC_Page();
+	
+	$random_id = sfGetUniqRandomId();
+	$arrRegistMailMagazine["mail_flag"] = $mail_flag;
+	$arrRegistMailMagazine["email"] = $email;
+	$arrRegistMailMagazine["temp_id"] =$random_id;
+	$arrRegistMailMagazine["end_flag"]='0';
+	$arrRegistMailMagazine["update_date"] = 'now()';
+	
+	//¥á¥ë¥Þ¥¬²¾ÅÐÏ¿ÍÑ¥Õ¥é¥°
+	$flag = $objQuery->count("dtb_customer_mail_temp", "email=?", array($email));
+	$objConn->query("BEGIN");
+	switch ($flag){
+		case '0':
+		$objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine);
+		break;
+	
+		case '1':
+		$objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine, "email = '" .addslashes($email). "'");
+		break;
+	}
+	$objConn->query("COMMIT");
+	$subject = sfMakeSubject('¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+	$objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=".$arrRegistMailMagazine['temp_id'];
+	switch ($mail_flag){
+		case '1':
+		$objPage->tpl_name = "ÅÐÏ¿";
+		$objPage->tpl_kindname = "HTML";
+		break;
+		
+		case '2':
+		$objPage->tpl_name = "ÅÐÏ¿";
+		$objPage->tpl_kindname = "¥Æ¥­¥¹¥È";
+		break;
+		
+		case '3':
+		$objPage->tpl_name = "²ò½ü";
+		break;
+	}
+		$objPage->tpl_email = $email;
+	sfSendTplMail($email, $subject, 'mail_templates/mailmagazine_temp.tpl', $objPage);
+}
+
+// ºÆµ¢Åª¤ËÂ¿ÃÊÇÛÎó¤ò¸¡º÷¤·¤Æ°ì¼¡¸µÇÛÎó(Hidden°úÅÏ¤·ÍÑÇÛÎó)¤ËÊÑ´¹¤¹¤ë¡£
+function sfMakeHiddenArray($arrSrc, $arrDst = array(), $parent_key = "") {
+	if(is_array($arrSrc)) {
+		foreach($arrSrc as $key => $val) {
+			if($parent_key != "") {
+				$keyname = $parent_key . "[". $key . "]";
+			} else {
+				$keyname = $key;
+			}
+			if(is_array($val)) {
+				$arrDst = sfMakeHiddenArray($val, $arrDst, $keyname);
+			} else {
+				$arrDst[$keyname] = $val;
+			}
+		}
+	}
+	return $arrDst;
+}
+
+// DB¼èÆÀÆü»þ¤ò¥¿¥¤¥à¤ËÊÑ´¹
+function sfDBDatetoTime($db_date) {
+	$date = ereg_replace("\..*$","",$db_date);
+	$time = strtotime($date);
+	return $time;
+}
+
+// ½ÐÎÏ¤ÎºÝ¤Ë¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤é¤ì¤ë
+/*
+	index.php?tpl=test.tpl
+*/
+function sfCustomDisplay($objPage) {
+	$basename = basename($_SERVER["REQUEST_URI"]);
+
+	if($basename == "") {
+		$path = $_SERVER["REQUEST_URI"] . "index.php";
+	} else {
+		$path = $_SERVER["REQUEST_URI"];
+	}	
+
+	if($_GET['tpl'] != "") {
+		$tpl_name = $_GET['tpl'];
+	} else {
+		$tpl_name = ereg_replace("^/", "", $path);
+		$tpl_name = ereg_replace("/", "_", $tpl_name);
+		$tpl_name = ereg_replace("(\.php$|\.html$)", ".tpl", $tpl_name);
+	}
+
+	$template_path = TEMPLATE_FTP_DIR . $tpl_name;
+
+	if(file_exists($template_path)) {
+		$objView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR);
+		$objView->assignobj($objPage);
+		$objView->display($tpl_name);
+	} else {
+		$objView = new SC_SiteView();
+		$objView->assignobj($objPage);
+		$objView->display(SITE_FRAME);
+	}
+}
+
+//²ñ°÷ÊÔ½¸ÅÐÏ¿½èÍý
+function sfEditCustomerData($array, $arrRegistColumn) {
+	$objQuery = new SC_Query();
+	
+	foreach ($arrRegistColumn as $data) {
+		if ($data["column"] != "password") {
+			if($array[ $data['column'] ] != "") {
+				$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+			} else {
+				$arrRegist[ $data['column'] ] = NULL;
+			}
+		}
+	}
+	if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	} else {
+		$arrRegist["birth"] = NULL;
+	}
+
+	//-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEÊ¸¤ò¹½À®¤·¤Ê¤¤¡Ë
+	if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = crypt($array["password"]);
+	$arrRegist["update_date"] = "NOW()";
+	
+	$sqlval['email'] = $array['email'];
+	$sqlval['mail_flag'] = $array['mail_flag'];
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id']));
+	$objQuery->delete("dtb_customer_mail", "email = ?", array($array['email']));
+	$objQuery->insert("dtb_customer_mail", $sqlval);
+	$objQuery->commit();
+}
+
+// PHP¤Îmb_convert_encoding´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
+function sf_mb_convert_encoding($str, $encode = 'EUC-JP') {
+	return  mb_convert_encoding($str, $encode);
+}	
+
+// PHP¤Îmktime´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
+function sf_mktime($format, $hour=0, $minute=0, $second=0, $month=1, $day=1, $year=1999) {
+	return  date($format,mktime($hour, $minute, $second, $month, $day, $year));
+}	
+
+// PHP¤Îdate´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
+function sf_date($format, $timestamp = '') {
+	return  date( $format, $timestamp);
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤Î·¿¤òÊÑ´¹¤¹¤ë
+function sfChangeCheckBox($data , $tpl = false){
+	if ($tpl) {
+		if ($data == 1){
+			return 'checked';
+		}else{
+			return "";
+		}
+	}else{
+		if ($data == "on"){
+			return 1;
+		}else{
+			return 2;
+		}
+	}
+}
+
+function sfCategory_Count($objQuery){
+	$sql = "";
+	
+	//¥Æ¡¼¥Ö¥ëÆâÍÆ¤Îºï½ü
+	$objQuery->query("DELETE FROM dtb_category_count");
+	$objQuery->query("DELETE FROM dtb_category_total_count");
+	
+	//³Æ¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò¿ô¤¨¤Æ³ÊÇ¼
+	$sql = " INSERT INTO dtb_category_count(category_id, product_count) ";
+	$sql .= " SELECT T1.category_id, count(T2.category_id) FROM dtb_category AS T1 LEFT JOIN dtb_products AS T2 ";
+	$sql .= " ON T1.category_id = T2.category_id  ";
+	$sql .= " WHERE T2.delete = 0 AND T2.status = 1 ";
+	$sql .= " GROUP BY T1.category_id, T2.category_id ";
+	$objQuery->query($sql);
+	
+	//»Ò¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò½¸·×¤¹¤ë
+	$arrCat = $objQuery->getAll("SELECT * FROM dtb_category");
+	
+	$sql = "";
+	foreach($arrCat as $key => $val){
+		
+		// »ÒID°ìÍ÷¤ò¼èÆÀ
+		$arrRet = sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $val['category_id']);	
+		$line = sfGetCommaList($arrRet);
+		
+		$sql = " INSERT INTO dtb_category_total_count(category_id, product_count) ";
+		$sql .= " SELECT ?, SUM(product_count) FROM dtb_category_count ";
+		$sql .= " WHERE category_id IN (" . $line . ")";
+				
+		$objQuery->query($sql, array($val['category_id']));
+	}
+}
+
+// 2¤Ä¤ÎÇÛÎó¤òÍÑ¤¤¤ÆÏ¢ÁÛÇÛÎó¤òºîÀ®¤¹¤ë
+function sfarrCombine($arrKeys, $arrValues) {
+
+	if(count($arrKeys) <= 0 and count($arrValues) <= 0) return array();
+	
+    $keys = array_values($arrKeys);
+    $vals = array_values($arrValues); 
+	
+    $max = max( count( $keys ), count( $vals ) ); 
+    $combine_ary = array(); 
+    for($i=0; $i<$max; $i++) { 
+        $combine_ary[$keys[$i]] = $vals[$i]; 
+    } 
+    if(is_array($combine_ary)) return $combine_ary; 
+    
+	return false; 
+}
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é»ÒIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
+function sfGetChildrenArray($table, $pid_name, $id_name, $id) {
+	$objQuery = new SC_Query();
+	$col = $pid_name . "," . $id_name;
+ 	$arrData = $objQuery->select($col, $table);
+	
+	$arrPID = array();
+	$arrPID[] = $id;
+	$arrChildren = array();
+	$arrChildren[] = $id;
+	
+	$arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID);
+	
+	while(count($arrRet) > 0) {
+		$arrChildren = array_merge($arrChildren, $arrRet);
+		$arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrRet);
+	}
+	
+	return $arrChildren;
+}
+
+/* ¿ÆIDÄ¾²¼¤Î»ÒID¤ò¤¹¤Ù¤Æ¼èÆÀ¤¹¤ë */
+function sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID) {
+	$arrChildren = array();
+	$max = count($arrData);
+	
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrPID as $val) {
+			if($arrData[$i][$pid_name] == $val) {
+				$arrChildren[] = $arrData[$i][$id_name];
+			}
+		}
+	}	
+	return $arrChildren;
+}
+
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é¿ÆIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
+function sfGetParentsArray($table, $pid_name, $id_name, $id) {
+	$objQuery = new SC_Query();
+	$col = $pid_name . "," . $id_name;
+ 	$arrData = $objQuery->select($col, $table);
+	
+	$arrParents = array();
+	$arrParents[] = $id;
+	$child = $id;
+	
+	$ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $child);
+
+	while($ret != "") {
+		$arrParents[] = $ret;
+		$ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $ret);
+	}
+	
+	$arrParents = array_reverse($arrParents);
+	
+	return $arrParents;
+}
+
+/* »ÒID½êÂ°¤¹¤ë¿ÆID¤ò¼èÆÀ¤¹¤ë */
+function sfGetParentsArraySub($arrData, $pid_name, $id_name, $child) {
+	$max = count($arrData);
+	$parent = "";
+	for($i = 0; $i < $max; $i++) {
+		if($arrData[$i][$id_name] == $child) {
+			$parent = $arrData[$i][$pid_name];
+			break;
+		}
+	}
+	return $parent;
+}
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤éÍ¿¤¨¤é¤ì¤¿ID¤Î·»Äï¤ò¼èÆÀ¤¹¤ë */
+function sfGetBrothersArray($arrData, $pid_name, $id_name, $arrPID) {
+	$max = count($arrData);
+	
+	$arrBrothers = array();
+	foreach($arrPID as $id) {
+		// ¿ÆID¤ò¸¡º÷¤¹¤ë
+		for($i = 0; $i < $max; $i++) {
+			if($arrData[$i][$id_name] == $id) {
+				$parent = $arrData[$i][$pid_name];
+				break;
+			}
+		}
+		// ·»ÄïID¤ò¸¡º÷¤¹¤ë
+		for($i = 0; $i < $max; $i++) {
+			if($arrData[$i][$pid_name] == $parent) {
+				$arrBrothers[] = $arrData[$i][$id_name];
+			}
+		}					
+	}
+	return $arrBrothers;
+}
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤éÍ¿¤¨¤é¤ì¤¿ID¤ÎÄ¾Â°¤Î»Ò¤ò¼èÆÀ¤¹¤ë */
+function sfGetUnderChildrenArray($arrData, $pid_name, $id_name, $parent) {
+	$max = count($arrData);
+	
+	$arrChildren = array();
+	// »ÒID¤ò¸¡º÷¤¹¤ë
+	for($i = 0; $i < $max; $i++) {
+		if($arrData[$i][$pid_name] == $parent) {
+			$arrChildren[] = $arrData[$i][$id_name];
+		}
+	}					
+	return $arrChildren;
+}
+
+
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ
+function sfGetCatTree($parent_category_id, $count_check = false) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$from = "dtb_category left join dtb_category_total_count using (category_id)";
+	// ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
+	if($count_check) {
+		$where = "delete = 0 AND product_count > 0";
+	} else {
+		$where = "delete = 0";
+	}
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, $from, $where);
+	
+	$arrParentID = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
+		
+	foreach($arrRet as $key => $array) {
+		foreach($arrParentID as $val) {
+			if($array['category_id'] == $val) {
+				$arrRet[$key]['display'] = 1;
+				break;
+			}
+		}
+	}
+	return $arrRet;
+}
+
+// ¿Æ¥«¥Æ¥´¥ê¡¼¤òÏ¢·ë¤·¤¿Ê¸»úÎó¤ò¼èÆÀ¤¹¤ë
+function sfGetCatCombName($category_id){
+	// ¾¦ÉÊ¤¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
+	$objQuery = new SC_Query();
+	$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);	
+	$ConbName = "";
+	
+	// ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë
+	foreach($arrCatID as $key => $val){
+		$sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
+		$arrVal = array($val);
+		$CatName = $objQuery->getOne($sql,$arrVal);
+		$ConbName .= $CatName . ' | ';
+	}
+	// ºÇ¸å¤Î ¡Ã ¤ò¥«¥Ã¥È¤¹¤ë
+	$ConbName = substr_replace($ConbName, "", strlen($ConbName) - 2, 2);
+	
+	return $ConbName;
+}
+
+// »ØÄê¤·¤¿¥«¥Æ¥´¥ê¡¼ID¤ÎÂç¥«¥Æ¥´¥ê¡¼¤ò¼èÆÀ¤¹¤ë
+function GetFirstCat($category_id){
+	// ¾¦ÉÊ¤¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
+	$objQuery = new SC_Query();
+	$arrRet = array();
+	$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);	
+	$arrRet['id'] = $arrCatID[0];
+	
+	// ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë
+	$sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
+	$arrVal = array($arrRet['id']);
+	$arrRet['name'] = $objQuery->getOne($sql,$arrVal);
+	
+	return $arrRet;
+}
+
+/* ¥Ç¥Ð¥Ã¥°ÍÑ ------------------------------------------------------------------------------------------------*/
+function sfPrintR($obj) {
+	print("<div style='font-size: 12px'>\n");
+	print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong><br />\n");
+	print("<pre>\n");
+	print_r($obj);
+	print("</pre>\n");
+	print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong></div>\n");
+}
+
+?>
Index: /temp/trunk/data/lib/gdthumb.php
===================================================================
--- /temp/trunk/data/lib/gdthumb.php	(revision 1328)
+++ /temp/trunk/data/lib/gdthumb.php	(revision 1328)
@@ -0,0 +1,214 @@
+<?php
+/* 
+
+¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡
+GD¼«Æ°¥µ¥à¥Í¥¤¥ëºîÀ® + ÃæÀî½¤Àµ2006/02/03
+
+Copyright 2002- Akihiro Asai. All rights reserved.
+
+http://aki.adam.ne.jp
+aki@mx3.adam.ne.jp
+
+¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡
+
+¢¢ µ¡Ç½³µÍ×
+¡¦»ØÄê¤µ¤ì¤¿¥¤¥á¡¼¥¸¤Î¥µ¥à¥Í¥¤¥ë¤òÉ½¼¨¤·¤Þ¤¹¡£
+¡¦½ÐÎÏ¤¹¤ëÂç¤­¤µ¤ò»ØÄê¤¹¤ë»ö¤¬¤Ç¤­¤Þ¤¹¡£
+¡¦½ÐÎÏ¤µ¤ì¤ë¥¤¥á¡¼¥¸¤Î¥¢¥¹¥Ú¥¯¥ÈÈæ¤Ï°Ý»ý¤µ¤ì¤Þ¤¹¡£
+
+¢¢ »ÈÍÑÊýË¡
+»ØÄê¤Ï gdthumb.php?path=xxx/xxx.[ jpg | png | gif ]&mw=xx&mh=xx
+¢¨ pass¤ÎÉôÊ¬¤Ë¤Ï²èÁü¤Ø¤Î¥Ñ¥¹¤ò»ØÄê
+¢¨ mw¤ËÉ½¼¨²èÁü¤ÎºÇÂç²£Éý¡¢mh¤ËÉ½¼¨²èÁü¤ÎºÇÂç²£Éý¤ò³°Éô¤è¤ê»ØÄê²ÄÇ½¡£
+¢¨ »ØÄê¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¥Ç¥Õ¥©¥ë¥È¤ÎÀßÄêÃÍ¤òºÎÍÑ¡£
+¡ú¥¯¥é¥¹¤È¤·¤Æ»ÈÍÑ¤¹¤ë¾ì¹ç¤Ï¡¢¡Ö¥¯¥é¥¹¤È¤·¤Æ»ÈÍÑ¤¹¤ë¾ì¹ç¤Ë¤Ï¡¦¡¦¡¦¡×°Ê¹ß¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ²¼¤µ¤¤¡£
+
+¢¢ ¹¹¿·ÍúÎò
+2002/08/19 ºÇÂç½ÄÉý¤ÎÉôÊ¬¤ò°ìÉô¼êÄ¾¤·
+2003/01/31 ¥Ç¥Õ¥©¥ë¥È¤Ç¥¢¥¹¥Ú¥¯¥ÈÈæ¤¬¸ÇÄê
+2003/04/11 ºÇÂç²£Éý¤ÈºÇÂç½ÄÉý¤ò³°Éô¤è¤ê»ØÄê²ÄÇ½
+2003/04/25 GD2ÍÑ¤Ë´Ø¿ôÊÑ¹¹
+2003/06/21 GD1/2¤ò¥Ð¡¼¥¸¥ç¥ó¤Ë±þ¤¸¤ÆÊÑ¹¹¤Ç¤­¤ë¤è¤¦¤Ë½¤Àµ
+2003/06/25 imageCopyResampled¤ÎÉôÊ¬¤ò½¤Àµ
+2004/01/28 ¥¹¥¯¥ê¥×¥ÈÁ´ÂÎ¤ò½ñ¤­Ä¾¤·¡£°ú¿ô¡Öpass¡×¤ò¡Öpath¡×¤ËÊÑ¹¹¡£
+2005/12/08 ´Ø¿ô¤Î¼«Æ°È½ÊÌ gif·Á¼°¤ËÂÐ±þ Æ©²ágif¡¦Æ©²ápng¤ËÂÐ±þ¡ÊGD2.0.1°Ê¹ß¡Ë  
+*/
+
+// ¥¯¥é¥¹¤È¤·¤Æ»ÈÍÑ¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢°Ê²¼¤Î6¹Ô¤ò¥³¥á¥ó¥È¥¢¥¦¥È
+/*
+$objg = new gdthumb();
+list($Ck, $Msg) = $objg->Main($_GET["path"], $_GET["mw"], $_GET["mh"]);
+if(!$Ck) { // ¥¨¥é¡¼¤Î¾ì¹ç
+	header("Content-Type: text/html; charset=euc-jp");
+	print $Msg;
+}
+*/
+
+class gdthumb {
+	
+	var $imgMaxWidth;
+	var $imgMaxHeight;
+	var $gdVer;
+	
+	/*
+	* ¥³¥ó¥¹¥È¥é¥¯¥¿
+	*/
+	function gdthumb() {
+		
+		// ¥¹¥¯¥ê¥×¥È¤Î¥Ç¥Õ¥©¥ë¥ÈÀßÄê
+		
+		// ²èÁü¤ÎºÇÂç²£Éý
+		$this->imgMaxWidth = 240; // 1°Ê¾å¤ÎÃÍ
+		
+		// ²èÁü¤ÎºÇÂç½ÄÉý
+		$this->imgMaxHeight = 0; // »ØÄê¤·¤Ê¤¤¾ì¹ç¤Ï0 »ØÄê¤¹¤ë¾ì¹ç¤Ï1°Ê¾å¤ÎÃÍ
+		
+	}
+	
+	/*
+	* ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎºîÀ®
+	* string $path
+	* integer $width
+	* integer $height
+	*/
+	function Main($path, $width, $height, $dst_file) {
+		
+		if(!isset($path)) {
+			return array(0, "¥¤¥á¡¼¥¸¤Î¥Ñ¥¹¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+		}
+		
+		if(!file_exists($path)) {
+			return array(0, "»ØÄê¤µ¤ì¤¿¥Ñ¥¹¤Ë¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£");
+		}
+		
+		// ²èÁü¤ÎÂç¤­¤µ¤ò¥»¥Ã¥È
+		if($width) $this->imgMaxWidth = $width;
+		if($height) $this->imgMaxHeight = $height;
+		
+		$size = @GetimageSize($path);
+		$re_size = $size;
+		
+		//¥¢¥¹¥Ú¥¯¥ÈÈæ¸ÇÄê½èÍý
+		if($this->imgMaxWidth != 0) {
+			$tmp_w = $size[0] / $this->imgMaxWidth;
+		}
+		
+		if($this->imgMaxHeight != 0) {
+			$tmp_h = $size[1] / $this->imgMaxHeight;
+		}
+		
+		if($tmp_w > 1 || $tmp_h > 1) {
+			if($this->imgMaxHeight == 0) {
+				if($tmp_w > 1) {
+					$re_size[0] = $this->imgMaxWidth;
+					$re_size[1] = $size[1] * $this->imgMaxWidth / $size[0];
+				}
+			} else {
+				if($tmp_w > $tmp_h) {
+					$re_size[0] = $this->imgMaxWidth;
+					$re_size[1] = $size[1] * $this->imgMaxWidth / $size[0];
+				} else {
+					$re_size[1] = $this->imgMaxHeight;
+					$re_size[0] = $size[0] * $this->imgMaxHeight / $size[1];
+				}
+			}
+		}
+		
+		$imagecreate = function_exists("imagecreatetruecolor") ? "imagecreatetruecolor" : "imagecreate";
+		$imageresize = function_exists("imagecopyresampled") ? "imagecopyresampled" : "imagecopyresized";
+		
+		switch($size[2]) {
+			
+			// gif·Á¼°
+			case "1":
+				if(function_exists("imagecreatefromgif")) {
+					$src_im = imagecreatefromgif($path);
+					$dst_im = $imagecreate($re_size[0], $re_size[1]);
+					
+					$transparent = imagecolortransparent($src_im);
+					$colorstotal = imagecolorstotal ($src_im);
+					
+					$dst_im = imagecreate($re_size[0], $re_size[1]);
+					if (0 <= $transparent && $transparent < $colorstotal) {
+						imagepalettecopy ($dst_im, $src_im);
+						imagefill ($dst_im, 0, 0, $transparent);
+						imagecolortransparent ($dst_im, $transparent);
+					}
+          			imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+									
+					if(function_exists("imagegif")) {
+						$dst_file = $dst_file . ".gif";
+						imagegif($dst_im, $dst_file);
+						imagedestroy($src_im);
+						imagedestroy($dst_im);
+					} else {
+						$dst_file = $dst_file . ".png";						
+						imagepng($dst_im, $dst_file);
+						imagedestroy($src_im);
+						imagedestroy($dst_im);
+					}
+				} else {
+					// ¥µ¥à¥Í¥¤¥ëºîÀ®ÉÔ²Ä¤Î¾ì¹ç¡Êµì¥Ð¡¼¥¸¥ç¥óÂÐºö¡Ë
+					$dst_im = imageCreate($re_size[0], $re_size[1]);
+					imageColorAllocate($dst_im, 255, 255, 214); //ÇØ·Ê¿§
+					
+					// ÏÈÀþ¤ÈÊ¸»ú¿§¤ÎÀßÄê
+					$black = imageColorAllocate($dst_im, 0, 0, 0);
+					$red = imageColorAllocate($dst_im, 255, 0, 0);
+					
+					imagestring($dst_im, 5, 10, 10, "GIF $size[0]x$size[1]", $red);
+					imageRectangle ($dst_im, 0, 0, ($re_size[0]-1), ($re_size[1]-1), $black);
+					$dst_file = $dst_file . ".png";
+					imagepng($dst_im, $dst_file);
+					imagedestroy($src_im);
+					imagedestroy($dst_im);
+				}
+				break;
+				
+			// jpg·Á¼°
+			case "2": 
+			
+				$src_im = imageCreateFromJpeg($path);
+				$dst_im = $imagecreate($re_size[0], $re_size[1]);
+				imagecopyresized( $dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+				
+				$dst_file = $dst_file . ".jpg";
+				imageJpeg($dst_im, $dst_file);
+				imagedestroy($src_im);
+				imagedestroy($dst_im);
+      			
+				break;
+    
+			// png·Á¼°    
+			case "3": 
+
+				$src_im = imagecreatefrompng($path);
+				
+				$colortransparent = imagecolortransparent($src_im);
+				if ($colortransparent > -1) {
+					$dst_im = $imagecreate($re_size[0], $re_size[1]);
+					imagepalettecopy($dst_im, $src_im);
+					imagefill($dst_im, 0, 0, $colortransparent);
+					imagecolortransparent($dst_im, $colortransparent);
+					imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+				} else {				
+					$dst_im = $imagecreate($re_size[0], $re_size[1]);
+					imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+					imagetruecolortopalette($dst_im, false, imagecolorstotal($src_im));
+				}				
+			
+				$dst_file = $dst_file . ".png";
+				imagepng($dst_im, $dst_file);
+				imagedestroy($src_im);
+				imagedestroy($dst_im);
+				
+				break;
+				
+			default:
+				return array(0, "¥¤¥á¡¼¥¸¤Î·Á¼°¤¬ÉÔÌÀ¤Ç¤¹¡£");
+		}
+
+		return array(1, $dst_file);
+	}
+}
+?>
Index: /temp/trunk/data/lib/glib.php
===================================================================
--- /temp/trunk/data/lib/glib.php	(revision 1328)
+++ /temp/trunk/data/lib/glib.php	(revision 1328)
@@ -0,0 +1,187 @@
+<?php
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfDownloadCsv
+ * [³µÍ×] °ú¿ô¥Ç¡¼¥¿¤òCSV¤È¤·¤Æ¡¢¥¯¥é¥¤¥¢¥ó¥È¤Ë¥À¥¦¥ó¥í¡¼¥É¤µ¤»¤ë
+ * [°ú¿ô] 1:¥Ø¥Ã¥ÀÊ¸»úÎó 2:CSV¥Ç¡¼¥¿
+ * [ÌáÃÍ] -
+ * [°ÍÂ¸] -
+ * [Ãí¼á] °ú¿ô¤Ï£±¡¤£²¤È¤â¥«¥ó¥Þ¶èÀÚ¤ê¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È
+ *----------------------------------------------------------------------*/
+function gfDownloadCsv($header, $contents){
+	
+	$fiest_name = date("YmdHis") .".csv";
+	
+	/* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */
+	Header("Content-disposition: attachment; filename=${fiest_name}");
+	Header("Content-type: application/octet-stream; name=${fiest_name}");
+	
+	$return = $header.$contents;
+	if (mb_detect_encoding($return) == 'EUC-JP'){						//Ê¸»ú¥³¡¼¥ÉÊÑ´¹
+		$return = mb_convert_encoding($return,'SJIS','EUC-JP');
+		$return = str_replace( array( "\r\n", "\r" ), "\n", $return);	// ²þ¹ÔÊýË¡¤ÎÅý°ì
+	}
+	echo $return;
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfSetCsv
+ * [³µÍ×] °ú¿ô¤ÎÇÛÎó¤òCSV·Á¼°¤ËÊÑ´¹¤¹¤ë
+ * [°ú¿ô] 1:CSV¤Ë¤¹¤ëÇÛÎó 2:°ú¿ô1¤¬Ï¢ÁÛÇÛÎó»þ¤ÎÅº¤¨»ú¤ò»ØÄê¤·¤¿ÇÛÎó
+ * [ÌáÃÍ] CSV¥Ç¡¼¥¿
+ * [°ÍÂ¸] -
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfSetCsv( $array, $arrayIndex = "" ){	
+	//°ú¿ô$arrayIndex¤Ï¡¢$array¤¬Ï¢ÁÛÇÛÎó¤Î¤È¤­¤ËÅº¤¨»ú¤ò»ØÄê¤·¤Æ¤ä¤ë¤¿¤á¤Ë»ÈÍÑ¤¹¤ë
+	
+	$return = "";
+	for ($i=0; $i<count($array); $i++){
+		
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";			
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	
+	return $return;
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfGetAge
+ * [³µÍ×] ÆüÉÕ¤è¤êÇ¯Îð¤ò·×»»¤¹¤ë¡£
+ * [°ú¿ô] 1:ÆüÉÕÊ¸»úÎó(yyyy/mm/dd¡¢yyyy-mm-dd hh:mm:ssÅù)
+ * [ÌáÃÍ] Ç¯Îð¤Î¿ôÃÍ
+ * [°ÍÂ¸] -
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfGetAge($dbdate)
+{
+    $ty = date("Y");
+    $tm = date("m");
+    $td = date("d");
+    list($by, $bm, $bd) = split("[-/ ]", $dbdate);
+    $age = $ty - $by;
+	if($tm * 100 + $td < $bm * 100 + $bd) $age--;
+    return $age;
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfDebugLog
+ * [³µÍ×] ¥í¥°¥Õ¥¡¥¤¥ë¤ËÊÑ¿ô¤Î¾ÜºÙ¤ò½ÐÎÏ¤¹¤ë¡£
+ * [°ú¿ô] ÂÐ¾Ý¤È¤Ê¤ëÊÑ¿ô
+ * [ÌáÃÍ] ¤Ê¤·
+ * [°ÍÂ¸] gfPrintLog
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfDebugLog($obj){
+		gfPrintLog("*** start Debug ***");
+		ob_start();
+		print_r($obj);
+		$buffer = ob_get_contents();
+		ob_end_clean();
+		$fp = fopen(LOG_PATH, "a+");
+		fwrite( $fp, $buffer."\n" );
+		fclose( $fp );
+		gfPrintLog("*** end Debug ***");
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfPrintLog
+ * [³µÍ×] ¥í¥°¥Õ¥¡¥¤¥ë¤ËÆü»þ¡¢½èÍý¥Õ¥¡¥¤¥ëÌ¾¡¢¥á¥Ã¥»¡¼¥¸¤ò½ÐÎÏ
+ * [°ú¿ô] É½¼¨¤·¤¿¤¤¥á¥Ã¥»¡¼¥¸
+ * [ÌáÃÍ] ¤Ê¤·
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfPrintLog($mess, $path = '') {
+	// ÆüÉÕ¤Î¼èÆÀ
+	$today = date("Y/m/d H:i:s");
+	// ½ÐÎÏ¥Ñ¥¹¤ÎºîÀ®
+	if ($path == "") {
+		$path = LOG_PATH;
+	}
+	
+	// ¥¨¥¹¥±¡¼¥×¤µ¤ì¤Æ¤¤¤ëÊ¸»ú¤ò¤â¤È¤ËÌá¤¹
+	$trans_tbl = get_html_translation_table (HTML_ENTITIES);
+    $trans_tbl = array_flip ($trans_tbl);
+    $mess = strtr($mess, $trans_tbl);
+	
+	$fp = fopen($path, "a+");
+	if($fp) {
+		fwrite( $fp, $today." [".$_SERVER['PHP_SELF']."] ".$mess." from ". $_SERVER['REMOTE_ADDR']. "\n" );
+		fclose( $fp );
+	}
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfMakePassword
+ * [³µÍ×] ¥é¥ó¥À¥à¥Ñ¥¹¥ï¡¼¥ÉÀ¸À®¡Ê±Ñ¿ô»ú¡Ë
+ * [°ú¿ô] ¥Ñ¥¹¥ï¡¼¥É¤Î·å¿ô
+ * [ÌáÃÍ] ¥é¥ó¥À¥àÀ¸À®¤µ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfMakePassword($pwLength) {
+	
+	// Íð¿ôÉ½¤Î¥·¡¼¥É¤ò·èÄê
+	srand((double)microtime() * 54234853);
+	
+	// ¥Ñ¥¹¥ï¡¼¥ÉÊ¸»úÎó¤ÎÇÛÎó¤òºîÀ®
+	$character = "abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ2345679";
+	$pw = preg_split("//", $character, 0, PREG_SPLIT_NO_EMPTY);
+	
+	$password = "";
+	for($i = 0; $i<$pwLength; $i++ ) {
+		$password .= $pw[array_rand($pw, 1)];
+	}
+
+	return $password;
+} 
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] sf_explodeExt
+ * [³µÍ×] ¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò¼èÆÀ
+ * [°ú¿ô] ¥Õ¥¡¥¤¥ëÌ¾
+ * [ÌáÃÍ] ³ÈÄ¥»Ò
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gf_explodeExt($fileName) {
+	$ext1 = explode(".", $fileName);
+	$ext2 = $ext1[count($ext1) - 1];
+	$ext2 = strtolower($ext2);
+	return $ext2;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------
+ * [Ì¾¾Î] gfMailHeaderAddr
+ * [³µÍ×] ÆþÎÏ¤µ¤ì¤¿¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¥á¡¼¥ë´Ø¿ôÍÑ¤Î°¸Àè¤ËÊÑ´¹
+ * [°ú¿ô] ¡Ö¥á¡¼¥ë¥¢¥É¥ì¥¹¡×¤Þ¤¿¤Ï¡ÖÌ¾Á°<¥á¡¼¥ë¥¢¥É¥ì¥¹>¡×¡¢Ê£¿ô¥¢¥É¥ì¥¹»ØÄê»þ¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤Ç»ØÄê¤¹¤ë¡£
+ * [ÌáÃÍ] ¡Ö¥á¡¼¥ë¥¢¥É¥ì¥¹¡×¤Þ¤¿¤Ï¡ÖJIS_MIME¤Ë¥³¡¼¥ÉÊÑ´¹¤·¤¿Ì¾Á° <¥á¡¼¥ë¥¢¥É¥ì¥¹>¡×¡¢Ê£¿ô¥¢¥É¥ì¥¹»ØÄê»þ¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊÖµÑ¤¹¤ë¡£
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------------------------------------------------------*/
+
+function gfMailHeaderAddr($str) {
+	$addrs = explode(",", $str); //¥¢¥É¥ì¥¹¤òÇÛÎó¤ËÆþ¤ì¤ë
+    foreach ($addrs as $addr) {
+        if (preg_match("/^(.+)<(.+)>$/", $addr, $matches)) {
+            //°ú¿ô¤¬¡ÖÌ¾Á°<¥á¡¼¥ë¥¢¥É¥ì¥¹>¡×¤Î¾ì¹ç
+            $mailaddrs[] = mb_encode_mimeheader(trim($matches[1]))." <".trim($matches[2]).">";
+        } else {
+            //¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î¤ß¤Î¾ì¹ç
+            $mailaddrs[] =  trim($addr);
+        }
+    }
+    return implode(", ", $mailaddrs); //Ê£¿ô¥¢¥É¥ì¥¹¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤Ë¤¹¤ë
+} 
+
+?>
Index: /temp/trunk/data/lib/thumb.php
===================================================================
--- /temp/trunk/data/lib/thumb.php	(revision 1328)
+++ /temp/trunk/data/lib/thumb.php	(revision 1328)
@@ -0,0 +1,161 @@
+<?php
+# MakeThumb(½ÐÎÏ¸µ²èÁü¥Ñ¥¹¡Ê¥Õ¥¡¥¤¥ëÌ¾¤Þ¤Ç¡Ë, ½ÐÎÏÀè¥Õ¥©¥ë¥À¡Ê/home/hoge/ ¤Ê¤É¡Ë , ºÇÂç²£Éý , ºÇÂç½ÄÉý , ¿·¥Õ¥¡¥¤¥ëÌ¾¡Ë
+function MakeThumb($FromImgPath , $ToImgPath , $tmpMW , $tmpMH, $newFileName = ''){
+
+# ¢¡¡þ¢¡¡¡¥Ç¥Õ¥©¥ë¥ÈÃÍ¤ÎÀßÄê¡¡¢¡¡þ¢¡
+# É¬Í×¤Ë±þ¤¸¤ÆÊÑ¹¹¤·¤Æ²¼¤µ¤¤¡£
+
+# ²èÁü¤ÎºÇÂç²£Éý¡ÊÃ±°Ì¡§¥Ô¥¯¥»¥ë¡Ë
+$ThmMaxWidth = 500;
+
+# ²èÁü¤ÎºÇÂç½ÄÉý¡ÊÃ±°Ì¡§¥Ô¥¯¥»¥ë¡Ë
+$ThmMaxHeight = 500;
+
+# ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎÀÜÆ¬Ê¸»ú
+$PreWord = $head;
+
+# ¢¡¡þ¢¡¡¡ÀßÄê¤³¤³¤Þ¤Ç¡¡¢¡¡þ¢¡
+
+	//³ÈÄ¥»Ò¼èÆÀ
+	if (!$ext) {
+		$array_ext = explode(".", $FromImgPath);
+		$ext = $array_ext[count($array_ext) - 1];
+	}
+	
+	$MW = $ThmMaxWidth;
+	if($tmpMW) $MW = $tmpMW; # $MW¤ËºÇÂç²£Éý¥»¥Ã¥È	
+	
+	$MH = $ThmMaxHeight;
+	if($tmpMH) $MH = $tmpMH; # $MH¤ËºÇÂç½ÄÉý¥»¥Ã¥È
+	
+	if(empty($FromImgPath) || empty($ToImgPath)){ # ¥¨¥é¡¼½èÍý
+		return array(0,"½ÐÎÏ¸µ²èÁü¥Ñ¥¹¡¢¤Þ¤¿¤Ï½ÐÎÏÀè¥Õ¥©¥ë¥À¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+	}
+	
+	if(!file_exists($FromImgPath)){ # ¥¨¥é¡¼½èÍý
+		return array(0,"½ÐÎÏ¸µ²èÁü¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£");
+	}
+	
+	$size = @GetImageSize($FromImgPath);
+	$re_size = $size;
+	
+	if(!$size[2] || $size[2] > 3){ # ²èÁü¤Î¼ïÎà¤¬ÉÔÌÀ or swf
+		return array(0,"²èÁü·Á¼°¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+	}
+
+	//¥¢¥¹¥Ú¥¯¥ÈÈæ¸ÇÄê½èÍý
+	$tmp_w = $size[0] / $MW;
+	
+	if($MH != 0){
+		$tmp_h = $size[1] / $MH;
+	}
+	
+	if($tmp_w > 1 || $tmp_h > 1){
+		if($MH == 0){
+			if($tmp_w > 1){
+				$re_size[0] = $MW;
+				$re_size[1] = $size[1] * $MW / $size[0];
+			}
+		} else {
+			if($tmp_w > $tmp_h){
+				$re_size[0] = $MW;
+				$re_size[1] = $size[1] * $MW / $size[0];
+			} else {
+				$re_size[1] = $MH;
+				$re_size[0] = $size[0] * $MH / $size[1];
+			}
+		}
+	}	
+	
+	# ¥µ¥à¥Í¥¤¥ë²èÁü¥Õ¥¡¥¤¥ëÌ¾ºîÀ®½èÍý
+	$tmp = array_pop(explode("/",$FromImgPath)); # /¤Î°ìÈÖºÇ¸å¤òÀÚ¤ê½Ð¤·
+	$FromFileName = array_shift(explode(".",$tmp)); # .¤Ç¶èÀÚ¤é¤ì¤¿ÉôÊ¬¤òÀÚ¤ê½Ð¤·
+	$ToFile = $PreWord.$FromFileName; # ³ÈÄ¥»Ò°Ê³°¤ÎÉôÊ¬¤Þ¤Ç¤òºîÀ®
+	
+	$ImgNew = imagecreatetruecolor($re_size[0],$re_size[1]);
+	
+	switch($size[2]) {
+	 	case "1": //gif·Á¼°
+			if($tmp_w <= 1 && $tmp_h <= 1){
+				if ( $newFileName ) {
+					$ToFile = $newFileName;
+				} elseif  ($ext) {
+					$ToFile .= "." . $ext;
+				} else {
+					$ToFile .= ".gif";
+				}
+				if(!@copy($FromImgPath , $ToImgPath.$ToFile)) { # ¥¨¥é¡¼½èÍý
+					return array(0,"¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+				}
+				ImageDestroy($ImgNew);
+				return array(1,$ToFile);
+			}
+					
+			ImageColorAllocate($ImgNew,255,235,214); //ÇØ·Ê¿§
+			$black = ImageColorAllocate($ImgNew,0,0,0);
+			$red = ImageColorAllocate($ImgNew,255,0,0);
+			Imagestring($ImgNew,4,5,5,"GIF $size[0]x$size[1]", $red);
+			ImageRectangle ($ImgNew,0,0,($re_size[0]-1),($re_size[1]-1),	$black);
+			
+			if ( $newFileName ) {
+				$ToFile = $newFileName;
+			} elseif($ext) {
+				$ToFile .= "." . $ext;
+			} else {
+				$ToFile .= ".png";
+			}
+			$TmpPath = $ToImgPath.$ToFile;
+			@Imagepng($ImgNew,$TmpPath);
+			if(!@file_exists($TmpPath)){ # ²èÁü¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+				return array(0,"²èÁü¤Î½ÐÎÏ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+			}
+			ImageDestroy($ImgNew);
+			return array(1,$ToFile);
+			
+	 	case "2": //jpg·Á¼°
+			$ImgDefault = ImageCreateFromJpeg($FromImgPath);
+			//ImageCopyResized( $ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+			ImageCopyResampled( $ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+
+			if ( $newFileName ) {
+				$ToFile = $newFileName;
+			} elseif($ext) {
+				$ToFile .= "." . $ext;
+			} else {
+				$ToFile .= ".jpg";
+			}
+			$TmpPath = $ToImgPath.$ToFile;
+			@ImageJpeg($ImgNew,$TmpPath);
+			if(!@file_exists($TmpPath)){ # ²èÁü¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+				return array(0,"²èÁü¤Î½ÐÎÏ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>${ImgNew}<br>${TmpPath}");
+			}
+			$RetVal = $ToFile;
+	 		break;
+	 		
+	 	case "3": //png·Á¼°
+			$ImgDefault = ImageCreateFromPNG($FromImgPath);
+			//ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+			ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+			
+			if ( $newFileName ) {
+				$ToFile = $newFileName;
+			} elseif ($ext) {
+				$ToFile .= "." . $ext;
+			} else {
+				$ToFile .= ".png";
+			}
+			$TmpPath = $ToImgPath.$ToFile;
+			@ImagePNG($ImgNew,$TmpPath );
+			if(!@file_exists($TmpPath)){ # ²èÁü¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+				return array(0,"²èÁü¤Î½ÐÎÏ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+			}
+			$RetVal = $ToFile;
+			break;
+	}
+	
+	ImageDestroy($ImgDefault);
+	ImageDestroy($ImgNew);
+	
+	return array(1,$RetVal);
+}
+?>
