		function changeValue()
				{
					var choice = document.getElementById("f1");
					if(choice.value != "")
					{
						//choice.value = "可自行添加";
					}else
					{
						choice.value = "";
					}
				}

	function eventRelation(pObj,oId)
	{	
		var obj=$(oId);
		changeValue();
		if(obj.style.width=="")
		{
			obj.style.width=$(pObj).clientWidth;
		}
		Andy_relating.nowStyle=new Andy_relatingStyle(0,2);
		Andy_relating.relating(oId,pObj);
	
	}
// JavaScript Document


function setOneElementValue(pId,oLink)
{
	var oControl=document.getElementById(pId);
	if(oControl.tagName!="INPUT"||oControl==null||oLink==null||oLink.tagName!="A"||oLink.disabled==true)return;
	var oValue=oControl.value;
	
	if(oControl.value=="")
	{
		oLink.disabled=true;
		oControl.value=oLink.innerHTML;	
	}
	else
	{		
		var key=oLink.getAttribute("_group");
		var inputValue=oControl.value;
		var arrValue=inputValue.split(",");		
		var arrWorks,oText,i,j;
		if(!Home.label._works[key])
		{	
			oControl.value+=","+oLink.innerHTML; 
			restLinkStatus(oLink);
			oLink.disabled=true;
			return ;
		}
		
		arrWorks=Home.label._works[key];
		oText=oLink.innerHTML;
		for(i=0;i<arrValue.length;i++)
		{
			for(j=0;j<arrWorks.length;j++)
				if(arrValue[i]==arrWorks[j])
				{
					arrValue[i]=oText;
					break;
				}
			if(j<arrWorks.length)
				break;
		}
		if(i==arrValue.length)
			oControl.value+=","+oLink.innerHTML;
		else
			oControl.value=arrValue.toString();
		restLinkStatus(oLink);
		oLink.disabled=true;
	}
}
function  restLinkStatus(oLink)
{
	var arrLink=oLink.parentNode.getElementsByTagName("A");
	for(var i=0;i<arrLink.length;i++)
		arrLink[i].disabled=false;
}

function setElementValue(pId,oLink)
	{
		 
		var oControl=document.getElementById(pId);
		if(oControl.tagName!="INPUT"||oControl==null||oLink==null||oLink.tagName!="A"||oLink.disabled==true)return;
		if(oControl.value=="")
			oControl.value=oLink.innerHTML;
		else
		{
			oControl.value+=","+oLink.innerHTML;
		}
		oLink.disabled=true;
	}


var Andy_base={
	Trim:function(s){var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);return (m == null)?"":m[1];},
	getInfo:function(o){//取得坐标	
	 var to=new Object();
	 to.left=to.right=to.top=to.bottom=0;
	 var twidth=o.offsetWidth;
	 var theight=o.offsetHeight;
	 while(o!=document.body&&o.tagName!="HTML"){
	  to.left+=o.offsetLeft;
	  to.top+=o.offsetTop;  
	  o=o.offsetParent;
	 }
	  to.right=to.left+twidth;
	  to.bottom=to.top+theight;
	 return to;
	},
	isChildElement:function(pObj,cObj)
	{
		var isValid=false;
		var p=$(pObj);
		var c=$(cObj);
		while(c.tagName!="BODY"&&c.tagName!="HTML")
		{
			if(c==p)
			{
				isValid=true;
				break;
			}
			c=c.parentNode;
		}
		return isValid;
	},
	hiddenIframe:function(obj)
	{
		var iframes=obj.getElementsByTagName("iframe");
		if(iframes.length>0)
		{
			for(var i=0;i<iframes.length;i++)
				if(iframes[i].className=="frm__hidden")
					return ;
		}
		var frm=document.createElement("<iframe frameborder='0' scrolling='no' class='frm__hidden' style='filter: Alpha(Opacity=0);position: absolute;left: 0px;top: 0px;z-index: 20000;'></iframe>");
		frm.style.width=obj.offsetWidth;
		frm.style.height=obj.offsetHeight;
		obj.style.zIndex=20001;
		obj.appendChild(frm);	
	}
}

