function dialog(){
	var titile = '';
	var width = 300;
	var height = 180;
	var src = "";
	var path = contextpath+"/images/";
	var sFunc = '<input id="dialogOk" type="button" style="width:62px;height:22px;border:0;line-height:20px;" value="" onclick="new dialog().reset();" /> <input id="dialogCancel" type="button" style="width:62px;height:22px;border:0;line-height:20px;" value="" onclick="new dialog().reset();" />';
	var sClose = '<input type="image" id="dialogBoxClose" onclick="new dialog().reset();" src="' + path + 'close_popup.gif" border="0" width="17" height="17" onmouseover="this.src=\'' + path + 'close_popup.gif\';" onmouseout="this.src=\'' + path + 'close_popup.gif\';" align="absmiddle" />';
	var sBody = '\
		<table id="dialogBodyBox" border="0" align="center" cellpadding="0" cellspacing="0">\
			<tr height="10"><td colspan="4"></td></tr>\
			<tr>\
				<td width="10"></td>\
				<td width="80" align="center" valign="absmiddle"><img id="dialogBoxFace" src="' + path + '3.gif" /></td>\
				<td id="dialogMsg" style="font-size:12px;color:#000;"></td>\
				<td width="10"></td>\
			</tr>\
			<tr height="10"><td colspan="4" align="center"></td></tr>\
			<tr><td id="dialogFunc" colspan="4" align="center">' + sFunc + '</td></tr>\
			<tr height="10"><td colspan="4" align="center"></td></tr>\
		</table>\
	';
	var sBox = '\
		<table id="dialogBox" width="' + width + '" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #E2E8F4;display:none;z-index:999;background-color:#ffffff;">\
			<tr height="1" bgcolor="#FFFFFF"><td></td></tr>\
			<tr height="20" bgcolor="#1d78ba">\
				<td>\
					<table onselectstart="return false;" style="-moz-user-select:none;" width="100%" border="0" cellpadding="0" cellspacing="0">\
						<tr>\
							<td width="6"></td>\
							<td id="dialogBoxTitle" style="color:White;font-size:90%;font-weight:bold;font-family:Arial;">\
							</td>\
							<td id="dialogClose" width="27" align="right" valign="middle">\
								' + sClose + '\
							</td>\
							<td width="6"></td>\
						</tr>\
					</table>\
				</td>\
			</tr>\
			<tr height="2" bgcolor="#EDEDED"><td></td></tr>\
			<tr id="dialogHeight" style="height:' + height + '">\
				<td id="dialogBody" style="background:#fff;color:#000;">' + sBody + '</td>\
			</tr>\
		</table>\
		<div id="dialogBoxShadow" style="display:none;z-index:998;"></div>\
	';
	var strMask = '<table id="maskbody" width="' + document.body.offsetWidth + 'px;" height="' + document.body.clientHeight + 'px;" border="2" cellpadding="2" cellspacing="2" style="border:0px none;display:none;z-index:998;"><tr><td></td></tr></table>';
	function $(_sId){return document.getElementById(_sId)}
	this.show = function()
	{
		$('dialogBodyBox') ? function(){} : this.init();
    	document.getElementById('maskDiv_id').style.display='';
    	document.getElementById('maskDiv_id').style.width='';
    	document.getElementById('maskDiv_id').style.height='';
		this.middle('maskbody');
		this.middle('dialogBox');
		this.shadow();
    	enableMask();
    }
	this.reset = function()
	{
    	disableMask();
		//this.hideModule('select', '');
		$('dialogBox').style.display='none';
		$('dialogBoxShadow').style.display = "none";
		//$('dialogBody').innerHTML = sBody;
	}
	this.html = function(_sHtml){$("dialogBody").innerHTML = _sHtml;this.show();}
	this.init = function(){
		$('dialogCase') ? $('dialogCase').parentNode.removeChild($('dialogCase')) : function(){};

        var oDivMask = document.createElement('div');
        oDivMask.id = "maskDiv_id";
        oDivMask.innerHTML = strMask;
        document.body.appendChild(oDivMask);
        
		var oDiv = document.createElement('span');
		oDiv.id = "dialogCase";
		oDiv.innerHTML = sBox;
		document.body.appendChild(oDiv);
	}
	this.button = function(_sId, _sFuc){
		alert("button");
		if($(_sId)){
			$(_sId).style.display = '';
			if($(_sId).addEventListener){
				if($(_sId).act){$(_sId).removeEventListener('click', function(){eval($(_sId).act)}, false);}
				$(_sId).act = _sFuc;
				$(_sId).addEventListener('click', function(){eval(_sFuc)}, false);
			}else{
				if($(_sId).act){$(_sId).detachEvent('onclick', function(){eval($(_sId).act)});}
				$(_sId).act = _sFuc;
				$(_sId).attachEvent('onclick', function(){eval(_sFuc)});
			}
		}
	}
	this.shadow = function(){
		var oShadow = $('dialogBoxShadow');
		var oDialog = $('dialogBox');
		oShadow['style']['position'] = "absolute";
		oShadow['style']['background']	= "#000";
		oShadow['style']['display']	= "";
		oShadow['style']['opacity']	= "0.2";
		oShadow['style']['filter'] = "alpha(opacity=20)";
		
		oShadow['style']['top'] = oDialog.offsetTop + 6;
		oShadow['style']['left'] = oDialog.offsetLeft + 6;
		oShadow['style']['width'] = oDialog.offsetWidth;
		oShadow['style']['height'] = oDialog.offsetHeight;
	}
	this.open = function(_sUrl, _sMode){
		//debugger;
		this.show();
		
		if(!_sMode || _sMode == "no" || _sMode == "yes"){
			$("dialogBody").innerHTML = "<iframe id='dialogFrame' name='iframea' width='100%' height='100%' src='aa.gif' frameborder='0' style='overflow:auto;'></iframe>";
			$("dialogFrame").src = _sUrl;
		}
		
	}
	this.showWindow = function(_sUrl, _iWidth, _iHeight, _sMode){
		alert("showWindow");
		var oWindow;
		var sLeft = (screen.width) ? (screen.width - _iWidth)/2 : 0;
		var sTop = (screen.height) ? (screen.height - _iHeight)/2 : 0;
		if(window.showModalDialog && _sMode == "m"){
			oWindow = window.showModalDialog(_sUrl,"","dialogWidth:" + _iWidth + "px;dialogheight:" + _iHeight + "px");
		} else {
			oWindow = window.open(_sUrl, '', 'height=' + _iHeight + ', width=' + _iWidth + ', top=' + sTop + ', left=' + sLeft + ', toolbar=no, menubar=no, scrollbars=' + _sMode + ', resizable=no,location=no, status=no');
		}
	}
	this.event = function(_sMsg, _sOk, _sCancel, _sClose){
		alert("event");
		$('dialogFunc').innerHTML = sFunc;
		$('dialogClose').innerHTML = sClose;
		$('dialogBodyBox') == null ? $('dialogBody').innerHTML = sBody : function(){};
		$('dialogMsg') ? $('dialogMsg').innerHTML = _sMsg  : function(){};
		this.show();
		_sOk ? this.button('dialogOk', _sOk) | $('dialogOk').focus() : $('dialogOk').style.display = 'none';
		_sCancel ? this.button('dialogCancel', _sCancel) : $('dialogCancel').style.display = 'none';
		_sClose ? this.button('dialogBoxClose', _sClose) : function(){};
		//_sOk ? this.button('dialogOk', _sOk) : _sOk == "" ? function(){} : $('dialogOk').style.display = 'none';
		//_sCancel ? this.button('dialogCancel', _sCancel) : _sCancel == "" ? function(){} : $('dialogCancel').style.display = 'none';
	}
	this.set = function(_oAttr, _sVal){
		var oShadow = $('dialogBoxShadow');
		var oDialog = $('dialogBox');
		var oHeight = $('dialogHeight');

		if(_sVal != ''){
			switch(_oAttr){
				case 'title':
					$('dialogBoxTitle').innerHTML = _sVal;
					title = _sVal;
					break;
				case 'width':
					oDialog['style']['width'] = _sVal;
					width = _sVal;
					break;
				case 'height':
					oHeight['style']['height'] = _sVal;
					height = _sVal;
					break;
				case 'src':
					if(parseInt(_sVal) > 0){
						$('dialogBoxFace') ? $('dialogBoxFace').src = path + _sVal + '.gif' : function(){};
					}else{
						$('dialogBoxFace') ? $('dialogBoxFace').src = _sVal : function(){};
					}
					src = _sVal;
					break;
			}
		}
		this.middle('dialogBox');
		
		oShadow['style']['top'] = oDialog.offsetTop + 6;
		oShadow['style']['left'] = oDialog.offsetLeft + 6;
		oShadow['style']['width'] = oDialog.offsetWidth;
		oShadow['style']['height'] = oDialog.offsetHeight;
	}
	this.moveStart = function (event, _sId){
	
	if(navigator.appName != "Microsoft Internet Explorer")
		{
			startm(event, _sId);
		}
		else
		{
			var oObj = $(_sId);
			oObj.onmousemove = mousemove;
			oObj.onmouseup = mouseup;
			oObj.setCapture ? oObj.setCapture() : function(){};
			oEvent = window.event ? window.event : event;
			var dragData = {x : oEvent.clientX, y : oEvent.clientY};
			var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
			function mousemove(){
				var oEvent = window.event ? window.event : event;
				var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
				var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
				oObj.style.left = iLeft;
				oObj.style.top = iTop;
				$('dialogBoxShadow').style.left = iLeft + 6;
				$('dialogBoxShadow').style.top = iTop + 6;
				dragData = {x: oEvent.clientX, y: oEvent.clientY};
			}
		}
		function mouseup(){
			var oEvent = window.event ? window.event : event;
			oObj.onmousemove = null;
			oObj.onmouseup = null;
			if(oEvent.clientX < 1 || oEvent.clientY < 1 || oEvent.clientX > document.body.clientWidth || oEvent.clientY > document.body.clientHeight){
				oObj.style.left = backData.y;
				oObj.style.top = backData.x;
				$('dialogBoxShadow').style.left = backData.y + 6;
				$('dialogBoxShadow').style.top = backData.x + 6;
			}
			oObj.releaseCapture ? oObj.releaseCapture() : function(){};
		}
	}
	this.hideModule = function(_sType, _sDisplay){
		var aIframe = parent.document.getElementsByTagName("iframe");aIframe=0;
		var aType = document.getElementsByTagName(_sType);
		var iChildObj, iChildLen;
		for (var i = 0; i < aType.length; i++){
			aType[i].style.display	= _sDisplay;
		}
		for (var j = 0; j < aIframe.length; j++){
			iChildObj = document.frames ? document.frames[j] : aIframe[j].contentWindow;
			iChildLen = iChildObj.document.body.getElementsByTagName(_sType).length;
			for (var k = 0; k < iChildLen; k++){
				iChildObj.document.body.getElementsByTagName(_sType)[k].style.display = _sDisplay;
			}
		}
	}
	this.middle = function(_sId){
		document.getElementById(_sId)['style']['display'] = '';
		document.getElementById(_sId)['style']['position'] = "absolute";
		document.getElementById(_sId)['style']['left'] = (document.body.clientWidth / 2) - (document.getElementById(_sId).offsetWidth / 2);
		//due attribute of top lower than zero
		var top = (document.body.clientHeight / 2 + document.body.scrollTop) - (document.getElementById(_sId).offsetHeight / 2);
		if(parseInt(top) < 0)
		{
			document.getElementById(_sId)['style']['top'] = 0;			
		}else{
			document.getElementById(_sId)['style']['top'] = top;
		}
		
		//new Draggable(_sId, {revert:true});//????????????
	}
	this.get=function(_id)
	{
		var s = "dialogFrame";
		var win=document.frames?document.frames[s]:$(s).contentWindow;
		return win.document.getElementById(_id);
	}
}
var currObjs = null; 
	var relLeft; 
	var relTop;
	var ev = null;
