﻿document.write("<script type=\"text/javascript\" src=\""+site.Dir+"scripts/showpage.js\"><\/script>");
var windowID			= "CCD3-8BA6-8758-59A3";
var WebUI_Url_Hint		=site.Dir+ "style/hint/";
var WebUI_Dialog_Url = site.Dir + "style/dialog/";
/*------------------------------------------------------------------*/
function J(el)
{
	if(typeof el=='string')
		return document.getElementById(el);
	else if(typeof el=='object')
		return el;
}
var e9e9=new Object();
e9e9.Cookie={
	set:function(name,value,expires,path,domain){
		if(typeof expires=="undefined"){
			expires=new Date(new Date().getTime()+24*3600*100);
		}
		document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"; path=/")+((domain)?";domain="+domain:"");
	},
	get:function(name){
		var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
		if(arr!=null){
			return unescape(arr[2]);
		}
		return null;
	},
	clear:function(name,path,domain){
		if(this.get(name)){
			document.cookie=name+"="+((path)?"; path="+path:"; path=/")+((domain)?"; domain="+domain:"")+";expires=Fri, 02-Jan-1970 00:00:00 GMT";
		}
	}
};
//追加/删除事件
e9e9.Event={
	add:function(obj, evType, fn){
		if (obj.addEventListener){obj.addEventListener(evType, fn, false);return true;}
		else if (obj.attachEvent){var r = obj.attachEvent("on"+evType, fn);return r;}
		else {return false;}
	},
	remove:function(obj, evType, fn, useCapture){
		if (obj.removeEventListener){obj.removeEventListener(evType, fn, useCapture);return true;}
		else if (obj.detachEvent){var r = obj.detachEvent("on"+evType, fn);return r;}
		else {alert("Handler could not be removed");}
	}
};
//追加onload事件
e9e9.addOnloadEvent=function(fnc) {
	if ( typeof window.addEventListener != "undefined" )
		window.addEventListener( "load", fnc, false );
	else if ( typeof window.attachEvent != "undefined" )
	{
		window.attachEvent( "onload", fnc );
	}
	else
	{
		if ( window.onload != null )
		{
			var oldOnload = window.onload;
			window.onload = function (e) {
				oldOnload(e);
				window[fnc]();
			};
		} else
			window.onload = fnc;
	}
};
e9e9.isFunction=function(variable) {
	return typeof variable == 'function' ? true : false;
};
e9e9.isUndefined=function(variable) {
	return typeof variable == 'undefined' ? true : false;
};
e9e9.Length=function(variable) {
	var len = 0;
	var val = variable;
	for (var i = 0; i < val.length; i++) 
	{
		if (val.charCodeAt(i) >= 0x4e00 && val.charCodeAt(i) <= 0x9fa5){ 
			len += 2;
		}else {
			len++;
		}
	}
	return len;
};
e9e9.Eval=function(data) {
	try {
		eval(data);
	}
	catch(e) {
		alert(data);	
	}
};
/////////////////////////////
//弹出提示框
/////////////////////////////
e9e9.Alert=function(errstr, success, returnFunc){
	var oDialog = new ClassDialog('2', '', 360, 180, success, true);
	oDialog.init();
	oDialog.event(errstr,'');
	if (returnFunc == null)
		oDialog.button('dialogSubmit', '');
	else
		oDialog.button('dialogSubmit', returnFunc);
};
/////////////////////////////
//弹出确认框
//例如:
//1、e9e9.Confirm("是否操作", act, null) //函数不加()
//2、e9e9.Confirm("是否操作", "alert('yes')", "alert('no')")
/////////////////////////////
e9e9.Confirm=function(errstr, returnSubmitFunc, returnCancelFunc)
{
	var oDialog = new ClassDialog('2', '', 360, 180, "warning", true);
	oDialog.init();
	oDialog.event(errstr,'');
	oDialog.button('dialogSubmit', returnSubmitFunc);
	if (returnCancelFunc == null)
		oDialog.button('dialogCancel', '');
	else
		oDialog.button('dialogCancel', returnCancelFunc);
};
/////////////////////////////
//弹出模拟窗口
/////////////////////////////
e9e9.Popup={
	show:function(url, width, height, showCloseBox, showTitle, returnFunc)
	{
		new ClassDialog().reset();
		if(showTitle==null) showTitle="&nbsp;";
		var oDialog = new ClassDialog('2', showTitle, width, height, null, showCloseBox);
		if (url.indexOf("?") == -1)
			oDialog.open(url+"?windowCode="+windowID+"_"+(new Date().getTime()), returnFunc);
		else
			oDialog.open(url+"&windowCode="+windowID+"_"+(new Date().getTime()), returnFunc);
	},
	hide:function(callReturnFunc){
		new ClassDialog().reset(callReturnFunc);
	}
};
/////////////////////////////
//弹出加载层
/////////////////////////////
e9e9.Loading={
	show:function(msgstr, width, height, showCloseBox)
	{
		var oDialog = new ClassDialog('0', 'loading', width, height, null, showCloseBox);
		oDialog.init(false);
		oDialog.html("<div style='text-align:center;margin-top:10px;'>"+msgstr+"<br /><br /><img src='" + WebUI_Dialog_Url + "loading.gif' align='absmiddle'></div>");
	},
	hide:function(callReturnFunc){
		new ClassDialog().reset(callReturnFunc);
	}
};
////////////////////////////////////////////////////////////////////////////////////////////
//提示层
////////////////////////////////////////////////////////////////////////////////////////////
e9e9.Hint={
	show:function(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset)
	{
		var oHint = new ClassHint(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset);
		oHint.show();
	},
	hide:function(){
		new ClassHint().hide();
	}
}
e9e9.Event.add(window,"load",operatorPlus);
e9e9.Event.add(window,"scroll",operatorPlus);
e9e9.Event.add(window,"resize",operatorPlus);
////////////////////////////////////////////////////////////////////////////////////////////

