// $Id: homes_ctrl.js,v 1.7 2007/11/02 06:10:46 suwahara Exp $

/*##################################################################################################*/
/**
 * ¥Ö¥é¥¦¥¶¤Ë°ÍÂ¸¤»¤º¤ËnameÂ°À­¤«¤éelement¥ê¥¹¥È¤ò¼èÆÀ
 */
function getElementsByName (name, doc) {
	var _list;
	
	obj = (doc ? doc : document);
	if (obj.all) _list = obj.all.item(name);
	if (obj.getElementsByName) _list = obj.getElementsByName(name);
	return _list;
}

/**
 * ¥Ö¥é¥¦¥¶¤Ë°ÍÂ¸¤»¤º¤ËidÂ°À­¤«¤éelement¥ê¥¹¥È¤ò¼èÆÀ
 */
function getElementById (id, doc) {
	var _id;
	
	doc = (doc ? doc : document);
	if (doc.all) _id = doc.all(id);
	if (doc.getElementById) _id = doc.getElementById(id);
	return _id;
}

/**
 * INPUT¤Ø¤Îµ¼»÷CLICK¥¤¥Ù¥ó¥È¡ÊSafariÍÑ¡Ë
 */
function doClick (node) {
	if (node.tagName.toLowerCase() != 'input') return;
	var type = node.type.toLowerCase();
	if (type == 'checkbox') node.checked = !node.checked;
	if (type == 'radio') node.checked = true;
}

/**
 * ÂçÊ¸»ú/¾®Ê¸»ú¤ò¶èÊÌ¤»¤º¤ËÊ¸»úÎóÈæ³Ó
 * Ã¢¤·C¤Î¤½¤ì¤È¤Ï°ã¤¤¡¢°ìÃ×¤·¤¿¤éTRUE¡¢ÉÔ°ìÃ×¤Ê¤éFALSE¤òÊÖ¤¹¤³¤È¤ËÃí°Õ
 */
function strComp (s1, s2) {
	return (s1.toLowerCase() == s2.toLowerCase());
}

/**
 * NODE¤¬¡¢¤¢¤ëID¤ò»ý¤ÄNODE¤Î»ÒÂ¹¤Ç¤¢¤ë¤«¤òÈ½Äê
 *   node :
 *     ¥Á¥§¥Ã¥¯ÂÐ¾Ý¤ÎNODE¡£
 *   id :
 *     ¥Á¥§¥Ã¥¯ÂÐ¾Ý¤ÎID¡£
 */
function isDescendantById (node, id) {
	var is_match = false;
	var pointer = node;
	while (pointer) {
		if (pointer.id) {
			is_match = strComp(pointer.id, id);
			if (is_match) break;
		}
		pointer = pointer.parentNode;
	}
	return (is_match);
}

/**
 * NODE¤¬¡¢¤¢¤ë¥¿¥°¤Î»ÒÂ¹¤Ç¤¢¤ë¤«¤òÈ½Äê
 *   node :
 *     ¥Á¥§¥Ã¥¯ÂÐ¾Ý¤ÎNODE¡£
 *   tag :
 *     ¥Á¥§¥Ã¥¯ÂÐ¾Ý¤Î¥¿¥°¡£
 */
function isDescendantByTag (node, tag) {
	var is_match = false;
	var pointer = node;
	while (pointer) {
		if (pointer.tagName && strComp(pointer.tagName, tag)) {
			is_match = true;
			break;
		}
		pointer = pointer.parentNode;
	}
	return (is_match);
}

/**
 * Window Open
 */
var win = window;
function OpenWin(url,w,h,sc){
	if ((win == window) || win.closed) {
		settings ='width='+w+',height='+h+',scrollbars='+sc+',resizable=yes';
		win=window.open(url,"Wexplanation",settings);
	} else {
		win.location.replace(url);
		win.focus();
	}
}