function startm(event, _sId)
{
		try{
		if(navigator.appName != "Microsoft Internet Explorer")
		{
			 var frm = document.getElementById("dialogFrame"); 
			frm.contentDocument.body.onmousemove =mousemove1;
			frm.contentDocument.body.onmouseup =mouseup1;
		}
		ev = event;
		currObjs = $(_sId);
		var left1 = '';
		left1 = currObjs.style.left.toString();
		var top1  =''; 
		top1 = currObjs.style.top.toString();
		relLeft = ev.clientX - left1.substring(0,left1.indexOf('p'));
		relTop  = ev.clientY - top1.substring(0,top1.indexOf('p'));
		//currObjs['style']['display']='';
		}catch(e){}
}
function  mousemove1(){
			if(currObjs != null)
			{
				currObjs['style']['position'] = "absolute";
				currObjs['style']['background']	= "#000";
				currObjs['style']['display']	= "";
				//currObjs['style']['opacity']	= "0.2";
				currObjs['style']['filter'] = "alpha(opacity=20)";
				currObjs.style.left = ev.clientX - relLeft;
				currObjs.style.top  = ev.clientY - relTop;
				dialogBoxShadow = $('dialogBoxShadow');
				dialogBoxShadow.style.left = ev.clientX - relLeft+6;
				dialogBoxShadow.style.top  = ev.clientY - relTop+6;
			}
		}
	function mouseup1(){
			try{
			currObjs = null;
			}catch(e){}
	}
