﻿
var childCreate=false;

function Offset(e)

{
	var t = e.offsetTop;
	var l = e.offsetLeft;
	var w = e.offsetWidth;
	var h = e.offsetHeight-2;

	while(e=e.offsetParent)
	{
		t+=e.offsetTop;
		l+=e.offsetLeft;
	}
	return {
		top : t,
		left : l,
		width : w,
		height : h
	}
}

function loadSelectYz(obj){


	var offset=Offset(obj);

	obj.style.display="none";
	
	var sWidth,sHeight;
            sWidth=document.body.offsetWidth;
            sHeight=screen.height;
            var bgObj=document.createElement("div");
            bgObj.setAttribute('id','bgDiv');
            bgObj.style.position="absolute";
            bgObj.style.top="0";
            bgObj.style.background="#777";
            bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=1,finishOpacity=1";
            bgObj.style.opacity="0.01";
            bgObj.style.left="0";
            bgObj.style.width=sWidth + "px";
            bgObj.style.height=sHeight + "px";
            bgObj.style.zIndex = "50";
            

	var iDiv = document.createElement("div");
		iDiv.id="selectof" + obj.name;
		iDiv.style.position = "absolute";
		iDiv.style.width=offset.width + "px";
		iDiv.style.height=offset.height + "px";
		iDiv.style.top=offset.top + "px";
		iDiv.style.left=offset.left + "px";
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
		iDiv.style.border="1px solid #E7E7E7";// ޸
		iDiv.style.color="#3c3c3c";// ޸
		iDiv.style.fontSize="12px";
		iDiv.style.lineHeight=offset.height + "px";
		iDiv.style.textIndent="4px";
		iDiv.style.zIndex = "51";
		
	document.body.appendChild(iDiv);


	var tValue=obj.options[obj.selectedIndex].innerHTML;
	iDiv.innerHTML=tValue;


	iDiv.onmouseover=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select_focus.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onmouseout=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onclick=function(){
		if (document.getElementById("selectchild" + obj.name)){
		
			if (childCreate){
				
				document.getElementById("selectchild" + obj.name).style.display="none";
				childCreate=false;
				document.body.removeChild(bgObj);
			}else{
				document.getElementById("selectchild" + obj.name).style.display="";
				childCreate=true;
				document.body.appendChild(bgObj);
			}
		}else{
			
			var cDiv = document.createElement("div");
			cDiv.id="selectchild" + obj.name;
			cDiv.style.position = "absolute";
			cDiv.style.width=offset.width + "px";
			cDiv.style.height=obj.options.length *20 + "px";
			cDiv.style.top=(offset.top+offset.height+2) + "px";
			cDiv.style.left=offset.left + "px";
			cDiv.style.background="#f7f7f7";
			cDiv.style.color="#3c3c3c";// 
			cDiv.style.border="1px solid silver";
			cDiv.style.filter="alpha(opacity=65)";// ޸
			cDiv.style.opacity="0.65";// ޸
			cDiv.style.zIndex = "52";
			

			//cDiv.onmouseout=function(){
					//document.getElementById("selectchild" + obj.name).style.display="none";
					//childCreate=false;
					//}

			var uUl = document.createElement("ul");
			uUl.id="uUlchild" + obj.name;
			uUl.style.listStyle="none";
			uUl.style.margin="0";
			uUl.style.padding="0";
			uUl.style.fontSize="12px";
			cDiv.appendChild(uUl);
			document.body.appendChild(cDiv);		
			childCreate=true;
			
			for (var i=0;i<obj.options.length;i++){
				
				var lLi=document.createElement("li");
				lLi.id=obj.options[i].value;
				lLi.style.textIndent="4px";
				lLi.style.height="20px";
				lLi.style.lineHeight="20px";
				lLi.innerHTML=obj.options[i].innerHTML;
				uUl.appendChild(lLi);
			}
			var liObj=document.getElementById("uUlchild" + obj.name).getElementsByTagName("li");
			
			for (var j=0;j<obj.options.length;j++){
				
				liObj[j].onmouseover=function(){
					this.style.background="gray";// ޸
					this.style.color="white";// ޸
				}
				liObj[j].onmouseout=function(){
					this.style.background="white";// ޸
					this.style.color="black";// ޸
				}
				liObj[j].onclick=function(){
					
					obj.options.length=0;
					obj.options[0]=new Option(this.innerHTML,this.id);
					document.getElementById("typeId").value=this.id;	//-------------------------------------------修改 input  hidden   de  id				
					document.getElementById("selectchild" + obj.name).style.display="none";
					document.body.removeChild(bgObj);
					childCreate=false;
					iDiv.innerHTML=this.innerHTML;
					//obj.options[obj.selectedIndex].value=this.id;！
					
					//window.open(this.id);//  起作用
			        //window.location=this.id;	
				}
	
			}
			
			document.body.appendChild(bgObj);
			bgObj.onclick=function(){
					document.body.removeChild(bgObj);
					document.getElementById("selectchild" + obj.name).style.display="none";
					childCreate=false;	
				}

		}	
	}
}