/**
 *	¥Ú¡¼¥¸¤ÎÈô¤Ð¤·ÀèURL¤ÎÀÚ¤êÂØ¤¨(SSL / ÈóSSL)
 *	2006.02.10 S.Misu
*/
function cChangeAction( submit_name, check_id, form, obj, servername, filename ) {
	this.form = form;
	this.obj = obj;
	this.submit = submit_name;			/*submit¤Îname*/
	this.chk_id = check_id;
	this.servername = servername;
	this.filename = filename;

	this.eClick = function (node) {
		var node_name = node.name;		/*²¡¤µ¤ì¤¿name="¢·"¤ò¼èÆÀ*/
		if(this.submit != node_name)	return(true);
		if(!this.chk_id) return(true);
		
		if(document.getElementById(this.chk_id).checked){
			this.form.action = 'https://'+ servername + filename;
		} else {
			this.form.action = 'http://'+ servername + filename;
		}
		return true;
	}
	return true;
}
/**
 *	¥Ú¡¼¥¸¤ÎÈô¤Ð¤·ÀèURL¤ÎÀÚ¤êÂØ¤¨(SSL / ÈóSSL)
 */
function cChangeActionOnSubmit(submit_name, checkbox_id) {
	this.submit_name = submit_name;
	this.checkbox_id = checkbox_id;

	this.eClick = function (node) {
		if (this.submit_name != node.name) return(true);
		
		var protocol = null;
		var position = node.form.action.indexOf('://') + 3;
		if(document.getElementById(this.checkbox_id).checked){
			protocol = 'https://';
		} else {
			protocol = 'http://';
		}
		node.form.action = protocol + node.form.action.substr(position);
		return true;
	}
	return true;
}

/**
 *	Ï¢Â³¥Ü¥¿¥ó²¡²¼À©¸æ
 *  ¡Êstr_submit¤ò¥í¥Ã¥¯¤·¡¢id_ele¤Î¥Æ¥­¥¹¥È¤Ëstr_msg¤òÀßÄê¡ÊÄÉµ­¡Ë¤·¡¢obj_form¤òsubmit¤¹¤ë¡Ë
 *	2006.02.14 T.Komoto
 */
function cChangeDisabled(str_submit, obj_form, id_ele, str_msg) {
	this.submit = str_submit;
	this.form = obj_form;
	this.ele = document.getElementById(id_ele);
	this.eClick = function (node) {
		var node_name = node.name;
		if(this.submit!=node_name)	return(true);
		if (!node.disabled) {
			node.disabled = true;
			if (str_msg) {
				myText=document.createTextNode(str_msg);
				this.ele.appendChild(myText);
			}
			this.form.submit();
		}
		return true;
	}
	return true;
}

/*##################################################################################################*/
/**
 * BG¥«¥é¡¼¤òÊÑ¤¨¤ë
 */
function cChangeBgColor(ele_name,change_bgcolor_id,default_color,cheked_color){
	this.eClick = function (node) {
		var node_id = node.id;
		var node_name = node.name;
		if (!node_id) return (true);
		if (node_name != ele_name) return (true);
		if(document.getElementById(node_id).checked){
			document.getElementById(change_bgcolor_id+node.value).style.backgroundColor = cheked_color;
		} else {
			document.getElementById(change_bgcolor_id+node.value).style.backgroundColor = default_color;
		}
		return true;
	}
	this.eLoad = function (node) {
		list = getElementsByName (ele_name);
		for (var i = 0; i < list.length; ++i) {
			this.eClick (list[i]);
		}
		return true;
	}
}

/**
 * LABEL¥¿¥°¤ËÂÐ¤·¡¢¥Þ¥¦¥¹¤¬¾è¤Ã¤¿ºÝ¤Î¥Ï¥¤¥é¥¤¥ÈÆ°ºî¤ò»ØÄê
 */
function cHighlightLabel (on_class) {
	this.on_class = on_class;
	this.setExcept = function (regext_except) {
		this.except = new RegExp (regext_except.toLowerCase(), "i");
	}
	this.eMouseOver = function (node) {
		if (!strComp(node.tagName, 'label')) return (true);
		node_id = node.id;
		node.style.cursor = (document.all ? 'hand' : 'pointer');
		change_color = true;
		if (this.except) {if (node_id.match(this.except)) {change_color = false}};
		if (change_color && this.on_class) {
			this.org_class = node.className;
			node.className = this.on_class + ' ' + this.org_class;
		}
	}
	this.eMouseOut = function (node) {
		if (!strComp(node.tagName, 'label')) return (true);
		if (this.on_class) {
			node.className = this.org_class;
		}
	}
}