function closeWindowHandle()
{
	new dialog().reset();
}

function moveWindow(l,t)
{
return false;
}


//set mask (add function start)
var selectIdArray = new Array();
var objElement;
var intervalHandle ;
var intervalHandleMask ;
var browerType=new function(){
	this.isOpera=(window.opera&&navigator.userAgent.match(/opera/gi))?true:false;
	this.isIE=(!this.isOpera&&document.all&&navigator.userAgent.match(/msie/gi))?true:false;
	this.isSafari=(!this.isIE&&navigator.userAgent.match(/safari/gi))?true:false;
	this.isGecko=(!this.isIE&&navigator.userAgent.match(/gecko/gi))?true:false;
	this.isFirefox=(!this.isIE&&navigator.userAgent.match(/firefox/gi))?true:false;
};
function enableMask()
{
	getSelectIdArray();
	disableSelect(selectIdArray);
	intervalHandle = setInterval("moveMaskDiv()",300);
	intervalHandleMask = setInterval("closeMaskHandleInterval()",500);
	
	
}
function disableMask()
{
	document.getElementById('maskDiv_id').style.display='none';
	enableSelect(selectIdArray);
	clearInterval(intervalHandle);
	clearInterval(intervalHandleMask);
}
function closeMaskHandleInterval()
{
	if('none' == $('dialogBox').style.display)
		new dialog().reset();
}
function getSelectIdArray()
{
	if(browerType.isIE)
	{
		var allElement = document.getElementsByTagName('SELECT');
		for( i=0,len=allElement.length; i<len; i++)
		{
			if(allElement[i].style.display!='none')
			{
				selectIdArray.push(allElement[i]);
			}
		}
	}
	if(document.getElementById('seminarvideo'))
	{
		var embed = document.getElementById('seminarvideo');
		selectIdArray.push(embed);
	}
}
function disableSelect(objArray)
{
	for(i=0,len=objArray.length; i<len; i++)
	{
		if(objArray[i].id)
		{
			if("seminarvideo"==objArray[i].id)
				objArray[i].style.display='none';
			else
			{
				if(browerType.isIE)
				{
					objArray[i].style.display='none';
				}
			}
		}
		else
		{
			if(browerType.isIE)
			{
				objArray[i].style.display='none';
			}
		}
	}
}
function enableSelect(objArray)
{
	for(i=0,len=objArray.length; i<len; i++)
	{
		if(objArray[i].id)
		{
			if("seminarvideo"==objArray[i].id)
				objArray[i].style.display='';
			else
			{
				if(browerType.isIE)
				{
					objArray[i].style.display='';
				}
			}
		}
		else
		{
			if(browerType.isIE)
			{
				objArray[i].style.display='';
			}
		}
	}
//	objArray.length=0;
}
function moveMaskDiv()
{
	document.getElementById('maskbody')['style']['left'] =(document.body.clientWidth / 2) - (document.getElementById('maskbody').offsetWidth / 2)-10;
	document.getElementById('maskbody')['style']['top'] = (document.body.clientHeight / 2 + document.body.scrollTop) - (document.getElementById('maskbody').offsetHeight / 2)-10;
}
//set mask (end)

window.onload = function()
{
	try{
	onLoadOpenWindow();//
			if (document.all){
window.attachEvent('onload',onLoadOpenWindow)
}
else{
window.addEventListener('load',onLoadOpenWindow,false);
}
	}catch(e)
	{
	}
	try{
	onLoadOpenWindowForMsg();
	}catch(e)
	{
	}
	try{
		shows();
	}catch(e)
	{
	}
}
		try{
			document.body.onmousemove= function()
			{
				if(typeof(mousemove1)=="function")
				mousemove1();
			}
			document.body.onmouseup= function()
			{
				if(typeof(mouseup1)=="function")
				mouseup1();
			}
		}catch(e){}