function loadSelectVip(obj){


	var offset=Offset(obj);

	obj.style.display="none";
	
	var sWidth,sHeight;
            sWidth=document.body.offsetWidth;
            sHeight=screen.height;
            var bgObj=document.createElement("div");
            bgObj.setAttribute('id','bgDiv');
            bgObj.style.position="absolute";
            bgObj.style.top="0";
            bgObj.style.background="#777";
            bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=1,finishOpacity=1";
            bgObj.style.opacity="0.01";
            bgObj.style.left="0";
            bgObj.style.width=sWidth + "px";
            bgObj.style.height=sHeight + "px";
            bgObj.style.zIndex = "50";
            

	var iDiv = document.createElement("div");
		iDiv.id="selectof" + obj.name;
		iDiv.style.position = "absolute";
		iDiv.style.width=offset.width + "px";
		iDiv.style.height=offset.height + "px";
		iDiv.style.top=offset.top + "px";
		iDiv.style.left=offset.left + "px";
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
		iDiv.style.border="1px solid #E7E7E7";// ޸
		iDiv.style.color="#3c3c3c";// ޸
		iDiv.style.fontSize="12px";
		iDiv.style.lineHeight=offset.height + "px";
		iDiv.style.textIndent="4px";
		iDiv.style.zIndex = "51";
		
	document.body.appendChild(iDiv);


	var tValue=obj.options[obj.selectedIndex].innerHTML;
	iDiv.innerHTML=tValue;


	iDiv.onmouseover=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select_focus.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onmouseout=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onclick=function(){
		if (document.getElementById("selectchild" + obj.name)){
		
			if (childCreate){
				
				document.getElementById("selectchild" + obj.name).style.display="none";
				childCreate=false;
				document.body.removeChild(bgObj);
			}else{
				document.getElementById("selectchild" + obj.name).style.display="";
				childCreate=true;
				document.body.appendChild(bgObj);
			}
		}else{
			
			var cDiv = document.createElement("div");
			cDiv.id="selectchild" + obj.name;
			cDiv.style.position = "absolute";
			cDiv.style.width=offset.width + "px";
			cDiv.style.height=obj.options.length *20 + "px";
			cDiv.style.top=(offset.top+offset.height+2) + "px";
			cDiv.style.left=offset.left + "px";
			cDiv.style.background="#f7f7f7";
			cDiv.style.color="#3c3c3c";// 
			cDiv.style.border="1px solid silver";
			cDiv.style.filter="alpha(opacity=65)";// ޸
			cDiv.style.opacity="0.65";// ޸
			cDiv.style.zIndex = "52";
			

			//cDiv.onmouseout=function(){
					//document.getElementById("selectchild" + obj.name).style.display="none";
					//childCreate=false;
					//}

			var uUl = document.createElement("ul");
			uUl.id="uUlchild" + obj.name;
			uUl.style.listStyle="none";
			uUl.style.margin="0";
			uUl.style.padding="0";
			uUl.style.fontSize="12px";
			cDiv.appendChild(uUl);
			document.body.appendChild(cDiv);		
			childCreate=true;
			
			for (var i=0;i<obj.options.length;i++){
				
				var lLi=document.createElement("li");
				lLi.id=obj.options[i].value;
				lLi.style.textIndent="4px";
				lLi.style.height="20px";
				lLi.style.lineHeight="20px";
				lLi.innerHTML=obj.options[i].innerHTML;
				uUl.appendChild(lLi);
			}
			var liObj=document.getElementById("uUlchild" + obj.name).getElementsByTagName("li");
			
			for (var j=0;j<obj.options.length;j++){
				
				liObj[j].onmouseover=function(){
					this.style.background="gray";// ޸
					this.style.color="white";// ޸
				}
				liObj[j].onmouseout=function(){
					this.style.background="white";// ޸
					this.style.color="black";// ޸
				}
				liObj[j].onclick=function(){
					
					obj.options.length=0;
					obj.options[0]=new Option(this.innerHTML,this.id);
					document.getElementById("typeId").value=this.id;	//-------------------------------------------修改 input  hidden   de  id				
					document.getElementById("selectchild" + obj.name).style.display="none";
					document.body.removeChild(bgObj);
					childCreate=false;
					iDiv.innerHTML=this.innerHTML;
					//obj.options[obj.selectedIndex].value=this.id;！
					
					//window.open(this.id);//  起作用
			        //window.location=this.id;	
				}
	
			}
			
			document.body.appendChild(bgObj);
			bgObj.onclick=function(){
					document.body.removeChild(bgObj);
					document.getElementById("selectchild" + obj.name).style.display="none";
					childCreate=false;	
				}

		}	
	}
}