/**
 * CHECKBOX¤Î¥°¥ë¡¼¥Ô¥ó¥°¤ò¹Ô¤¦
 *   parent_id :
 *     ¥°¥ë¡¼¥×¤Î¿Æ¤È¤Ê¤ë¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎID¡£¤³¤Î¥Ü¥Ã¥¯¥¹¤¬¾ï¤Ë¥È¥ê¥¬¤È¤Ê¤ë¡£
 *   children_name :
 *     ¥°¥ë¡¼¥×¤Î»Ò¶¡¤¿¤Á¤ÎÌ¾Á°¡£¤³¤Á¤é¤ÏNAMEÂ°À­¤Ç¤¢¤ë¤³¤È¤ËÃí°Õ¡£
 *     ¤³¤ì¤é¤Î»Ò¤é¤¬¡¢¿Æ¤ÈÏ¢Æ°¤·¤Æ¥Á¥§¥Ã¥¯¤µ¤ì¤¿¤ê³°¤µ¤ì¤¿¤ê¤¹¤ë¡£
 *   children_id_regexp :
 *     Æ±°ìÌ¾¤Î»Ò¶¡¤¿¤Á¤òÊÌ¡¹¤Î¿Æ¤ËÉ³ÉÕ¤±¤¿¤¤¾ì¹ç¤Ê¤É¤Ë¡¢IDÂ°À­¤òÀµµ¬É½¸½¤Çµ­½Ò¡£
 */
function cCheckGroup (parent_id, children_name, children_id_regexp) {
	this.pid     = parent_id;
	this.cname   = children_name.toLowerCase();
	this.usecid  = (children_id_regexp ? true : false);
	this.cexp    = new RegExp (children_id_regexp.toLowerCase(), "i");
	this.checked = false;
	this.syncObj = new Array();
	this.getTime = function () {
		dd = new Date();
		return dd.getTime();
	}
	this.etime  = this.getTime();
	this.setSync = function (obj) {
		this.syncObj.push(obj);
	}
	this.sync = function (checked) {
		this.checked = checked;
		target = getElementById(this.pid);
		target.checked = checked;
	}
	this.eClick = function (node) {
		if (!strComp(node.tagName, 'input')) return (true);
		var node_id = node.id;
		if (!node_id) return (true);
		if (node_id.toLowerCase() != this.pid.toLowerCase()) return (true);
		var list = getElementsByName (this.cname);
		var is_target;
		this.checked = !this.checked;
		var now = this.getTime();
		if (now && (this.etime + 100) >= now) this.checked = node.checked;
		this.etime = now;
		for (var i = 0; i < list.length; ++i) {
			is_target = true;
			if (this.usecid) {
				id = list[i].id;
				is_target = id.match(this.cexp);
			}
			if (is_target) list[i].checked = this.checked;
		}
		for (var i = 0; i < this.syncObj.length; ++i) {
			this.syncObj[i].sync(this.checked);
		}

		return (true);
	}
	this.eLoad = function () {
		var ua = navigator.userAgent;
		if (ua.indexOf("Safari") == -1) {
			// ¥Ö¥é¥¦¥¶¤ÎÌá¤ë»þ¤Ë¥Ð¥Ã¥Õ¥¡¤¬¥¯¥ê¥¢¤µ¤ì¤ë¤¿¤á¡¢½é´üÃÍ¤òÀßÄê
			var node = document.getElementById (parent_id);
			this.checked = node.checked;
		}
		if (ua.indexOf("Safari") != -1) {
			// SafariÍÑ¤ÎÆÃÊÌ½é´ü²½½èÍý
			var pnode = document.getElementById(parent_id);
			this.checked = pnode.checked;
			pnode['onclick'] = function() {homesCtrl._eClick(pnode);};
		}
		if (ua.indexOf("Opera 7") != -1) {
			// Opera 7ÍÑ¤ÎÆÃÊÌ½é´ü²½½èÍý
			list = document.getElementsByTagName('label');
			for (i=0;i<list.length;++i) {
				trg=list[i].attributes.getNamedItem('for');
				if (trg) {
					if (trg.value==parent_id) {
						var pnode = document.getElementById(parent_id);
						list[i]['onclick'] = function() {homesCtrl._eClick(pnode);};
						return;
					}
				}
			}
		}
	}
}

