//-----------------------------------------------------------------------------------
var iXuEr = new Object();
//-----------------------------------------------------------------------------------
iXuEr.menuOffX = 0; // 菜单距连接文字最左端距离
iXuEr.menuOffY = 20; // 菜单距连接文字顶端距离
iXuEr.GetCodeSrc = ""; // 请勿更改
//-----------------------------------------------------------------------------------
// 状态栏提示文字：
//window.status = "如果您喜欢本站，请将本站推荐给您的朋友！本站访问地址：http://txt.51dg.com/";
//-----------------------------------------------------------------------------------
// Pop-it menu- (C) Dynamic Drive (www.dynamicdrive.com)
// This notice MUST stay intact for legal use
// Visit http://www.dynamicdrive.com/ for full source code
//-----------------------------------------------------------------------------------
var ie4 = document.all && navigator.userAgent.indexOf("Opera") == -1;
var ie5 = document.all && !window.opera;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var vBobjects = new Array(), source_el, menuobj, delayhide;
document.write("<div id=\"PopMenu\" onmouseover=\"clearhidemenu();\" onmouseout=\"dynamichide(event);\"></div>");
function MM_findObj(n, d) {
	var p, i, x;
	if (!d) {
		d = document;
	}
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all) {
		x = d.all[n];
	}
	for (i = 0; !x && i < d.forms.length; i ++ ) {
		x = d.forms[i][n];
	}
	for (i = 0; !x && d.layers && i < d.layers.length; i ++ ) {
		x = MM_findObj(n, d.layers[i].document);
	}
	if (!x && d.getElementById) {
		x = d.getElementById(n);
	}
	return x;
}
function fetch_object(idname, forcefetch) {
	if (typeof (vBobjects[idname]) == "undefined") {
		vBobjects[idname] = MM_findObj(idname);
	}
	return vBobjects[idname];
}
function ShowMenu(e, vmenu, vmenuobj, mod) {
	clearhidemenu();
	var which = vmenu;
	if (vmenuobj) {
		var MenuObj = fetch_object(vmenuobj);
		if (MenuObj) {
			which = MenuObj.innerHTML;
		}
	}
	if (!which) {
		return;
	}
	which = "<div class=\"MenuSkin\"><div class=\"MenuBody\">" + which + "</div></div>";
	menuobj = document.getElementById("PopMenu");
	menuobj.thestyle = menuobj.style;
	menuobj.innerHTML = which;
	menuobj.contentwidth = menuobj.offsetWidth;
	eventX = e.clientX;
	eventY = e.clientY;
	var rightedge = document.body.clientWidth - eventX, bottomedge = document.body.clientHeight - eventY, getlength;
	if (rightedge < menuobj.contentwidth) {
		getlength = ie4 ? document.body.scrollLeft + eventX - menuobj.contentwidth + iXuEr.menuOffX : ns6 ? window.pageXOffset + eventX - menuobj.contentwidth : eventX - menuobj.contentwidth;
	} else {
		getlength = ie4 ? ie_x(event.srcElement) + iXuEr.menuOffX : ns6 ? window.pageXOffset + eventX : eventX;
	}
	menuobj.thestyle.left = getlength + "px";
	if (bottomedge < menuobj.contentheight && mod != 0) {
		getlength = ie4 ? document.body.scrollTop + eventY - menuobj.contentheight-event.offsetY + iXuEr.menuOffY - 23 : ns6 ? window.pageYOffset + eventY - menuobj.contentheight - 10 : eventY - menuobj.contentheight;
	} else {
		getlength = ie4 ? ie_y(event.srcElement) + iXuEr.menuOffY : ns6 ? window.pageYOffset + eventY + 10 : eventY;
	}
	menuobj.thestyle.top = getlength + "px";
	menuobj.thestyle.visibility = "visible";
}
function ie_y(e) {
	var t = e.offsetTop;
	while (e = e.offsetParent) {
		t  += e.offsetTop;
	}
	return t;
}
function ie_x(e) {
	var l = e.offsetLeft;
	while (e = e.offsetParent) {
		l  += e.offsetLeft;
	}
	return l;
}
function dynamichide(e) {
	if (ie5 && !menuobj.contains(e.toElement)) {
		hidemenu();
	} else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)) {
		hidemenu();
	}
}
function hidemenu() {
	if (window.menuobj) {
		menuobj.thestyle.visibility = "hidden";
	}
}
function contains_ns6(a, b) {
	while (b.parentNode) {
		if ((b = b.parentNode) == a) {
			return true;
		}
	}
	return false;
}
function delayhidemenu() {
	delayhide = setTimeout("hidemenu()", 300);
}
function clearhidemenu() {
	try {
		window.clearTimeout(delayhide);
	} catch (e) {
	}
}
document.onclick = hidemenu;
//-----------------------------------------------------------------------------------
// 生成弹出窗口
function WinPop(url, NewWindowName, width, height, top, left, scrollbars, f){
	window.open(url, NewWindowName, 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', toolbar=no, menubar=no, scrollbars=' + scrollbars + ', resizable=yes, location=no, status=no') 
	// 当f值不为0时，自动将窗口置后
	if(f!=0){window.focus();}
}
// 生成模式对话框
function DialogM(url, vArguments, width, height, scrollbars){
	window.showModalDialog(url, vArguments, "dialogWidth:" + width + "px; dialogHeight:" + height + "px; scroll:" + scrollbars + "; resizable:yes; location:no; status:no;") 
}
// 生成非模式对话框
function DialogL(url, vArguments, width, height, top, left, scrollbars){
	window.showModelessDialog(url, vArguments, "dialogWidth:" + width + "px; dialogHeight:" + height + "px; scroll:" + scrollbars + "; resizable:yes; location:no; status:no;") 
}
function ReLoadGetCode(){
	var GetCode = document.getElementById("GetCode");
	if(iXuEr.GetCodeSrc == ""){iXuEr.GetCodeSrc = GetCode.src;}
	GetCode.src = iXuEr.GetCodeSrc + "?t=" + Math.random();
}
//-----------------------------------------------------------------------------------
// 对链接开新窗口符合Web标准的补充脚本
// 将原来的 target="_blank" 修改为：rel="external"
// Guidy 2005-12-03
//-----------------------------------------------------------------------------------
function externalLinks(){
	if (!document.getElementsByTagName){return};
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank";
		}
	}
}
window.onload = externalLinks;
//-----------------------------------------------------------------------------------
// 输出一个Iframe
// Guidy 2005-12-31
//-----------------------------------------------------------------------------------
function drawIframe(p_Src, p_id, p_width, p_height, p_border){
		document.write("<iframe src=\"" + p_Src + "\" id=\"" + p_id + "\" style=\"height:" + p_height + "px; width:" + p_width + "px; border:" + p_border + "px solid #000000;\">您的浏览器不支持框架页</iframe>");	
}
//-----------------------------------------------------------------------------------
// 全站菜单
// Guidy 2005-12-29
//-----------------------------------------------------------------------------------
// 界面风格部分