function loadSelectLc(obj){


	var offset=Offset(obj);

	obj.style.display="none";
	
	var sWidth,sHeight;
            sWidth=document.body.offsetWidth;
            sHeight=screen.height;
            var bgObj=document.createElement("div");
            bgObj.setAttribute('id','bgDiv');
            bgObj.style.position="absolute";
            bgObj.style.top="0";
            bgObj.style.background="#777";
            bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=1,finishOpacity=1";
            bgObj.style.opacity="0.01";
            bgObj.style.left="0";
            bgObj.style.width=sWidth + "px";
            bgObj.style.height=sHeight + "px";
            bgObj.style.zIndex = "50";
            

	var iDiv = document.createElement("div");
		iDiv.id="selectof" + obj.name;
		iDiv.style.position = "absolute";
		iDiv.style.width=offset.width + "px";
		iDiv.style.height=offset.height + "px";
		iDiv.style.top=offset.top + "px";
		iDiv.style.left=offset.left + "px";
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
		iDiv.style.border="1px solid #E7E7E7";// ޸
		iDiv.style.color="#3c3c3c";// ޸
		iDiv.style.fontSize="12px";
		iDiv.style.lineHeight=offset.height + "px";
		iDiv.style.textIndent="4px";
		iDiv.style.zIndex = "51";
		
	document.body.appendChild(iDiv);


	var tValue=obj.options[obj.selectedIndex].innerHTML;
	iDiv.innerHTML=tValue;


	iDiv.onmouseover=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select_focus.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onmouseout=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onclick=function(){
		if (document.getElementById("selectchild" + obj.name)){
		
			if (childCreate){
				
				document.getElementById("selectchild" + obj.name).style.display="none";
				childCreate=false;
				document.body.removeChild(bgObj);
			}else{
				document.getElementById("selectchild" + obj.name).style.display="";
				childCreate=true;
				document.body.appendChild(bgObj);
			}
		}else{
			
			var cDiv = document.createElement("div");
			cDiv.id="selectchild" + obj.name;
			cDiv.style.position = "absolute";
			cDiv.style.width=offset.width + "px";
			cDiv.style.height=obj.options.length *20 + "px";
			cDiv.style.top=(offset.top+offset.height+2) + "px";
			cDiv.style.left=offset.left + "px";
			cDiv.style.background="#f7f7f7";
			cDiv.style.color="#3c3c3c";// 
			cDiv.style.border="1px solid silver";
			cDiv.style.filter="alpha(opacity=65)";// ޸
			cDiv.style.opacity="0.65";// ޸
			cDiv.style.zIndex = "52";
			

			//cDiv.onmouseout=function(){
					//document.getElementById("selectchild" + obj.name).style.display="none";
					//childCreate=false;
					//}

			var uUl = document.createElement("ul");
			uUl.id="uUlchild" + obj.name;
			uUl.style.listStyle="none";
			uUl.style.margin="0";
			uUl.style.padding="0";
			uUl.style.fontSize="12px";
			cDiv.appendChild(uUl);
			document.body.appendChild(cDiv);		
			childCreate=true;
			
			for (var i=0;i<obj.options.length;i++){
				
				var lLi=document.createElement("li");
				lLi.id=obj.options[i].value;
				lLi.style.textIndent="4px";
				lLi.style.height="20px";
				lLi.style.lineHeight="20px";
				lLi.innerHTML=obj.options[i].innerHTML;
				uUl.appendChild(lLi);
			}
			var liObj=document.getElementById("uUlchild" + obj.name).getElementsByTagName("li");
			
			for (var j=0;j<obj.options.length;j++){
				
				liObj[j].onmouseover=function(){
					this.style.background="gray";// ޸
					this.style.color="white";// ޸
				}
				liObj[j].onmouseout=function(){
					this.style.background="white";// ޸
					this.style.color="black";// ޸
				}
				liObj[j].onclick=function(){
					
					obj.options.length=0;
					obj.options[0]=new Option(this.innerHTML,this.id);
					document.getElementById("floorId").value=this.id;	//-------------------------------------------修改 input  hidden   de  id				
					document.getElementById("selectchild" + obj.name).style.display="none";
					document.body.removeChild(bgObj);
					childCreate=false;
					iDiv.innerHTML=this.innerHTML;
					//obj.options[obj.selectedIndex].value=this.id;！
					
					//window.open(this.id);//  起作用
			        //window.location=this.id;	
				}
	
			}
			
			document.body.appendChild(bgObj);
			bgObj.onclick=function(){
					document.body.removeChild(bgObj);
					document.getElementById("selectchild" + obj.name).style.display="none";
					childCreate=false;	
				}

		}	
	}
}