/**
 * ¥Ö¥í¥Ã¥¯¤ò¥¯¥ê¥Ã¥¯²ÄÇ½¤Ë¤·¡¢¥ê¥ó¥¯¤òÀßÄê¤¹¤ë
 */
function cClickableBlock (id, url, blank, target) {
	this.id  = id.toLowerCase();
	this.url = url;
	this.blank  = blank;
	this.target = (target ? target : window.self);
	this.setHighlightClass = function (class_name) {
		this.highlight = class_name;
	}
	this.eMouseOver = function (node) {
		if (!isDescendantById(node, this.id)) return (true);
		window.status = this.url;
		node.style.cursor = (document.all ? 'hand' : 'pointer');
		if (this.highlight) {
			var p = getElementById (id);
			this.org_class = p.className;
			p.className = this.highlight + ' ' + this.org_class;
		}
	}
	this.eMouseOut = function (node) {
		if (!isDescendantById(node, this.id)) return (true);
		window.status = '';
		if (this.highlight) {
			var p = getElementById (id);
			p.className = this.org_class;
		}
	}
	this.eClick = function (node) {
		if (!isDescendantById(node, this.id)) return (true);
		if (isDescendantByTag(node, 'A')) return (true);
		win = (this.blank ? window.open() : this.target);
		win.location.href = this.url;
		return true
	}
}

/**
 * A¥¿¥°¤Ç¤Î¥Ý¥Ã¥×¥¢¥Ã¥×¤ò¼Â¸½
 */
function cPopUpAnchor (id, w, h, sc ,name) {
	this.id  = id;
	this.w   = (w ? w : 650);
	this.h   = (h ? h : 620);
	this.sc  = (sc ? sc : 'yes');
	this.win = null;
	this.name = (name ? name : null);
	this.eClick = function (node) {
		if (!isDescendantById(node, this.id)) return (true);
		anchor = getElementById(this.id);

		var jaref = anchor.getAttribute('jaref');
		if(jaref){
			href = jaref;
		}else{
			href = anchor.href;
		}

		if (this.win == null || this.win.closed == undefined || this.win.closed) {
			settings ='width='+this.w+',height='+this.h+',scrollbars='+this.sc+',resizable=yes';
			this.win=window.open(href,this.name,settings);
			this.win.focus();
		} else {
			this.win.location.replace (href);
			this.win.focus();
		}
		return (false);
	}
}

/**
 * LOAD»þ¤Ë»ØÄê¥³¥ó¥È¥í¡¼¥ë¤Ø¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë
 */
function cSetFocusOnLoad (name) {
	this.name = name;
	this.eLoad = function (node) {
		var ctrl = getElementsByName (this.name);
		ctrl[0].focus();
		return true;
	}
}

/**
 * ¥¤¥á¡¼¥¸¥Ü¥¿¥ó¤ËÂÐ¤·¤Æ¡¢ÄÌ¾ï¤Îsubmit¥Ü¥¿¥óÆ±ÍÍ¤Ë¥¯¥ê¥Ã¥¯¤µ¤ì¤¿¥Ü¥¿¥ó¤ÎÌ¾Á°¤ØÃÍ¤òÆþ¤ì¤ë
 */
function cSubmitTracer () {
	this.form  = null;
	this.name  = "";
	this.value = null;
	this.eClick = function (node) {
		if (node.tagName == 'INPUT') {
			if (strComp(node.type, 'submit') || strComp(node.type, 'image')) {
				this.form  = node.form;
				this.name  = node.name;
				this.value = node.value;
			}
		}
		return true;
	}
}

