/*
--------------------------
code by arjun
email: zhangyuanjun@126.com
date : 2006-9-26  
--------------------------
*/
function $(id)
{
	return document.getElementById(id);
}
//框框类别定义
function box(obj)
{
	this.id="akk";
	this.innerHTML="";
	this.top=0;
	this.left=0;
	this.value="";
	this.title="网页框";
	this.titleColor="#009900";
	this.toObj=obj;
	this.width="200";
	this.height="";
	this.bgcolor="#ffffff";
	this.filter="";
	this.me="me";
	this.bc="bcg"
	me=this;
	this.closeIcon="<a href='javascript:;' onclick=\"me.close('"+this.id+"');\">关闭</a>";
	this.onclick=function()
	{
		var obj=event.srcElement;
		if (obj.name=="value")
		{
			me.value=obj.innerText;
			if(me.toObj){
				me.toObj.value=me.value;
				me.close();
			}
		}
	}
	//初始化位置
	this.create=function()
	{
		var y=event.y+document.body.scrollTop;
		//alert(y)
		//alert(document.body.offsetHeight)
		if(y>document.body.offsetHeihgt-200)
			y=document.body.offsetHeihgt-200;
		var x=event.x+document.body.scrollLeft;
		//alert(x)
		//alert(document.body.offsetWidth)
		if(x>document.body.offsetWidth-this.width)
			x=document.body.offsetWidth-this.width
		this.top=y;
		this.left=x;
	}
	this.run=function()
	{
		if (!$(this.id))
		{
			var obj=document.createElement("div");
			obj.setAttribute("id",this.id+"");
			document.body.appendChild(obj);
		}else{
			var obj=$(this.id);
		}
		if (!$(this.bcg))
		{
			var obj1=document.createElement("div");
			obj1.setAttribute("id",this.bc+"");
			document.body.appendChild(obj1);
		}else{
			var obj1=$(this.bc);
		}
		obj1.style.left=0;
		obj1.style.top=0;
		obj1.style.backgroundColor="#676767";
		obj1.style.width=document.body.offsetWidth;
		obj1.style.height=document.body.offsetHeight;
		obj1.style.position="absolute";
		obj1.style.filter="alpha(opacity=10)";
		obj1.style.zIndex=1;
		this.closeIcon="<a href='javascript:;' onclick=\"me.close('"+this.id+"');\">关闭</a>";
		obj.innerHTML="<table width=100% align=center cellspacing=0>"+"<TR bgcolor="+this.titlecolor+"><td>"+this.title+"</td><td align=right>"+this.closeIcon+"</td>"+"</tr><tr><td colspan=2 bgcolor="+this.bgcolor+">"+this.innerHTML+"</td></tr></table>";
		obj.style.top=this.top;
		obj.style.left=this.left;
		obj.style.width=this.width;
		obj.style.height=this.height;
		obj.style.border="1px #006600 solid";
		obj.style.filter=this.filter;
		obj.style.zIndex=99;
		obj.style.position="absolute";
		obj.onclick=this.onclick;
	}
	this.close=function(aid)
	{
		$(aid).removeNode(true);
		$(this.bc).removeNode(true);
		if(me.toObj){
			me.toObj.focus();
		}
	}
}

/*
  信息框例
function a(obj)
{
	var kk=new box(obj);
	kk.create();
	kk.title="信息提示";
	kk.innerHTML="<TABLE width=100% cellspacing=0>"
				+"<TR><TD name=value onmouseover=this.style.backgroundColor='#DAFABA' onmouseout=this.style.backgroundColor=''>1</TD></TR>"
				+"<TR><TD name=value onmouseover=this.style.backgroundColor='#DAFABA' onmouseout=this.style.backgroundColor=''>2</TD></TR>"
				+"<TR><TD name=value onmouseover=this.style.backgroundColor='#DAFABA' onmouseout=this.style.backgroundColor=''>3</TD></TR>"
				+"<TR><TD name=value onmouseover=this.style.backgroundColor='#DAFABA' onmouseout=this.style.backgroundColor=''>4</TD></TR>"
				+"<TR><TD name=value onmouseover=this.style.backgroundColor='#DAFABA' onmouseout=this.style.backgroundColor=''>5</TD></TR>"
				+"</TABLE>";
	kk.run();
}*/  
  
  
 
 
