	if(!document.mp2)	document.mp2={};
	if(!document.mp2.form)	document.mp2.form={};

	if ( document.all && document.getElementById && !window.opera ) {
		document.mp2.IE = true;
	}

	if ( !document.all && document.getElementById && !window.opera ) {
		document.mp2.FF = true;
	}

	if ( document.all && document.getElementById && window.opera ) {
		document.mp2.OP = true;
	}

	document.mp2.addWindowEvent = function ( ename, func, cas )	{
		if (window.addEventListener){
		  window.addEventListener(ename, func, cas );
		} else if (window.attachEvent){
		  window.attachEvent('on'+ename, func );
		}
	}

	function DivManager()	{
		this.divs=[];
	}

	DivManager.prototype.add=function(div)	{
		this.divs.push(div);
	}

	DivManager.prototype.getById=function(id)	{
		for ( i=0; i<this.divs.length ;i++ )	{
			if( this.divs[i].id==id )	return this.divs[i];
		}
		return null;
	}

	DivManager.prototype.hideAll=function()	{
		for ( i=0; i<this.divs.length ;i++ )	{
			this.divs[i].style.display='none';
		}
		return null;
	}

	if(!document.mp2.divManager)	document.mp2.divManager=new DivManager();

	function __display_div__2( divname )	{
		var d = document.mp2.divManager.getById( divname );
		if( d.style.display=='none' )	{
			document.mp2.divManager.hideAll();
			d.style.display='';
		}	else	{
			document.mp2.divManager.hideAll();
		}
	}

//	Date Input

	if(!document.mp2.form.DateInput)	document.mp2.form.DateInput=[];
	document.mp2.refresh_date_chooser=function ( i,date )	{
			var jajax = new Jajax();
			jajax.onreadystatechange = function ()	{
				try	{
					if (jajax.XMLHttpRequestObject.readyState == 4 &&
						jajax.XMLHttpRequestObject.status == 200)	{
							var dinput=document.mp2.form.DateInput[i];
							dinput.chooser_div.innerHTML=jajax.XMLHttpRequestObject.responseText;
					}
				}	catch(e){}
			}
			jajax.get( '/util/DateChooser2.php?ind='+i+'&date='+date );
	}
	document.mp2.click_date_chooser=function( i,date,close )	{
		var dinput=document.mp2.form.DateInput[i];
		var changed=(dinput.value!=date);
		dinput.obj.value=date;
		document.mp2.refresh_date_chooser( i, date );
		if( close )	{
			dinput.chooser_div.style.display='none';
		}
		if( changed && dinput.obj.onchange )	dinput.obj.onchange();
	}

	function DateInput( div, name, id, value )	{
		this.div=div;
		this.name=name;
		this.id=id;
		this.value=(value===undefined)?'':value;
		this.index=document.mp2.form.DateInput.length;
		this.readonly=true;
		this.x=0;
		this.y=0;
		this.onchange=null;
		document.mp2.form.DateInput.push(this);
	}
	DateInput.prototype.display=function()	{
		var chooser_div_name='__date_chooser_'+this.id;
		this.div.innerHTML='<div><input name="'+this.name+'" id="'+this.id+'" value="'+this.value+'" type="text" maxlength="10" size="10" '+
			'oncontextmenu="return false;" '+
			'onchange="'+((this.onchange!=null)?this.onchange:'')+'if( this.value!=\'\' && !qualified_date( this.value ) ){alert(\'日期錯誤，請重新輸入\\nEnter quailfied date please.\');this.value=\'\';this.focus();}" '+
			'onfocus="if(document.mp2.form.DateInput['+this.index+'].chooser_div.style.display==\'none\') {__display_div__2(\''+chooser_div_name+'\');document.mp2.refresh_date_chooser( '+this.index+', this.value );}" '+
			((this.readonly)?'readonly':'')+' />'+
			'<a href="Javascript:void(0);" onclick="__display_div__2(\''+chooser_div_name+'\');document.mp2.refresh_date_chooser( '+this.index+', document.mp2.form.DateInput['+this.index+'].obj.value );"><img src="/util/images/calendar.png" align="absmiddle" style="vertical-align:middle;" width="16" height="16" border="0" /></a></div>'+
			'<div style="float:left;position:relative;width:170px;"><div style="position:absolute; top:'+this.y+'px; left:'+this.x+'px;margin:0px; padding:0px;">'+
			'<div id="'+chooser_div_name+'" style="display:none;background:white;width:180px;margin-left:0px;border:solid 1px rgb(32,64,248);padding:2px;"></div></div></div>';
		this.obj=document.getElementById(this.id);
		this.chooser_div=document.getElementById(chooser_div_name);
		document.mp2.divManager.add(this.chooser_div);
	}