/**
 * »ØÄê²èÁü¤Î¼«Æ°¥µ¥¤¥º½Ì¾®
 */
function cFixImage (id_exp, max_width, max_height) {
	this.id_exp     = new RegExp (id_exp, "i");
	this.max_width  = max_width;
	this.max_height = max_height;
	this.eLoad = function (node) {
		for (i = 0; i < document.images.length; ++i) {
			img = document.images[i]
			if (img.id) {
				if (img.id.match(this.id_exp)) {
					img_width  = img.width;
					img_height = img.height;
					img_scale  = img_width / img_height;
					if (img_height > this.max_height) {
						img_width  = img_scale * this.max_height;
						img_height = this.max_height;
					}
					if (img_width > this.max_width) {
						img_height = img_scale * this.max_width;
						img_width  = this.max_width;
					}
					if (img_width != img.width || img_height != img.height) {
						img.width  = img_width;
						img.height = img_height;
					}
				}
			}
		}
		return true;
	}
}

/**
 * JavaScript¤ÇÃÍ¤òÊÑ¤¨¤Æ¤¤¤ëÊÑ¿ô¤ò¡¢Load»þ¤Ë¸µ¤ØÌá¤¹
 */
function cResetValue (form, key, value) {
	this.form  = form;
	this.key   = key;
	this.value = value;
	this.eLoad = function (node) {
		form.elements[key].value = this.value;
		return true;
	}
}

/*##################################################################################################*/
/**
 *	zip_code¤«¤éaddress¤ò¼èÆÀ
 *	2005.12.20 S.Misu
 */
function cZipToAddress(id, zip1_id, zip2_id) {
	this.id   = id;
	this.zip1 = getElementById(zip1_id);
	this.zip2 = getElementById(zip2_id);
	this.win  = null;
	this.eClick = function(node) {
		if (!isDescendantById(node, this.id)) return (true);
		var anchor = getElementById(this.id);
		var post1 = this.zip1.value;
		var post2 = this.zip2.value;
		if (!post1 || !post2) {
			alert('¤Þ¤ºÍ¹ÊØÈÖ¹æ¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤');
			return false;
		}
		var href = anchor.href + "?post1=" + post1 + "&post2=" + post2;
		if (this.win == null || this.win.closed == undefined || this.win.closed) {
			this.win = open(href, "_blank", "width=640,height=300,resizable=yes");
			this.win.focus();
		} else {
			this.win.location.replace (href);
			this.win.focus();
		}
		return (false);
	}
}
/**
 * ¥Þ¥¹¥¿¡¼ÁªÂò¥¦¥£¥ó¥É¥¦¤òÉ½¼¨
 * button_name	: ¥¯¥ê¥Ã¥¯È½ÄêÍÑ ¥Ü¥¿¥óÌ¾
 * url			: Èô¤ÓÀè
 * code			: ÊÖÌáÃÍ¼õ¼è¤êÍÑÍ×ÁÇ¼±ÊÌ
 * with_id		: ÊÖÌáÃÍ¤ÎÀèÆ¬¤Ë ID ¤ò´Þ¤á¤ë¤«¡©
 */
function cMasterListOpener(button_name, url, code, with_id, width, height) {
	this.win	= null;
	this.width	= (width ? width : 500);
	this.height	= (height ? height : 600);
	this._makeUrl = function(node) {
		with_id = (with_id ? 1 : 0);
		var now = new Date();
		var code_val = getElementById(code + node.id);
		var href = url + '?id=' + node.id + '&code=' + code + '&with_id=' + with_id;
		if (code_val && code_val.value) href += '&val=' + escape(code_val.value);
		href += '&salt=' + now.getTime();
		return href;
	}
	this.eClick = function(node) {
		if (node.name != button_name || !node.id) return true;
		href = this._makeUrl(node);
		if (this.win == null || this.win.closed == undefined || this.win.closed) {
			this.win = open(href, "_blank", "width="+this.width+",height="+this.height+",scrollbars=yes,resizable=yes");
			this.win.focus();
		} else {
			this.win.location.replace(href);
			this.win.focus();
		}
		return false;
	}
}
/**
 * ¸Æ¤Ó½Ð¤·¸µ¤ËÃÍ¤ò¥»¥Ã¥È¤·¤Æ½ªÎ»
 * button_name	: ¥¯¥ê¥Ã¥¯È½ÄêÍÑÌ¾¾Î
 * item_name	: ÊÖÌáÃÍºîÀ®ÍÑÍ×ÁÇÌ¾¾Î
 * code			: ÊÖÌáÃÍ¼õ¼è¤êÍÑÍ×ÁÇ¼±ÊÌ
 * with_id		: ÊÖÌáÃÍ¤ÎÀèÆ¬¤Ë ID ¤ò´Þ¤á¤ë¤«¡©
 */
