var interstitialBox={
	//1) HTML for the header bar portion of the interstitial box
	defineheader: '<div class="headerbar"><a href="#" onClick="javascript:interstitialBox.closeit(); return false"><img id="closeit" src="" style="border: 0" title="Close Box"/></a></div>',
	
	//2) Disable browser scrollbars while interstitial is shown (Only applicable in IE7/Firefox/Opera8+. IE6 will just auto scroll page to top)?
	disablescrollbars: true,
	
	//3) Auto hide Interstitial Box after x seconds (0 for no)?
	autohidetimer: 0,

	////No need to edit beyond here//////////////////////////////////	
	launch:false,
	scrollbarwidth: 16,
	
	createcontainer:function(){
		//write out entire HTML for Interstitial Box:
		var BodyObj=document.createElement("div");
		BodyObj.setAttribute('id','BodyBox');
		BodyObj.style.zIndex = "999";
		BodyObj.style.position="absolute";
		BodyObj.style.top="0";
		//BodyObj.style.opacity="0.6";
		BodyObj.style.left="0";
		document.body.appendChild(BodyObj);
		
		document.getElementById("BodyBox").innerHTML = '<div id="interContainer">'+this.defineheader+'<div id="interContent"></div></div><div id="interVeil"></div>'
		this.interContainer=document.getElementById("interContainer") //reference interstitial container
		this.interVeil=document.getElementById("interVeil") //reference veil
		this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	},

	showcontainer:function(){
		var allselect = document.getElementsByTagName("select");
		for (var i=0; i<allselect.length; i++)
		{
			allselect[i].style.visibility = "hidden";
		}
		if (this.interContainer.style.display=="none") return //if interstitial box has already closed, just exit (window.onresize event triggers function)
		var ie=document.all && !window.opera
		var dom=document.getElementById
		var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
		var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
		var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.scrollbarwidth
		var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
		var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight
		var objwidth=this.interContainer.offsetWidth
		var objheight=this.interContainer.offsetHeight
		this.interVeil.style.width=docwidth+"px" //set up veil over page
		this.interVeil.style.height=docheightcomplete+"px" //set up veil over page
		this.interVeil.style.left=0 //Position veil over page
		this.interVeil.style.top=0 //Position veil over page
		this.interVeil.style.visibility="visible" //Show veil over page
		this.interContainer.style.left=docwidth/2-objwidth/2+"px" //Position interstitial box
		var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+5+"px" //Position interstitial box
		this.interContainer.style.top=Math.floor(parseInt(topposition))+"px"
		this.interContainer.style.visibility="visible" //Show interstitial box
		if (this.autohidetimer && parseInt(this.autohidetimer)>0 && typeof this.timervar=="undefined")
			this.timervar=setTimeout("interstitialBox.closeit()", this.autohidetimer*1000)
	},


	closeit:function(){
		var allselect = document.getElementsByTagName("select");
		for (var i=0; i<allselect.length; i++)
		{
			allselect[i].style.visibility = "visible";
		}
		this.interVeil.style.display="none"
		this.interContainer.style.display="none"
		this.standardbody.style.overflow="auto"
		if (typeof this.timervar!="undefined") clearTimeout(this.timervar)
	},

	dotask:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
		var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
		if (target.addEventListener) {
			this.standardbody.style.overflow="hidden";
			target.addEventListener(tasktype, functionref, false)
		}
		else if (target.attachEvent)
		{
			//target.attachEvent(tasktype, functionref);
			this.standardbody.style.overflow="hidden";
			setTimeout("interstitialBox.showcontainer()", 100);
		}
	},

	initialize:function(){
		this.createcontainer() //write out interstitial container
		this.dotask(window, function(){setTimeout("interstitialBox.showcontainer()", 100)}, "click")
		this.dotask(window, function(){interstitialBox.showcontainer()}, "resize")
	}
}
/////////////End of interstitialBox object declaration here ////////////////////////////////

function createMsgInfoBox(title,content,arrayObj,icon,closeTime) {
	var width 	= 350;
	var height 	= 150;
	var sFunc 	= "";
	var FaceClass = "";
	var sClose	= "";
	var dialogBoxFace = "images/spacer.gif";
	
	if (!title) title = "信息";
	if (!content) content = "成功";
	//if (!icon) icon = "succ";
	switch (icon)
	{
		case "succ":
			FaceClass = "succeed";
			break;
		case "err":
			FaceClass = "error";
			break;
		default:
			FaceClass = "";
	}
	if(typeof(arrayObj)=='object')
	{
		for(var i=0; i<arrayObj.length; i++)
		{
			if(i==0) autoRunCmd = arrayObj[i].btnCmd+";";
			sFunc+= '<input type="button" class="button" value=" '+arrayObj[i].btnText+' " onclick="'+arrayObj[i].btnCmd+'" />&nbsp;&nbsp;';
		}
	}
	else
	{
		sFunc+= '<input id="dialogOk" class="button" type="button" value="确  认" onclick="javascript:interstitialBox.closeit(); return false" />';
	}
	
	if(closeTime)
		sClose = '<span id=alertInfoBoxTimeCnt style="font-size:12px;color:#fff;font-weight:bold">'+closeTime+'</span>';
	else
		sClose = '<input type="image" id="dialogBoxClose" onClick="javascript:interstitialBox.closeit(); return false" src="images/dialogClose0.gif" border="0" width="17" height="17" onmouseover="this.src=\'images/dialogCloseF.gif\';" onmouseout="this.src=\'images/dialogClose0.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="80" align="center" valign="absmiddle"><img id="dialogBoxFace" class="'+ FaceClass +'" src="'+ dialogBoxFace +'" /></td>\
				<td width="10"></td>\
				<td id="dialogMsg" style="font-size:12px;color:#000;">'+content+'</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">\
			<tr height="25">\
				<td id="dialogBoxBar">\
					<table width="100%" border="0" cellpadding="0" cellspacing="0">\
						<tr>\
							<td width="6"></td>\
							<td id="dialogBoxTitle" align="left">'+ title +'</td>\
							<td id="dialogClose" width="27" align="right" valign="middle">\
								' + sClose + '\
							</td>\
							<td width="6"></td>\
						</tr>\
					</table>\
				</td>\
			</tr>\
			<tr id="dialogHeight" style="height:' + height + '">\
				<td id="dialogBody">'+ sBody +'</td>\
			</tr>\
		</table>';
		
	if(closeTime) interstitialBox.autohidetimer=5;
	if (closeTime && parseInt(closeTime)>0) {
		setBoxTimeValue();
		inputBntTm = setInterval("setBoxTimeValue();", 1000);
	}
	interstitialBox.defineheader=sBox;
	interstitialBox.initialize();
	//拖动
	try{
		new Draggable('dialogBox',{ starteffect:null,endeffect:null,handle:'dialogBoxTitle'});
	}
	catch(e){};
}

function setBoxTimeValue()
{
	try
	{
		var obj = document.getElementById('alertInfoBoxTimeCnt');
		if(obj.innerHTML>1)
			obj.innerHTML = obj.innerHTML-1;
		else
			clearInterval(inputBntTm);
	}
	catch(e){}
}