//	GMap

	if(!document.mp2.form.GMapInput)	document.mp2.form.GMapInput=[];
	document.mp2.gmap_enable=(typeof(GLatLng)!='undefined');
	if(!document.mp2.gmap_default_point&&document.mp2.gmap_enable)	document.mp2.gmap_default_point=new GLatLng( 24.988226616988,121.4606487751 );
	if(!document.mp2.gmap_default_zoom)	document.mp2.gmap_default_zoom=11;
	document.mp2.gmap_geocoder = null;
	function GMapInput( div, lat, lng )	{
		this.div=div;
		this.MapType=(typeof(G_HYBRID_MAP)=='undefined')?0:G_HYBRID_MAP;
			//	G_NORMAL_MAP	地圖 Map
			//	G_SATELLITE_MAP	衛星 Satellite
			//	G_HYBRID_MAP	混合 Hybrid
			//	G_PHYSICAL_MAP	地形 Physical
		this.ContinuousZoom=true;
		this.ScrollWheelZoom=true;
		this.latlng=(lng===undefined)?null:new GLatLng( lat, lng );
		this.latvar=null;
		this.lngvar=null;
		if(this.latvar!=null&&this.latlng!=null)	this.latvar.value=this.latlng.lat();
		if(this.lngvar!=null&&this.latlng!=null)	this.lngvar.value=this.latlng.lng();
		this.editable=true;
		this.marker=null;
		this.address='';
		this.map_marks=[];
		this.index=document.mp2.form.GMapInput.length;
		document.mp2.form.GMapInput.push(this);
	}

	document.mp2.gmap_refresh_latlng=function()	{
		for ( i=0; i<document.mp2.form.GMapInput.length ;i++ )	{
			document.mp2.form.GMapInput[i].refresh_latlng();
		}
	}

	document.mp2.map_mark=null;

	document.mp2.add_map_mark_resp2=function( resp )	{
		alert(resp.responseText);
		//	refresh_map_mark();
	}
	document.mp2.add_map_mark_resp1=function( resp )	{
		if (resp.responseText!='')	{
			alert(resp.responseText);
			return;
		}	else	{
			var p=document.mp2.map_mark;
			var mmname=null;
			if( (mmname=prompt('請輸入地圖標記名稱') ) && mmname!='' )
				ajaxGet( '/util/map_mark.php?op=add&name='+encodeURIComponent(mmname)+'&lat='+p.lat()+'&lng='+p.lng(), document.mp2.add_map_mark_resp2 );
		}
	}

	GMapInput.prototype.create_marker_at=function ( p )	{
		this.marker = new GMarker(p, {draggable: true});
		this.marker.ginput=this;
		GEvent.addListener(this.marker , 'dragend', function(bnds) {
				document.mp2.gmap_refresh_latlng();
			});
		var i=this.index;
		GEvent.addListener(this.marker, "click", function() {
				var p=document.mp2.form.GMapInput[i].marker.getLatLng();
				document.mp2.map_mark=p;
				ajaxGet( '/util/map_mark.php?op=check&lat='+p.lat()+'&lng='+p.lng(), document.mp2.add_map_mark_resp1 );
			});
		this.map.addOverlay( this.marker );
		this.refresh_latlng();
	}

	GMapInput.prototype.refresh_latlng=function ( )	{
		if(this.latvar!=null )
			this.latvar.value=(this.marker!=null)?this.marker.getLatLng().lat():'';
		if(this.lngvar!=null )
			this.lngvar.value=(this.marker!=null)?this.marker.getLatLng().lng():'';
	}

	function refresh_map_mark_resp( resp )	{
		var ret=evalJSON(resp);
		var marks=ret.marks;
		var index=ret.index;
		var blueIcon = new GIcon(G_DEFAULT_ICON);
		blueIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";
		for( var im in marks )	{
			var m=marks[im];
			var p=new GLatLng( m.lat, m.lng );
			
			// Set up our GMarkerOptions object
			var markerOptions = { icon:blueIcon,title:m.name };
			var mmmarker = new GMarker(p,markerOptions);
			GEvent.addListener(mmmarker, "click", function(_latlng) {
					with(document.mp2.form.GMapInput[index])	{
						if( marker==null )	{
							create_marker_at(_latlng);
							document.getElementById('set_marker_'+index).style.display='none';
							document.getElementById('remove_marker_'+index).style.display='';
						}	else	{
							marker.setPoint(_latlng);
							if(latvar!=null)	latvar.value=_latlng.lat();
							if(lngvar!=null)	lngvar.value=_latlng.lng();
						}
					}
				});
			with(document.mp2.form.GMapInput[index])	{
				map.addOverlay( mmmarker );
				map_marks.push( mmmarker );
			}
		}
		with(document.mp2.form.GMapInput[index])	{
			if( marker!=null )	{
				map.removeOverlay( marker );
				map.addOverlay( marker );
			}
		}
		//	refresh_map_mark();
	}
	GMapInput.prototype.clear_map_mark=function ()	{
		for(var im in this.map_marks)	{
			this.map.removeOverlay( this.map_marks[im] );
		}
		this.map_marks=[];
	}

	GMapInput.prototype.refresh_map_mark=function ()	{
		this.clear_map_mark();
		ajaxGet( '/util/map_mark.php?op=refresh&index='+this.index, refresh_map_mark_resp );
	}

	GMapInput.prototype.show_address=function ( address )	{
		var i=this.index;
		if( document.mp2.gmap_geocoder==null )	{
			alert("目前無法找地址");
			return;
		}
		document.mp2.gmap_geocoder.getLatLng(
				address,
				function(p) {
					if (!p) {
						alert("'" + address + "' 地址找不到");
					} else {
						with( document.mp2.form.GMapInput[i] )	{
							if( marker!=null )
								map.removeOverlay( marker );
							else	{
								document.getElementById('set_marker_'+index).style.display='none';
								document.getElementById('remove_marker_'+index).style.display='';
							}
							create_marker_at( p );
							map.setCenter( p, map.getZoom() );
						}
					}
				}
			);
	}
	GMapInput.prototype.initialize=function()	{
		var panelheight=0;
		var pheight=this.div.offsetHeight-parseInt(this.div.style.borderTopWidth)-parseInt(this.div.style.borderBottomWidth);
		var pwidth=this.div.offsetWidth-parseInt(this.div.style.borderLeftWidth)-parseInt(this.div.style.borderRightWidth);
		if ( this.editable )	{
			var paneldiv = document.createElement("div");
			panelheight=38;
			paneldiv.style.width=pwidth+'px';
			paneldiv.style.height=panelheight+'px';
			var ptable=document.createElement("table"); 
			ptable.style.border="1"; 

			var div0=document.createElement("div"); 
			ptable.insertRow(-1);
			ptable.rows[0].insertCell(-1);
			ptable.rows[0].cells[0].appendChild(div0); 
			paneldiv.appendChild(ptable); 
			div0.innerHTML='<a href="Javascript:void(0);" onclick="'+
					'with(document.mp2.form.GMapInput['+this.index+'])	{'+
					'	if( marker==null )	{'+
					'		create_marker_at(map.getCenter());'+
					'		document.getElementById(\'set_marker_'+this.index+'\').style.display=\'none\';'+
					'		document.getElementById(\'remove_marker_'+this.index+'\').style.display=\'\';'+
					'	}	else	{'+
					'		map.removeOverlay(marker);'+
					'		marker=null;'+
					'		refresh_latlng();'+
					'		document.getElementById(\'set_marker_'+this.index+'\').style.display=\'\';'+
					'		document.getElementById(\'remove_marker_'+this.index+'\').style.display=\'none\';'+
					'	}'+
					'}'+
				'"><img id="remove_marker_'+this.index+'" style="display:'+((this.latlng!=null)?'':'none')+';" src="/images/icons/map-remove-marker.png" width="32" height="32" border="0" title="移除標記 Remove Marker" onmouseover="this.src=\'/images/icons/map-remove-marker-o.png\';" onmouseout="this.src=\'/images/icons/map-remove-marker.png\';" />'+
				'<img id="set_marker_'+this.index+'" style="display:'+((this.latlng==null)?'':'none')+';" src="/images/icons/map-set-marker.png" width="32" height="32" border="0" title="設定標記 Set Marker" onmouseover="this.src=\'/images/icons/map-set-marker-o.png\';" onmouseout="this.src=\'/images/icons/map-set-marker.png\';" /></a>';

			var div1=document.createElement("div"); 
			ptable.rows[0].insertCell(-1);
			ptable.rows[0].cells[1].appendChild(div1); 
			div1.innerHTML+='<a href="Javascript:void(0);" onclick="'+
					'with(document.mp2.form.GMapInput['+this.index+'])	{'+
					'	if( marker!=null )	{'+
					'		map.removeOverlay(marker);'+
					'		marker=null;'+
					'	}'+
					'	if(latlng!=null)	{'+
					'		create_marker_at(latlng);'+
					'		map.setCenter(marker.getLatLng());'+
					'		document.getElementById(\'set_marker_'+this.index+'\').style.display=\'none\';'+
					'		document.getElementById(\'remove_marker_'+this.index+'\').style.display=\'\';'+
					'	}	else	{'+
					'		document.getElementById(\'set_marker_'+this.index+'\').style.display=\'\';'+
					'		document.getElementById(\'remove_marker_'+this.index+'\').style.display=\'none\';'+
					'	}'+
					'}'+
				'"><img id="reset_marker_'+this.index+'" style="display:;" src="/images/icons/reset-map.png" width="32" height="32" border="0" title="重置標記 Reset Marker" onmouseover="this.src=\'/images/icons/reset-map-o.png\';" onmouseout="this.src=\'/images/icons/reset-map.png\';" /></a>';

			var div2=document.createElement("div"); 
			ptable.rows[0].insertCell(-1);
			ptable.rows[0].cells[2].appendChild(div2); 
			div2.innerHTML+='<a href="Javascript:void(0);" onclick="'+
					'with(document.mp2.form.GMapInput['+this.index+'])	{'+
					'	if( document.getElementById(\'show_marker_'+this.index+'\').style.display==\'\' )	{'+
					'		refresh_map_mark();'+
					'		this.value=\'隱藏標記\';'+
					'		document.getElementById(\'show_marker_'+this.index+'\').style.display=\'none\';'+
					'		document.getElementById(\'hide_marker_'+this.index+'\').style.display=\'\';'+
					'	}	else	{'+
					'		clear_map_mark();'+
					'		document.getElementById(\'show_marker_'+this.index+'\').style.display=\'\';'+
					'		document.getElementById(\'hide_marker_'+this.index+'\').style.display=\'none\';'+
					'	}'+
					'}'+
				'"><img id="hide_marker_'+this.index+'" style="display:none;" src="/images/icons/map-no-marker.png" width="32" height="32" border="0" title="隱藏參考標記 Hide Reference Marker" onmouseover="this.src=\'/images/icons/map-no-marker-o.png\';" onmouseout="this.src=\'/images/icons/map-no-marker.png\';" />'+
				'<img id="show_marker_'+this.index+'" style="display:;" src="/images/icons/map-marker.png" width="32" height="32" border="0" title="顯示參考標記 Show Reference Marker" onmouseover="this.src=\'/images/icons/map-marker-o.png\';" onmouseout="this.src=\'/images/icons/map-marker.png\';" /></a>';

			var div3=document.createElement("div"); 
			ptable.rows[0].insertCell(-1);
			ptable.rows[0].cells[3].appendChild(div3); 
			div3.innerHTML+='<input style="font-size:9pt;" id="__gmap_address_'+this.index+'" value="'+this.address+'" type="text" size="16" style="width:145px;"/>'+
				'<input style="font-size:9pt;" type="button" onclick="var addr=document.getElementById(\'__gmap_address_'+this.index+'\').value;if(addr!=\'\') document.mp2.form.GMapInput['+this.index+'].show_address( addr ); else alert(\'請在欄位中輸入地址\');" value="Goto"/>';

			this.div.appendChild( paneldiv );
		}
		var mapdiv = document.createElement("div");
		mapdiv.style.width=pwidth+'px';
		mapdiv.style.height=(pheight-panelheight)+'px';
		this.div.appendChild( mapdiv );
		this.map = new GMap2( mapdiv, {draggableCursor:'crosshair'});
		this.map.setMapType( this.MapType);
		if ( this.ContinuousZoom )	{
			this.map.enableContinuousZoom();
		}	else	{
			this.map.disableContinuousZoom();
		}
		if ( this.ScrollWheelZoom )	{
			this.map.enableScrollWheelZoom();
		}	else	{
			this.map.disableScrollWheelZoom();
		}
		if (this.custom_initialize )	{
			this.custom_initialize(this.map);
		}	else	{
			this.map.setCenter( ( (this.latlng==null)?document.mp2.gmap_default_point:this.latlng ), document.mp2.gmap_default_zoom );
			this.map.addControl(new GSmallMapControl());
			if (this.latlng!=null)
				this.create_marker_at(this.latlng);
		}
		if ( this.editable && this.latlng==null )	{
			this.show_address(document.getElementById('__gmap_address_'+this.index).value);
		}
	}

	document.mp2.gmap_initialize=function()	{
		if( document.mp2.gmap_geocoder==null && typeof(GClientGeocoder)!='undefined' )
			document.mp2.gmap_geocoder=new GClientGeocoder();
		for ( i=0; i<document.mp2.form.GMapInput.length ;i++ )	{
			document.mp2.form.GMapInput[i].initialize();
		}
	}

	document.mp2.addWindowEvent('load', document.mp2.gmap_initialize, false); 