function loadSelectCsj(obj){


	var offset=Offset(obj);

	obj.style.display="none";
	
	var sWidth,sHeight;
            sWidth=document.body.offsetWidth;
            sHeight=screen.height;
            var bgObj=document.createElement("div");
            bgObj.setAttribute('id','bgDiv');
            bgObj.style.position="absolute";
            bgObj.style.top="0";
            bgObj.style.background="#777";
            bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=1,finishOpacity=1";
            bgObj.style.opacity="0.01";
            bgObj.style.left="0";
            bgObj.style.width=sWidth + "px";
            bgObj.style.height=sHeight + "px";
            bgObj.style.zIndex = "50";
            

	var iDiv = document.createElement("div");
		iDiv.id="selectof" + obj.name;
		iDiv.style.position = "absolute";
		iDiv.style.width=offset.width + "px";
		iDiv.style.height=offset.height + "px";
		iDiv.style.top=offset.top + "px";
		iDiv.style.left=offset.left + "px";
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
		iDiv.style.border="1px solid #E7E7E7";// ޸
		iDiv.style.color="#3c3c3c";// ޸
		iDiv.style.fontSize="12px";
		iDiv.style.lineHeight=offset.height + "px";
		iDiv.style.textIndent="4px";
		iDiv.style.zIndex = "51";
		
	document.body.appendChild(iDiv);


	var tValue=obj.options[obj.selectedIndex].innerHTML;
	iDiv.innerHTML=tValue;


	iDiv.onmouseover=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select_focus.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onmouseout=function(){
		iDiv.style.background="#B8B8B8 url(images/icon_select.jpg) no-repeat right 0px";// ޸
	}
	iDiv.onclick=function(){
		if (document.getElementById("selectchild" + obj.name)){
		
			if (childCreate){
				
				document.getElementById("selectchild" + obj.name).style.display="none";
				childCreate=false;
				document.body.removeChild(bgObj);
			}else{
				document.getElementById("selectchild" + obj.name).style.display="";
				childCreate=true;
				document.body.appendChild(bgObj);
			}

		}else{
			
			var cDiv = document.createElement("div");
			cDiv.id="selectchild" + obj.name;
			cDiv.style.position = "absolute";
			cDiv.style.width=offset.width + "px";
			cDiv.style.height=obj.options.length *20 + "px";
			cDiv.style.top=(offset.top+offset.height+2) + "px";
			cDiv.style.left=offset.left + "px";
			cDiv.style.background="#f7f7f7";
			cDiv.style.color="#3c3c3c";// 
			cDiv.style.border="1px solid silver";
			cDiv.style.filter="alpha(opacity=65)";// ޸
			cDiv.style.opacity="0.65";// ޸
			cDiv.style.zIndex = "52";
			

			//cDiv.onmouseout=function(){
					//document.getElementById("selectchild" + obj.name).style.display="none";
					//childCreate=false;
					//}

			var uUl = document.createElement("ul");
			uUl.id="uUlchild" + obj.name;
			uUl.style.listStyle="none";
			uUl.style.margin="0";
			uUl.style.padding="0";
			uUl.style.fontSize="12px";
			cDiv.appendChild(uUl);
			document.body.appendChild(cDiv);		
			childCreate=true;
			
			for (var i=0;i<obj.options.length;i++){
				
				var lLi=document.createElement("li");
				lLi.id=obj.options[i].value;
				lLi.style.textIndent="4px";
				lLi.style.height="20px";
				lLi.style.lineHeight="20px";
				lLi.innerHTML=obj.options[i].innerHTML;
				uUl.appendChild(lLi);
			}
			var liObj=document.getElementById("uUlchild" + obj.name).getElementsByTagName("li");
			
			for (var j=0;j<obj.options.length;j++){
				
				liObj[j].onmouseover=function(){
					this.style.background="gray";// ޸
					this.style.color="white";// ޸
				}
				liObj[j].onmouseout=function(){
					this.style.background="white";// ޸
					this.style.color="black";// ޸
				}
				liObj[j].onclick=function(){
					
					obj.options.length=0;
					obj.options[0]=new Option(this.innerHTML,this.id);
					document.getElementById("selectchild" + obj.name).style.display="none";
					document.body.removeChild(bgObj);
					childCreate=false;
					iDiv.innerHTML=this.innerHTML;
					//obj.options[obj.selectedIndex].value=this.id;
					
					//window.open(this.id);//  起作用
			        window.location=this.id;	
				}
	
			}
			
			document.body.appendChild(bgObj);
			bgObj.onclick=function(){
					document.body.removeChild(bgObj);
					document.getElementById("selectchild" + obj.name).style.display="none";
					childCreate=false;	
				}

		}	
	}
}