var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}
function Browser(){
		var ua, s, i;
		this.isIE = false;
		this.isNS = false;
		this.isOP = false;
		this.isMZ = false;
		this.isSF = false;
		ua = navigator.userAgent.toLowerCase();
		s = "opera";
		if ((i = ua.indexOf(s)) >= 0)
		{
			this.isOP = true;
			return;
		}
		s = "msie";
		if ((i = ua.indexOf(s)) >= 0)
		{
			this.isIE = true;
			return;
		}
		s = "firefox"; //火狐;
		if ((i = ua.indexOf(s)) >= 0)
		{
			this.isMZ = true;
			return;
		}
		s = "netscape6/";
		if ((i = ua.indexOf(s)) >= 0)
		{
			this.isNS = true;
			return;
		}
		s = "gecko";
		if ((i = ua.indexOf(s)) >= 0)
		{
			this.isNS = true;
			return;
		}
		s = "safari";
		if ((i = ua.indexOf(s)) >= 0)
		{
			this.isSF = true;
			return;
		}
}
function RegisterNamespaces()
{
	for (var i=0;i<arguments.length;i++)
	{
		var astrParts = arguments[i].split(".")
		var root = window;
		for (var j=0; j < astrParts.length; j++)
		{
			if (!root[astrParts[j]]) 
			{
				root[astrParts[j]] = new Object(); 
			}
			root = root[astrParts[j]];
		}
	}
}
function $N(name){return document.getElementsByTagName?document.getElementsByTagName(name):new Array()};
function $() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }
  return elements;
}
var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0; i < iterable.length; i++)
      results.push(iterable[i]);
    return results;
  }
}

Object.extend = function(destination, source) {
  for (property in source) {
    destination[property] = source[property];
  }
  return destination;
}
/*Object.extend(Enumerable, {
  map:     Enumerable.collect,
  find:    Enumerable.detect,
  select:  Enumerable.findAll,
  member:  Enumerable.include,
  entries: Enumerable.toArray
});
*/
/*Object.extend(Array.prototype, Enumerable);

Array.prototype._reverse = Array.prototype.reverse;*/

Object.extend(Array.prototype, {
 /* _each: function(iterator) {
    for (var i = 0; i < this.length; i++)
      iterator(this[i]);
  },

  clear: function() {
    this.length = 0;
    return this;
  },

  first: function() {
    return this[0];
  },

  last: function() {
    return this[this.length - 1];
  },

  compact: function() {
    return this.select(function(value) {
      return value != undefined || value != null;
    });
  },

  flatten: function() {
    return this.inject([], function(array, value) {
      return array.concat(value.constructor == Array ?
        value.flatten() : [value]);
    });
  },

  without: function() {
    var values = $A(arguments);
    return this.select(function(value) {
      return !values.include(value);
    });
  },

  indexOf: function(object) {
    for (var i = 0; i < this.length; i++)
      if (this[i] == object) return i;
    return -1;
  },

  reverse: function(inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  },
*/
  shift: function() {
    var result = this[0];
    for (var i = 0; i < this.length - 1; i++)
      this[i] = this[i + 1];
    this.length--;
    return result;
  }/*,

  inspect: function() {
    return '[' + this.map(Object.inspect).join(', ') + ']';
  }*/
});

var tagExpand={
	showIcon:"",
	hiddenIcon:"",
	showHidden:function(srcID,ctrID,sIcon,hIcon)
	{
		//var el=document.getElementById(ctrID);
		var srcEl=$(srcID);
		
		if(ctrID==null||ctrID=="") return ;
		
		var Els=ctrID.split(",");
		
		for(var i=0;i<Els.length;i++)
		{
			var el=$(Els[i]);
			if(!el)	continue;
			if(el.style.display=="none")
			{
				el.style.display="";
				if(i==0&&srcEl!=null){	var icon=sIcon||this.showIcon;	if(icon!="") srcEl.src=icon;};
			}
			else
			{
				el.style.display="none";
				if(i==0&&srcEl!=null){	var icon=hIcon||this.hiddenIcon;if(icon!="")	srcEl.src=icon;};				
				
			}
		}

	},
	setShowHidden:function(obj)
	{
		if(obj.showIcon&&obj.hiddenIcon)
		{
			this.showIcon=obj.showIcon;
			this.hiddenIcon=obj.hiddenIcon;
			var sImg=new Image();
			var hImgs=new Image();
			sImg.src=obj.showIcon;
			hImgs=obj.hiddenIcon;
		}
	}
	
	/*,
	setExpand:function(ev,cmmd)
	{
		if(arguments.length<3) return ;

		switch(cmmd)
		{
			case "showHidden":
				
				break;
		}
	},
	setShowHidden:function(ev,id,cClass,oClass)
	{
		//$(id).ev="showHidden
	}*/
}


