﻿function getPosition() {
  var top    = document.documentElement.scrollTop;
  var left   = document.documentElement.scrollLeft;
  var height = document.documentElement.clientHeight;
  var width  = document.documentElement.clientWidth;
  return {top:top,left:left,height:height,width:width};
}

function showPop(obj) {
  //var aa=200;//get_Text(e)+31;
  var aa=get_Text(obj)+31;
  //alert(aa);
  var width  = 600;  //弹出框的宽度
  //var height = 300;  //弹出框的高度
  var obj    = document.getElementById("pop");
  
  obj.style.display  = "block";
  //var height = obj.offsetHeight;  //弹出框的高度  
  
  obj.style.position = "absolute";
  obj.style.zindex   = "9999";
  obj.style.width    = width + "px";
  //obj.style.height   = height + "px";
  
  var Position = getPosition();
  leftadd = (Position.width-width)/2;
  // topadd  = (Position.height-height)/2;
  //topadd = (Position.height - height)/2;
 
  
//  if((aa+300)>Position.height && aa>300){
//    aa=aa-168;//向上显示
//  }
obj.style.top  = aa  + "px";
  
//obj.style.top = (Position.top + topadd) + "px";                      
  obj.style.left = (Position.left + leftadd) + "px";
  
//  window.onscroll = function (){
//    var Position   = getPosition();
////    obj.style.top  = aa  + "px";
//    obj.style.top  = (Position.top  + topadd)  +"px";
//    obj.style.left = (Position.left + leftadd) +"px";
//  };
  
//  //禁止冒泡事件    
//    //假如供给了事件对象，则这是一个非IE浏览器
//    if ( e && e.stopPropagation )
//　　    //因此它支撑W3C的stopPropagation()方法
//　　    e.stopPropagation(); 
//    else
//　　    //否则，我们需要应用IE的方法来取消事件冒泡 
//　　    window.event.cancelBubble = true;
//    return false;
  //var curtop=getAbsPoint(e);  
  
}

function hidePop(){
  document.getElementById("pop").style.display = "none";
}

function get_Text(obj) {
	m = obj;
	var w=0,h=0;
	while(m.offsetParent)
	{
	    //m = obj.parentNode;
	    //alert(m.tagName);
		w += m.offsetLeft;
		h += m.offsetTop;
		m = m.offsetParent;
	}
	return h;
	//alert("宽度为："+w+";高度为："+h);
}

function Loadreturn(strOjb) {
    var content;
    if(strOjb==null||strOjb==undefined)
        content = document.getElementById("hidContent");
    else
        content = document.getElementById(strOjb);
    document.getElementById("pnlAjaxLoad").innerHTML = content.value;
    content.value = "";
}