//	Context Menu
	document.mp2.JContextMenu = {
		_menus : new Array,
		_attachedElement : null,
		_pane : null,
		onload : function(e)	{
		//	document.mp2.JContextMenu._pane=document;
		},
		_onload : function(e)	{
			document.mp2.JContextMenu.onload();
			if( document.mp2.JContextMenu._pane!=null )	{
				document.mp2.JContextMenu._pane.oncontextmenu = document.mp2.JContextMenu._show;
				document.mp2.JContextMenu._pane.onclick = document.mp2.JContextMenu._hide;
			}
		},
		bindMenu : function(classNames, menuId)	{
			if (typeof(classNames) == "string")	{
				document.mp2.JContextMenu._menus[classNames] = menuId;
			}
			if (typeof(classNames) == "object")	{
				for (x = 0; x < classNames.length; x++) {
					document.mp2.JContextMenu._menus[classNames[x]] = menuId;
				}
			}
		},
		_show : function(e)	{
			document.mp2.JContextMenu._hide();
			var menuElementId = document.mp2.JContextMenu._getMenuElementId(e);
	 
			if (menuElementId)	{
				var m = document.mp2.JContextMenu._getMousePosition(e);
				var s = document.mp2.JContextMenu._getScrollPosition(e);
	 
				document.mp2.JContextMenu._menuElement = document.getElementById(menuElementId);
				document.mp2.JContextMenu._menuElement.style.left = m.x + s.x + 'px';
				document.mp2.JContextMenu._menuElement.style.top = m.y + s.y + 'px';
				document.mp2.JContextMenu._menuElement.style.display = 'block';
				return false;
			}
			return false;
		},
		attached_id : function( prefix )	{
			if( document.mp2.JContextMenu._attachedElement == null )	return null;
			var regexp = new RegExp( prefix+'_([0-9]+)' , 'g' );   
			var r=regexp.exec(document.mp2.JContextMenu._attachedElement.id);
			return r[1];
		},
		_getMenuElementId : function (e)	{
			if ( document.mp2.IE )	{
				document.mp2.JContextMenu._attachedElement = event.srcElement;
			}	else	{
				document.mp2.JContextMenu._attachedElement = e.target;
			}
			while(document.mp2.JContextMenu._attachedElement != null)	{
				var className = document.mp2.JContextMenu._attachedElement.className;
				if (typeof(className) != "undefined")	{
					className = className.replace(/^\s+/g, "").replace(/\s+$/g, "");
					var classArray = className.split(/[ ]+/g);
					for (i = 0; i < classArray.length; i++)	{
						if (document.mp2.JContextMenu._menus[classArray[i]])	{
							return document.mp2.JContextMenu._menus[classArray[i]];
						}
					}
				}
				if (document.mp2.IE)	{
					document.mp2.JContextMenu._attachedElement = document.mp2.JContextMenu._attachedElement.parentElement;
				}	else	{
					document.mp2.JContextMenu._attachedElement = document.mp2.JContextMenu._attachedElement.parentNode;
				}
			}
			return null;
		},
		_getMousePosition : function (e)	{
			e = e ? e : window.event;
			var position = {
				'x' : e.clientX,
				'y' : e.clientY
			}
			return position;
		},
		_getScrollPosition : function () {
			var x = 0;
			var y = 0;
			if( typeof( window.pageYOffset ) == 'number' )	{
				x = window.pageXOffset;
				y = window.pageYOffset;
			}	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )	{
				x = document.documentElement.scrollLeft;
				y = document.documentElement.scrollTop;
			}	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )	{
				x = document.body.scrollLeft;
				y = document.body.scrollTop;
			}
			var position = {
				'x' : x,
				'y' : y
			}
			return position;
		},
		_hide : function () {
			if (document.mp2.JContextMenu._menuElement)	{
				document.mp2.JContextMenu._menuElement.style.display = 'none';
			}
		}
	};
	document.mp2.addWindowEvent('load', document.mp2.JContextMenu._onload, false);

	// JModalBox
	// copyright 21st May 2006 by Stephen Chapman
	// http://javascript.about.com/
	// permission to use this Javascript on your web page is granted
	// provided that all of the code in this script (including these
	// comments) is used without any alteration

	// Jason Wang's comment : I alter this code because I used it as a modal box with AJAX.
	document.mp2.JModalBox = {
		_pageWidth : function() {
			return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
		} ,
		_pageHeight : function () {
			return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
		} ,
		_posLeft : function () {
			return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;
		} ,
		_posTop : function () {
			return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;
		} ,
		_$ : function (x){
			return document.getElementById(x);
		} ,
		_scrollFix : function (){
			with( document.mp2.JModalBox )	{
				var obol=_$('__mp2_JModalBox_ol');
				obol.style.top=_posTop()+'px';
				obol.style.left=_posLeft()+'px';
			}
		} ,
		_sizeFix : function (){
			with( document.mp2.JModalBox )	{
				var obol=_$('__mp2_JModalBox_ol');
				obol.style.height=_pageHeight()+'px';
				obol.style.width=_pageWidth()+'px';
			}
		} ,
	/*
		_keypress : function (e){
			with( document.mp2.JModalBox )	{
				ky=e?e.which:event.keyCode;
				if(ky==88||ky==120)	{
					hm();
					return false;
				}
				return true;
			}
		} ,
	*/
		_elementVisibility : function (h){
			with( document.mp2.JModalBox )	{
				tag=document.getElementsByTagName('select');
				for(i=tag.length-1;i>=0;i--)
					tag[i].style.visibility=h;
				tag=document.getElementsByTagName('iframe');
				for(i=tag.length-1;i>=0;i--)
					tag[i].style.visibility=h;
				tag=document.getElementsByTagName('object');
				for(i=tag.length-1;i>=0;i--)
					tag[i].style.visibility=h;
			}
		} ,
		_onload : function ( resp )	{
			with( document.mp2.JModalBox )	{
				setInnerHTML( resp.responseText );
				onload( resp );
			}
		} ,
		onload : function( resp )	{
		} ,
		setInnerHTML : function( innerHTML )	{
				document.getElementById( '__mp2_JModalBox_mbi' ).innerHTML=innerHTML;
		} ,
		show : function (url){
			with( document.mp2.JModalBox )	{
				var h='hidden';
				var b='block';
				var p='px';
				var obol=_$('__mp2_JModalBox_ol');
				obol.style.height=_pageHeight()+p;
				obol.style.width=_pageWidth()+p;
				obol.style.top=_posTop()+p;
				obol.style.left=_posLeft()+p;
				obol.style.display=b;
				var im=_$('__mp2_JModalBox_mbi');
				var tp=_posTop()+((_pageHeight()-parseInt(im.style.height))/2)-12;
				var lt=_posLeft()+((_pageWidth()-parseInt(im.style.width))/2)-12;
				var obbx=_$('__mp2_JModalBox_mbox');
				obbx.style.top=(tp<0?0:tp)+p;
				obbx.style.left=(lt<0?0:lt)+p;
				_$('__mp2_JModalBox_mbd').style.width=parseInt(im.style.width)+p;
				_elementVisibility(h);
				obbx.style.display=b;
				ajaxGet( url, _onload );
				document.getElementById('__mp2_JModalBox_mbi').innerHTML='<img src="/js/images/ajax-loading.gif" width="32" height="32" border="0" title="處理中 Processing...">';
		/*		document.onkeypress=_keypress;	*/
			}
		} ,
		onclose : function( )	{
		} ,
		hide : function (){
			with( document.mp2.JModalBox )	{
				var v='visible';
				var n='none';
				_$('__mp2_JModalBox_ol').style.display=n;
				_$('__mp2_JModalBox_mbox').style.display=n;
				_elementVisibility(v);
		/*		document.onkeypress='';	*/
				onclose();
			}
		} ,
		resize : function ( w, h )	{
			with( document.mp2.JModalBox )	{
				var mbi=_$('__mp2_JModalBox_mbi');
				mbi.style.width=w+'px';
				mbi.style.height=h+'px';
				_scrollFix();	_sizeFix();
			}
		} ,
		initialize : function (){
			with( document.mp2.JModalBox )	{
				var ab='absolute';
				var n='none';
				var obody=document.getElementsByTagName('body')[0];
				var frag=document.createDocumentFragment();
				var obol=document.createElement('div');
				obol.setAttribute('id','__mp2_JModalBox_ol');
				obol.style.display=n;
				obol.style.position=ab;
				obol.style.top=0;
				obol.style.left=0;
				obol.style.zIndex=998;
				obol.style.width='100%';
				frag.appendChild(obol);
				var obbx=document.createElement('div');
				obbx.setAttribute('id','__mp2_JModalBox_mbox');
				obbx.style.display=n;
				obbx.style.position=ab;
				obbx.style.zIndex=999;
				obbx.innerHTML='<span><div id="__mp2_JModalBox_mbd" style="height:20px;"><div id="__mp2_JModalBox_mbm" onclick="document.mp2.JModalBox.hide();">X</div></div><div id="__mp2_JModalBox_mbi" style="width:600px;height:560px;" ></div></span>';
				frag.insertBefore(obbx,obol.nextSibling);
				//	<div style="z-index: 998; position: absolute; width: 100%; display: none; top: 0px; left: 0px" id="ol"></div>
				//	<div style="z-index: 999; position: absolute; display: none" id="mbox"><span><div id="mbd"><div id="mbm" style="cursor:pointer;">x</div></div><div id="mbi">xx</div></span></div>
				obody.insertBefore(frag,obody.firstChild);
				_scrollFix();	_sizeFix();
				window.onscroll = _scrollFix;
				window.onresize = _sizeFix;
			}
		}
	}
	document.mp2.addWindowEvent('load', document.mp2.JModalBox.initialize, false); 

	document.mp2.JPusher={
		plurk : function ( status )	{
			window.open( 'http://www.plurk.com/?qualifier=shares&status='+encodeURIComponent(status) );
		} ,
		twitter : function ( status )	{
			window.open( 'http://twitter.com/home?status='+encodeURIComponent(status) );
		} ,
		facebook : function ( url, title )	{
			window.open('http://www.facebook.com/sharer.php?'+
					'u='+encodeURIComponent( url ) +
					'&t='+encodeURIComponent( title )
				);
		} ,
		myspace : function ( url, title )	{
			window.open('http://www.myspace.com/Modules/PostTo/Pages/?'+
					'u='+encodeURIComponent( url ) +
					'&t='+encodeURIComponent( title )
				);
		} ,
		funp : function ( url, title )	{
			window.open('http://funp.com/push/submit/add.php?via=tools'+
					'&url='+encodeURIComponent( url ) +
					'&s='+encodeURIComponent( title )
				);
		}
	}