String.prototype.Trim=function(){var s=this.toString(); var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);return (m == null)?"":m[1];}
String.prototype.toFormat=function()
{
	var str=this.toString();
	if(arguments.length<=0) return str;	
	for(var i = 0; i < arguments.length; ++i)
	{
		str = str.replace('{' + i + '}',arguments[i]);
	}
	return str;	
}

Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}


Function.prototype.bindAsEventListener = function(object) {
  var __method = this;
  return function(event) {
    return __method.call(object, event || window.event);
  }
}
Array.prototype.append=function(obj,nodup){
  if (!(nodup && this.contains(obj))){
    this[this.length]=obj;
  }
}
Array.prototype.indexOf=function(obj){
  var result=-1;
  for (var i=0;i<this.length;i++){
    if (this[i]==obj){
      result=i;
      break;
    }
  }
  return result;
}
Array.prototype.contains=function(obj){
  return (this.indexOf(obj)>=0);
}
Array.prototype.clear=function(){
  this.length=0;
}
Array.prototype.insertAt=function(index,obj){
  this.splice(index,0,obj);
}
Array.prototype.removeAt=function(index){
  this.splice(index,1);
}
Array.prototype.remove=function(obj){
  var index=this.indexOf(obj);
  if (index>=0){
    this.removeAt(index);
  }
}

var jsEvent=new Array();

jsEvent.EventRouter=function(el,eventType){
  this.lsnrs=new Array();
  this.el=el;
  el.eventRouter=this;
  el[eventType]=jsEvent.EventRouter.callback;
}
jsEvent.EventRouter.prototype.addListener=function(lsnr){
  this.lsnrs.append(lsnr,true);
}
jsEvent.EventRouter.prototype.removeListener=function(lsnr){
  this.lsnrs.remove(lsnr);
}
jsEvent.EventRouter.prototype.notify=function(e){
  var lsnrs=this.lsnrs;
  for(var i=0;i<lsnrs.length;i++){
    var lsnr=lsnrs[i];
    lsnr.call(this,e);
  }
}
jsEvent.EventRouter.callback=function(event){
  var e=event || window.event;
  var router=this.eventRouter;
  router.notify(e)
}


//创建层与事件对象的关联