function cMasterListSubmit(button_name, item_name, code, with_id) {
	this.id_separator = '|';
	this.data_separator = ',';
	this._getCodeValues = function(node) {
		var item = getElementsByName(item_name);
		var result = new Array();

		for (var i = 0; i < item.length; ++i) {
			if (item[i].type == 'checkbox' && item[i].checked) {
				result.push(item[i].value);
			} else if (item[i].type == 'select-one') {
				result.push(item[i].value);	
			} else if (item[i].type == 'select-multiple') {
				for (var j = 0; j < item[i].options.length; ++j) {
					if (item[i].options[j].selected) {
						result.push(item[i].options[j].value);
					}
				}
			}
		}
		var ret = result.join(this.data_separator);
		if (ret) {
			if (with_id) ret = node.id + this.id_separator + ret;
		}
		return ret;
	}
	this._setOpenerValue = function (key, val) {
		var _item = getElementById(key, window.opener.document);
		if (_item) {
			_item.value = val;
		}
	}
	this.eClick = function(node) {
		if (node.name == button_name && node.id) {
			this._setOpenerValue(code+node.id, this._getCodeValues(node));
			window.close();
		}
		return true;
	}
}

/*##################################################################################################*/
var homesCtrl =
{
	/**
	 * CLICK¥¤¥Ù¥ó¥È
	 * LABEL¥¿¥°¤¬IE°Ê³°¤Ç¤³¤Î¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤Ã¤¿¾ì¹ç¡¢ÆÃÊÌ½èÍý¤È¤·¤ÆID¤Ç»ØÄê¤µ¤ì¤¿
	 * NODE¤Ø¥¤¥Ù¥ó¥È¤ò¥Ð¥Ö¥ê¥ó¥°¤¹¤ë¡£
	 * ÆÃÊÌ½èÍý¤ò¹Ô¤¦¤Ë¤Ï¡¢ID¤ÎÃÍ¤ò¼¡¤Î¤è¤¦¤Ë¤¹¤ëÉ¬Í×¤¬¤¢¤ë¡£
	 *   id="lbl:{¥Ð¥Ö¥ê¥ó¥°¤¹¤ë¥³¥ó¥È¥í¡¼¥ë¤ÎID}"
	 */
	eClick : function (e) {
		var node = (document.all ? event.srcElement : e.target);
		if (!node.tagName) node = node.parentNode;
		if (!document.all) {
			if (strComp(node.tagName, 'label')) {
				var target=node.attributes.getNamedItem('for');
				if (target) {
					node = document.getElementById (target.value);
					if (navigator.userAgent.indexOf("Safari") != -1) doClick (node);
				}
			}
		}
		ret = this._eClick (node);
		if (!ret) {
			if (navigator.userAgent.indexOf("Safari")) {
					node['onclick'] = function() {return false};
			} else if (e && e.preventDefault) {
				e.preventDefault();
			} else if (event && event.preventDefault) {
				event.preventDefault();
			}
		}
		return (ret);
	},
	_eClick : function (node) {
		var ret = true;
		for (var i = 0; i < this.obj.length; ++i) {
			if (this.obj[i].eClick) {
				var res = this.obj[i].eClick(node);
				ret = (ret && res);
			}
		}
		return ret;
	},
	/**
	 * MOUSEOVER¥¤¥Ù¥ó¥È
	 */
	eMouseOver : function (e) {
		var node = (document.all ? event.srcElement : e.target);
		if (!node.tagName) node = node.parentNode;
		ret = this._eMouseOver (node);
		// ¤³¤³¤Çtrue¤òÊÖ¤¹¤È¡¢IE¤Ç¤Ê¤¼¤«A¥¿¥°¤Ë¤è¤ë¥ê¥ó¥¯¤¬¥¹¥Æ¡¼¥¿¥¹¤ËÉ½¼¨¤µ¤ì¤Ê¤¯¤Ê¤ë¤¿¤á
		ret = false;
		return (ret);
	},
	_eMouseOver : function (node) {
		var ret = true;
		for (var i = 0; i < this.obj.length; ++i) {
			if (this.obj[i].eMouseOver) {
				var res = this.obj[i].eMouseOver(node);
				ret = (ret && res);
			}
		}
		return ret;
	},
	/**
	 * MOUSEOUT¥¤¥Ù¥ó¥È
	 */
	eMouseOut : function (e) {
		var node = (document.all ? event.srcElement : e.target);
		if (!node.tagName) node = node.parentNode;
		ret = this._eMouseOut (node);
		if (!ret && e) e.preventDefault ();
		return (ret);
	},
	_eMouseOut : function (node) {
		var ret = true;
		for (var i = 0; i < this.obj.length; ++i) {
			if (this.obj[i].eMouseOut) {
				var res = this.obj[i].eMouseOut(node);
				ret = (ret && res);
			}
		}
		return ret;
	},
	/**
	 * LOAD¥¤¥Ù¥ó¥È
	 */
	eLoad : function (e) {
		var ret = true;
		var node = (document.all ? event.srcElement : e.target);
		for (var i = 0; i < this.obj.length; ++i) {
			if (this.obj[i].eLoad) {
				var res = this.obj[i].eLoad(node);
				ret = (ret && res);
			}
		}
		if (!ret && e) e.preventDefault ();
		return (ret);
	},
	/**
	 * Æ°ºîÂÐ¾Ý¤È¤Ê¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ÎÅÐÏ¿
	 */
	registerObj : function (o) {
		if (typeof Hyjax == 'undefined') {
			if (!this.obj) this.obj = new Array();
			this.obj.push (o);
		} else {
			// Hyjax ¤¬¤¢¤ë¾ì¹ç¤Ï¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤ò Hyjax ¤Ø°Ñ¾ù
			Hyjax.EventHandler.register(o);
		}
	}
};

