﻿// JScript 文件

//本js完全是从prize.js拷贝而来,为了快速起见,不用考虑那么多的因素
// 下拉区背景色
var DIV_BG_COLOR = "#EEE";
// 高亮显示条目颜色
var DIV_HIGHLIGHT_COLOR = "#C30";
// 字体
var DIV_FONT = "Arial";
// 下拉区内补丁大小
var DIV_PADDING = "2px";
// 下拉区边框样式
var DIV_BORDER = "none";
//"1px solid #CCC";


// 文本输入框
var ActiveInputText;
// 浮动层id
var divName;
// 显示结果的浮动层
var globalDiv;
/**
显示浮动层
*/
function showUpgradeVipDiv (show,evt,TypeValue)
{
	var div = getUpgradeVipDiv(evt,TypeValue);
    //alert(globalDiv.outerHTML);
    //alert(show);
	if (show)
	{
	    //div.style.display = "";
	    //alert("1");
		div.style.visibility = "visible";
	}
	else
	{
	    //div.style.display = "none";
		div.style.visibility = "hidden";
	}
	//alert(globalDiv.outerHTML);
	//adjustiFrame();
}

function getUpgradeVipDiv (evt,TypeValue)
{
        var divID = "floater";
		// 如果div在页面中不存在,创建一个新的div
		if (!document.getElementById(divID))
		{
			var newNode = document.createElement("div");
			newNode.setAttribute("id", divID);
			document.body.appendChild(newNode);
		}

		// globalDiv设置为div的引用		
		globalDiv = document.getElementById(divID);

		// 计算div左上角的位置		
		var x = parseInt(document.getElementById(evt).offsetLeft);
		var y = parseInt(document.getElementById(evt).offsetTop) + parseInt(document.getElementById(evt).offsetHeight);
		var parent = document.getElementById(evt);
		while (parent.offsetParent)
		{
			parent = parent.offsetParent;
			x += parent.offsetLeft;
			y += parent.offsetTop;
		}
		// 如果没有对div设置格式,则为其设置相应的显示样式	
		    globalDiv.innerHTML = "";	
			globalDiv.style.backgroundColor = DIV_BG_COLOR;
			globalDiv.style.fontFamily = DIV_FONT;
			globalDiv.style.padding = DIV_PADDING;
			globalDiv.style.border = DIV_BORDER;
			globalDiv.style.width = "150px";
			//globalDiv.style.height = "100px";
			//globalDiv.style.fontSize = "12";

			globalDiv.style.position = "absolute";
			globalDiv.style.left = x + "px";
			globalDiv.style.top =  y + "px";
			//globalDiv.style.display = "none";
			globalDiv.style.visibility = "hidden";
			//globalDiv.style.zIndex = 888;
			
          //alert(AjaxHtmlStr);
          globalDiv.innerHTML =   AjaxHtmlStr;      
			
    //alert(globalDiv.innerHTML);
	return globalDiv;
}