var gHideSelects              = false;
var gDialogIsShown            = false;
var gWindowMask               = null;
////////////////////////////////////////////////////////////////////////////////////////////
//以下为弹出窗口的类
////////////////////////////////////////////////////////////////////////////////////////////
function ClassDialog(styletype, title, width, height, iswhat, showCloseBox){
	//半透明边框宽度
	var shadowBorderBoth=0;
	var oWidth = width;
	var oHeight = height;
	if(oWidth<0 || oWidth>getViewportWidth()-15)
	{
		oWidth=getViewportWidth()-15;
		shadowBorderBoth = 0;
	}
	if(oHeight<0 || oHeight>getViewportHeight()-35)
	{
		oHeight=getViewportHeight()-35;
		shadowBorderBoth = 0;
	}
	var sTitle = "友情提示";
	if (iswhat == "0")
		sTitle = "错误提示";
	else if (iswhat == "1")
		sTitle = "成功提示";
	else
		if (title!='') sTitle = title;
	var src = "";
	var path = WebUI_Dialog_Url + styletype + "/";
	var gReturnFunc;
	var gReturnVal = null;
	var sButtonFunc = '<input id="dialogSubmit" class="dialogSubmit' + styletype + '" type="button" onmouseover=BtnOver(this,"' + path + '") onmouseout=BtnOut(this,"' + path + '") value="确 认" onclick="new ClassDialog().reset();" /> <input id="dialogCancel" class="dialogCancel' + styletype + '" type="button" value="取 消" onclick="new ClassDialog().reset();" />';
	var sClose = '';
	if (showCloseBox == null || showCloseBox == true)
		sClose = '<img alt="关闭" style="cursor:pointer;" id="dialogBoxClose" onclick="new ClassDialog().reset();" src="' + path + 'dialogCloseOut.gif" border="0" onmouseover="this.src=\'' + path + 'dialogCloseOver.gif\';" onmouseout="this.src=\'' + path + 'dialogCloseOut.gif\';" align="absmiddle" />';
	var sSuccess = '';
	if (iswhat != null)
		sSuccess = '<td width="80" align="center" valign="middle"><img id="dialogBoxFace" class="dialogBoxFace' + styletype + '" src="' + path + iswhat + '.gif" valign="absmiddle" /></td>';
	else
		sSuccess = '<td width="80" align="center" valign="middle"><img id="dialogBoxFace" class="dialogBoxFace' + styletype + '" src="warning.gif" valign="absmiddle" /></td>';
	var sBody = '\
		<table id="dialogBodyBox" class="dialogBodyBox' + styletype + '" border="0" align="center" cellpadding="0" cellspacing="0" width="100%" height="100%" >\
			<tr height="10"><td colspan="4"></td></tr>\
			<tr>\
				<td width="10"></td>' + sSuccess + '<td id="dialogMsg" class="dialogMsg' + styletype + '"></td>\
				<td width="10"></td>\
			</tr>\
			<tr height="10"><td colspan="4" align="center"></td></tr>\
			<tr><td id="dialogFunc" class="dialogFunc' + styletype + '" colspan="4">' + sButtonFunc + '</td></tr>\
		</table>\
	';
	var sBox = '\
		<div style="display:none;" id="dialogBox" class="dialogBox' + styletype + '">\
			<div id="dialogTitleDiv" class="dialogTitleDiv' + styletype + '" style="width:' + oWidth + 'px;">\
				<span id="dialogBoxTitle" class="dialogBoxTitle' + styletype + '">' + sTitle + '</span>\
				<span id="dialogBoxClose" class="dialogBoxClose' + styletype + '">' + sClose + '</span>\
			</div>\
			<div id="dialogHeight" style="width:' + oWidth + 'px;height:' + oHeight + 'px;">\
				<div id="dialogBody" class="dialogBody' + styletype + '" style="height:' + oHeight + 'px;">' + sBody + '</div>\
			</div>\
		</div>\
		<div id="dialogBoxShadow" style="display:none;"></div>\
	';
	this.init = function(_showTitleBar){
		document.body.oncontextmenu=function(){return false;};
		document.body.onselectstart=function(){return false;};
		document.body.ondragstart=function(){return false;};
		document.body.onsource=function(){return false;};
		J('dialogCase') ? J('dialogCase').parentNode.removeChild(J('dialogCase')) : function(){};
		J('windowMask') ? J('windowMask').parentNode.removeChild(J('windowMask')) : function(){};
		var oDiv = document.createElement('span');
		oDiv.id = "dialogCase";
		oDiv.innerHTML = sBox;
		document.body.appendChild(oDiv);
		var oMask = document.createElement('div');
		oMask.id = 'windowMask';
		document.body.appendChild(oMask);
		gWindowMask = J("windowMask");
		gWindowMask.style.display="block";
		var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
		if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
			gHideSelects = true;
		}
		if (gHideSelects == true) {
			HideSelectBoxes();
		}
		if (_showTitleBar == true || _showTitleBar == null)
			J("dialogTitleDiv").style.display = "block";
		else
			J("dialogTitleDiv").style.display = "none";
		operatorPlus();
	}
	//this.show = function(){J('dialogBox') ? function(){} : this.init();gDialogIsShown=true;this.middle('dialogBox');}
	this.show = function(){J('dialogBox') ? function(){} : this.init();gDialogIsShown=true;this.middle('dialogBox');this.shadow();this.middle('dialogBoxShadow');operatorPlus();}
	this.html = function(_sHtml){
		this.show();
		J('dialogBody').innerHTML = _sHtml;
	}
	this.button = function(_sId, _sFuc){
		if(J(_sId)){
			J(_sId).style.display = '';
			if(J(_sId).addEventListener){
				if(J(_sId).act){J(_sId).removeEventListener('click', function(){eval(J(_sId).act);}, false);}
				J(_sId).act = _sFuc;
				J(_sId).addEventListener('click', function(){eval(_sFuc);this.reset();}, false);
			}else{
				if(J(_sId).act){J(_sId).detachEvent('onclick', function(){eval(J(_sId).act);});}
				J(_sId).act = _sFuc;
				J(_sId).attachEvent('onclick', function(){eval(_sFuc);});
			}
		}
	}
	this.shadow = function(){
		if(shadowBorderBoth>0){
			var oShadow = J('dialogBoxShadow');
			var oDialogDiv = J('dialogBox');
			oShadow.style.position = "absolute";
			oShadow.style.background = "#000";
			oShadow.style.display = "";
			oShadow.style.opacity = "0.25";
			oShadow.style.filter = "alpha(opacity=25)";
			oShadow.style.width = (oDialogDiv.offsetWidth + shadowBorderBoth)+"px";
			oShadow.style.height = (oDialogDiv.offsetHeight + shadowBorderBoth)+"px";
		}
	}
	this.open = function(_sUrl, _returnFunc, _sMode){
		this.show();
		gReturnFunc = _returnFunc;
		//if(!_sMode || _sMode == "no" || _sMode == "yes"){
			J("dialogBody").innerHTML = "<iframe id='dialogFrame' width='" + oWidth + "' height='" + oHeight + "' frameborder='0' scrolling='" + _sMode + "'></iframe>";
			J("dialogFrame").src = _sUrl;
		//}
	}
	this.reset = function(callReturnFunc){J('dialogCase') ? this.dispose(callReturnFunc) : function(){};}
	this.dispose = function(callReturnFunc){
		gDialogIsShown = false;
		document.body.oncontextmenu=function(){return true;};
		document.body.onselectstart=function(){return true;};
		document.body.ondragstart=function(){return true;};
		document.body.onsource=function(){return true;};
		J('dialogCase').parentNode.removeChild(J('dialogCase'));
		J('windowMask').parentNode.removeChild(J('windowMask'));
		gWindowMask=null;
		if (callReturnFunc == true && gReturnFunc != null) {
			gReturnVal = window.dialogFrame.returnVal;
			window.setTimeout('gReturnFunc(gReturnVal);', 1);
		}
		if (gHideSelects == true) {
			ShowSelectBoxes();
			gHideSelects = false;
		}
		//J('dialogBoxShadow').style.display = "none";
	}
	this.event = function(_sMsg, _sSubmit, _sCancel, _sClose){
		this.show();
		J('dialogFunc').innerHTML = sButtonFunc;
		J('dialogBoxClose').innerHTML = sClose;
		J('dialogBodyBox') == null ? J('dialogBody').innerHTML = sBody : function(){};
		J('dialogMsg') ? J('dialogMsg').innerHTML = _sMsg  : function(){};
		_sSubmit ? this.button('dialogSubmit', _sSubmit) | J('dialogSubmit').focus() : J('dialogSubmit').style.display = "none";
		_sCancel ? this.button('dialogCancel', _sCancel) : J('dialogCancel').style.display = "none";
		_sClose ? this.button('dialogBoxClose', _sClose) : function(){};
	}
	this.set = function(_oAttr, _sVal){
		var oDialogDiv = J('dialogBox');
		var oHeight = J('dialogHeight');
		if(_sVal != ''){
			switch(_oAttr){
				case 'title':
					J('dialogBoxTitle').innerHTML = _sVal;
					title = _sVal;
					break;
				case 'width':
					oDialogDiv.style.width = _sVal;
					width = _sVal;
					this.middle('dialogBox');
					this.shadow();
					this.middle('dialogBoxShadow');
					operatorPlus();
					break;
				case 'height':
					oHeight.style.height = _sVal;
					height = _sVal;
					this.middle('dialogBox');
					this.shadow();
					this.middle('dialogBoxShadow');
					operatorPlus();
					break;
				case 'src':
					if(parseInt(_sVal) > 0){
						J('dialogBoxFace') ? J('dialogBoxFace').src = path + _sVal + '.png' : function(){};
					}else{
						J('dialogBoxFace') ? J('dialogBoxFace').src = _sVal : function(){};
					}
					src = _sVal;
					break;
				case 'url':
					this.open(_sVal);
					break;
			}
		}
	}
	this.middle = function(_sId){	
		var theWidth;
		var theHeight;
		if (document.documentElement && document.documentElement.clientWidth) { 
			theWidth = document.documentElement.clientWidth+document.documentElement.scrollLeft*2;
			theHeight = document.documentElement.clientHeight+document.documentElement.scrollTop*2; 
		} else if (document.body) { 
			theWidth = document.body.clientWidth;
			theHeight = document.body.clientHeight; 
		}else if(window.innerWidth){
			theWidth = window.innerWidth;
			theHeight = window.innerHeight;
		}
		J(_sId).style.display = '';
		J(_sId).style.position = "absolute";
		J(_sId).style.left = (theWidth / 2) - (J(_sId).offsetWidth / 2)+"px";
		if(document.all||J("user_page_top")){
			J(_sId).style.top = (theHeight / 2 + document.body.scrollTop) - (J(_sId).offsetHeight / 2)+"px";
		}else{
			var sClientHeight = parent ? parent.document.body.clientHeight : document.body.clientHeight;
			var sScrollTop = parent ? parent.document.body.scrollTop : document.body.scrollTop;
			var sTop = -80 + (sClientHeight / 2 + sScrollTop) - (J(_sId).offsetHeight / 2);
			J(_sId).style.top = (theHeight / 2 + document.body.scrollTop) - (J(_sId).offsetHeight / 2)+"px";
		}
	}
	BtnOver=function(obj,path){obj.style.backgroundImage = "url("+path+"button2.gif)";}
	BtnOut=function(obj,path){obj.style.backgroundImage = "url("+path+"button1.gif)";}
	ShowSelectBoxes=function(){var x = document.getElementsByTagName("SELECT");for (i=0;x && i < x.length; i++){x[i].style.visibility = "visible";}}
	HideSelectBoxes=function(){var x = document.getElementsByTagName("SELECT");for (i=0;x && i < x.length; i++) {x[i].style.visibility = "hidden";}}

}
function exec(_sFuc){
	if(_sFuc){
		if(typeof(_sFuc)=="function"){
			_sFuc();
		}else{
			eval(_sFuc);
		}
	}
}
function addOnloadEvent(fnc)
{
	if ( typeof window.addEventListener != "undefined" )
		window.addEventListener( "load", fnc, false );
	else if ( typeof window.attachEvent != "undefined" )
	{
		window.attachEvent( "onload", fnc );
	}
	else
	{
		if ( window.onload != null )
		{
			var oldOnload = window.onload;
			window.onload = function (e) {
				oldOnload(e);
				window[fnc]();
			};
		} else
			window.onload = fnc;
	}
}
///////////////////////////////////////////////////////////////////////////
function operatorPlus() {
	if (gDialogIsShown == true) {
		var oDialogDiv = J("dialogBox");
		var oShadow = J("dialogBoxShadow");
		var oWidth = oDialogDiv.offsetWidth;
		var oHeight = oDialogDiv.offsetHeight;
		var theBody = document.getElementsByTagName("BODY")[0];
		var scTop = parseInt(getScrollTop(),10);
		var scLeft = parseInt(theBody.scrollLeft,10);
		var fullHeight = getViewportHeight();
		var fullWidth = getViewportWidth();
		oDialogDiv.style.top = (scTop + ((fullHeight - oHeight) / 2)) + "px";
		oDialogDiv.style.left = (scLeft + ((fullWidth - oWidth) / 2)) + "px";
		oShadow.style.top = (scTop + ((fullHeight - oShadow.offsetHeight) / 2)) + "px";
		oShadow.style.left = (scLeft + ((fullWidth - oShadow.offsetWidth) / 2)) + "px";
		if (gWindowMask != null) {
			var popHeight = theBody.scrollHeight;
			var popWidth = theBody.scrollWidth;
			if (fullHeight > theBody.scrollHeight) popHeight = fullHeight;
			if (fullWidth > theBody.scrollWidth) popWidth = fullWidth;
			gWindowMask.style.height = popHeight + "px";
			gWindowMask.style.width = popWidth + "px";
		}
	}
}
function getViewportHeight() {
	if (window.innerHeight!=window.undefined)//FF
	{
		return window.innerHeight;
	}
	if (document.compatMode=='CSS1Compat')//IE
	{
		return document.documentElement.clientHeight;
	}
	if (document.body)//other
	{
		return document.body.clientHeight; 
	}
	return window.undefined; 
}
function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined)//FF
	{
		return window.innerWidth-offset; 
	}
	if (document.compatMode=='CSS1Compat')//IE
	{
		return document.documentElement.clientWidth; 
	}
	if (document.body)//other
	{
		return document.body.clientWidth; 
	}
	return window.undefined; 
}
function getScrollTop() {
	if (self.pageYOffset){return self.pageYOffset;}
	else if (document.documentElement && document.documentElement.scrollTop){return document.documentElement.scrollTop;}
	else if (document.body){return document.body.scrollTop;}
}
function getScrollLeft() {
	if (self.pageXOffset){return self.pageXOffset;}
	else if (document.documentElement && document.documentElement.scrollLeft){return document.documentElement.scrollLeft;}
	else if (document.body){return document.body.scrollLeft;}
}
function setDialogTitle(){
	if(window.document.title!=""){
		try {
			J('dialogBoxTitle').innerHTML = window.document.title;
		}
		catch(e) {
			try {
				parent.J('dialogBoxTitle').innerHTML = window.document.title;
			}
			catch(e) {
			}	
		}
	}
}
function setDialogSize(w,h){
	try {
		if(w>0) J('dialogBox').style.width = w;
		if(h>0) J('dialogHeight').style.height = h;
		operatorPlus();
	}
	catch(e) {
		try {
			if(w>0) parent.J('dialogBox').style.width = w;
			if(h>0) parent.J('dialogHeight').style.height = h;
			parent.operatorPlus();
		}
		catch(e) {
		}	
	}	
}
//提示层类
ClassHint = function(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset)
{
	var path = WebUI_Url_Hint;
	var imageLeft = path+'commandbg1.gif';
	var imageRight = path+'commandbg2.gif';
	if((showtype==null)||(showtype =="")) 
		showtype = "up";
	if(showtype=="down"){
		imageLeft = path+'commandbg3.gif';
		imageRight = path+'commandbg4.gif';
	}
	this.show = function() {
		this.init();
		var p = getposition(obj);
		J('hintIframe').style.height= objheight + "px";
		J('hintInfo').innerHTML = info;
		J('hintSpan').style.display='block';
		if(objtopfirefoxoffset != null && objtopfirefoxoffset !=0 && !isie())
			J('hintSpan').style.top=p['y']+parseInt(objtopfirefoxoffset)+"px";
		else
		{
			if(objtopoffset == 0)
			{ 
				if(showtype=="up")
				{
				 	J('hintSpan').style.top=(p['y'] - J('hintInfo').offsetHeight - 32)+"px";
				}
				else
				{
				 	J('hintSpan').style.top=(p['y'] + obj.offsetHeight + 1)+"px";
				}
			}
			else
				J('hintSpan').style.top=(p['y']+objtopoffset)+"px";
		}
		J('hintSpan').style.left=(p['x']+objleftoffset)+"px";
	}
	//隐藏提示层
	this.hide = function() {
		J('hintSpan').style.display='none';
	}
	function getposition(obj)
	{
		var r = new Array();
		r['x'] = obj.offsetLeft;
		r['y'] = obj.offsetTop;
		while(obj = obj.offsetParent)
		{
			r['x'] += obj.offsetLeft;
			r['y'] += obj.offsetTop;
		}
		return r;
	}
	this.init = function(){
		J('hintSpan') ? J('hintSpan').parentNode.removeChild(J('hintSpan')) : function(){};
		var hintObj=document.createElement("span");
		hintObj.setAttribute("id","hintSpan");
		hintObj.style.position="absolute";
		hintObj.style.display="none";
		var sBody = '<div id="hintDiv">\
				<p><img src="'+imageLeft+'" /></p>\
				<div class="hintmessagetext"><img id="hintdot" src="'+path+'dot.gif" /><span id="hintInfo" ></span></div>\
				<p><img src="'+imageRight+'" /></p>\
			</div>\
			<iframe id="hintIframe" frameborder="0" scrolling="no"></iframe>\
		';
		hintObj.innerHTML=sBody;
		document.body.appendChild(hintObj);
	}
}
////////////////////////////////////////////////////////////////////////////////////////////