/*##################################################################################################*/
/**
 * ¥¤¥Ù¥ó¥È¤Î¥Ï¥ó¥É¥ê¥ó¥°
 */
if (typeof Hyjax == 'undefined') {
	// Hyjax ¤¬¤Ê¤¤¾ì¹ç¤Î¤ß¡¤¤³¤³¤Ç¥¤¥Ù¥ó¥È¤òÅÐÏ¿¤¹¤ë
	if (document.attachEvent)
	{
		document.attachEvent('onclick',     function(){return homesCtrl.eClick()});
		document.attachEvent('onmouseover', function(){return homesCtrl.eMouseOver()});
		document.attachEvent('onmouseout',  function(){return homesCtrl.eMouseOut()});
	}
	else if (document.addEventListener)
	{
		document.addEventListener('click',     function(e){return homesCtrl.eClick(e)},     true);
		document.addEventListener('mouseover', function(e){return homesCtrl.eMouseOver(e)}, true);
		document.addEventListener('mouseout',  function(e){return homesCtrl.eMouseOut(e)},  true);
	}

	if (window.attachEvent) {
		window.attachEvent('onload', function(){return homesCtrl.eLoad()});
	}
	else if (window.addEventListener) {
		window.addEventListener('load', function(e){return homesCtrl.eLoad(e)}, true);
	}
}


// LABEL¤Î¥Ï¥¤¥é¥¤¥È½èÍý¤Ï¾ï¤ËÅÐÏ¿¤·¤Æ¤ª¤¯
var o = new cHighlightLabel ();
homesCtrl.registerObj (o);