// 方法
var Andy_relating={
	arrRelating:[],
	targetObj:null,
	relObj:null,
	nowStyle:null,
	defaultStyle:new Andy_relatingStyle(0,0,"absolute",true,null,null,false),
	show:false,	
	isIE:(navigator.userAgent.toLowerCase().indexOf( "msie")>= 0)?true:false,
	relating:function(strObj,RelObj,apply)
	{
		this.arrRelating.push(strObj);
		var relObj=$(RelObj);
		if(relObj!=null)
		{	
			relObj.setAttribute("_relating",strObj);
			relObj.setAttribute("_relatingStyle",Andy_relating.nowStyle);
		}
		else return false;
		
		var obj=$(strObj);
		if(obj!=null)
		{
			obj.onclick=function(){Andy_relating.show=true};
		}
		if(apply==true)
		{
			this.applay(relObj);
		}
		else
		{			
			if(relObj!=null)
			{
				relObj.onclick=function()
				{					
					Andy_relating.applay(this);
					return false;
				}
			}
		}
		return false;
	},
	close:function()
	{
		changeValue();
		if(this.targetObj!=null)
		{
			var obj=$(this.targetObj);
			if(obj!=null)
			{
				obj.style.display="none";
				this.targetObj=null;
				this.relObj=null;
			}
		}
	},
	clear:function()
	{
		this.targetObj=null;
		this.relObj=null;
	},
	applay:function(relObj)
	{
		if(relObj==null) return false;
		if($(this.targetObj)!=null)
			this.hidden();
			
			
		this.show=true;
		var objId=relObj.getAttribute("_relating");
		var obj=(objId!=null)?$(objId):null;
		var oStyle=relObj.getAttribute("_relatingStyle");
		
		if(oStyle==null)
			oStyle=Andy_relating.defaultStyle;
			
		var oCenter=false;//(oStyle.wCenter==true&&oStyle.hMiddle==true)?true:false;
		
		var left,top;
		left=top=0;
		
		top+=((oStyle.isHeight==false)?0:relObj.offsetHeight);
		
		if(oStyle!=null&&oStyle.moveX!=null)
			left+=oStyle.moveX;		
		//else if(oStyle.wCenter==true)
		//	left=Math.round(parseInt(document.body.clientWidth)/2);
		if(oStyle!=null&&oStyle.moveY!=null)
			top+=oStyle.moveY;
		//else if(oStyle.hMiddle==true)
			//top=Math.round(parseInt(document.body.clientHeight)/2);//top=Math.round((screen.height-21)/2);
		
		if(oStyle.position=="relative")		//相对位置
		{
			relObj.parentNode.style.position="relative";
			if(oCenter!=true)
			{
				top+=relObj.offsetTop + 20;
				left+=relObj.offsetLeft;
			}
		}
		else		//绝对位置
		{
			var info=Andy_base.getInfo(relObj);	
			if(oCenter!=true)
			{
				left+=info.left;
				top+=info.top;
			}
		}
		if(obj==null) return false;
		
		var browse = new Browser();
		if(browse.isMZ==false){
			with(obj)
			{
				style.display="block";
				style.position ="absolute";
				var toRight=parseInt(left)+parseInt(offsetWidth);	
				if(oCenter==true)
				{
					left-=Math.round(offsetWidth/2);
					top-=Math.round(offsetHeight/2);
				}
				else if(toRight>(document.body.offsetWidth-5))	//超出右侧框架时的处理
				{
					left-=(offsetWidth-relObj.offsetWidth);
				}
				style.left=left+"px";
				style.top=top+"px";		
				
				Andy_relating.targetObj=obj;
				Andy_relating.relObj=relObj;
			}
		}else{
			with(obj)
			{
				style.display="block";
				style.position ="absolute";
				var toRight=parseInt(left)+parseInt(offsetWidth);	
				if(oCenter==true)
				{
					left-=Math.round(innerWidth/2);
					top-=Math.round(innerHeight/2);
				}
				else if(toRight>(window.innerWidth-5))	//超出右侧框架时的处理
				{
					left-=(innerWidth-relObj.innerWidth);
				}
				style.left=left+"px";
				style.top=top+"px";		
				
				Andy_relating.targetObj=obj;
				Andy_relating.relObj=relObj;
			}
		}
		
		if(obj.childNodes[0].className=="shadow"&&obj.childNodes[1]!=null)
		{
			var content=obj.childNodes[1];
			var shadow=obj.childNodes[0];
			var w=content.offsetWidth;
			var h=content.offsetHeight;		
			shadow.style.width=w;
			shadow.style.height=h;
			content.style.position="relative";	
			content.style.zIndex=20002;
//			content.style.zIndex=0;
			
			var fLn=obj.getElementsByTagName("iframe");
			if((fLn.length>0&&fLn[0].className=="frm__hidden")||this.isIE==false)	return true;
			
			var frm=document.createElement("<iframe frameborder='0' scrolling='no' class='frm__hidden' style='filter: Alpha(Opacity=0);position: absolute;left: 0px;top: 0px;z-index: 20000;'></iframe>");
//			var frm=document.createElement("<iframe frameborder='0' scrolling='no' class='frm__hidden' style='filter: Alpha(Opacity=0);position: absolute;left: 0px;top: 0px;z-index: 0;'></iframe>");
			frm.style.width=obj.offsetWidth;
			frm.style.height=obj.offsetHeight;
			obj.style.zIndex=20001;
//			obj.style.zIndex=0;
			obj.appendChild(frm);
		}	
	},	
	hidden:function()
	{
		var obj=$(this.targetObj);
		if(obj==null) return;
		
		obj.style.display="none";
		this.clear();
	}
};
document.onclick=function()
{
	if(Andy_relating.show==false&&Andy_relating.relObj!=null)
	{
		Andy_relating.hidden();
	}
	Andy_relating.show=false;
}

//定位类型,位移X，位移Y,是否有阴影,屏幕是否变暗
function Andy_relatingStyle(moveX,moveY,position,isHeight,wCenter,hMiddle,ScreenConvert)	
{
	this.moveX=moveX;
	this.moveY=moveY;
	this.position=position;
	//this.shadow=shadow;
	this.wCenter=wCenter;
	this.hMiddle=hMiddle;
	this.isHeight=isHeight;		//是否包括链接本身的宽度
	this.screenConvert=ScreenConvert;
}
