//目的:创建提示窗口
//参数说明:提示内容
function sAlert(str){
			var msgw,msgh,bordercolor;
			msgw=0;//提示窗口的宽度
			msgh=0;//提示窗口的高度
			titleheight=25 //提示窗口标题高度
			bordercolor="#FFFFFF";//提示窗口的边框颜色
			titlecolor="#99CCFF";//提示窗口的标题颜色
			//创建覆盖页面的层
			var sWidth,sHeight;
			sWidth=window.parent.document.body.offsetWidth;
			sHeight=getPageSize();
			var bgObj=window.parent.document.createElement("div");
			bgObj.setAttribute('id','bgDiv');
			bgObj.style.position="absolute";
			bgObj.style.top="0";
			bgObj.style.background="#808080";
			bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=2,opacity=75,finishOpacity=50)";
			bgObj.style.opacity="0.6";
			bgObj.style.left="0";
			bgObj.style.width=sWidth + "px";
			bgObj.style.height=sHeight + "px";
			bgObj.style.zIndex = "10000";
			window.parent.document.body.appendChild(bgObj);
			//创建消息的层,覆盖在bgObj上面
			var msgObj=window.parent.document.createElement("div")
			msgObj.setAttribute("id","msgDiv");
			msgObj.setAttribute("align","center");
			//msgObj.style.background="red";
			//msgObj.style.border="1px solid " + bordercolor;
	     	msgObj.style.position = "absolute";
               msgObj.style.left = "55%";
               msgObj.style.top = "40%";
               msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
               msgObj.style.marginLeft = "-225px" ;
               msgObj.style.marginTop = -75+window.parent.document.documentElement.scrollTop+"px";
               msgObj.style.width = msgw + "px";
               msgObj.style.height =msgh + "px";
               msgObj.style.textAlign = "center";
               msgObj.style.lineHeight ="0px";
               msgObj.style.zIndex = "10001";
               /* 添加关闭按钮 *  */
		     var title=document.createElement("h4");
		     title.setAttribute("id","msgTitle");
		     title.setAttribute("align","center");
		     title.style.margin="0 0 -12px 360px";
		     title.style.padding="3px 0 0px 0";
		     title.style.background='';
		     title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
		     title.style.opacity="0.75";
    		     title.style.border="0px solid " + bordercolor;
    		     title.style.background=bordercolor;
		     title.style.height="18px";
		     title.style.width="40px";
		     title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
		     title.style.color="black";
		     title.style.cursor="pointer";
		     title.innerHTML="关闭";
		     title.onclick=function(){
		       if(confirm("尊敬的用户：您的请求已经发送，如果不需要等待结果请点击确认按钮")){
		       	document.body.removeChild(bgObj);
                 	document.getElementById("msgDiv").removeChild(title);
                 	document.body.removeChild(msgObj);
                 }
               }
              
		   window.parent.document.body.appendChild(msgObj);
		   var mObj = window.parent.document.getElementById('msgDiv');
		  	  mObj.insertBefore(title);
		   var txt=window.parent.document.createElement("p");
		   txt.style.margin="1em 0"
		   txt.setAttribute("id","msgTxt");
		   txt.style.textAlign="center";
		   if(str==undefined){
		   		str="<img src=\"/"+_PROJECT_PATH+"/webapp/images/loading.gif\" align=\"absmiddle\">";
		   }
		   txt.innerHTML=str;
             window.parent.document.getElementById("msgDiv").appendChild(txt);
}
//目的:关闭提示窗口
//参数说明:
function close() {
 		   if(window.parent.document.getElementById('bgDiv') != null)
 		   	 window.parent.document.body.removeChild(window.parent.document.getElementById('bgDiv'));
             if(window.parent.document.getElementById('msgDiv') != null)
           	window.parent.document.body.removeChild(window.parent.document.getElementById('msgDiv'));
}

function error(response) {
		   //alert(response);
 		   if(window.parent.document.body.getAttribute('bgDiv') != 'null')
 		   	window.parent.document.body.removeChild($('bgDiv'));
           //window.parent.document.getElementById("msgDiv").removeChild($('msgTitle'));
             if(window.parent.document.body.getAttribute('msgDiv') != 'null')
           	window.parent.document.body.removeChild($('msgDiv'));
}

function getPageScroll(){ 
  var yScroll; 
  if (self.pageYOffset) { 
    yScroll = self.pageYOffset; 
  } else if (window.parent.document.documentElement && window.parent.document.documentElement.scrollTop){   // Explorer 6 Strict 
    yScroll = window.parent.document.documentElement.scrollTop; 
  } else if (window.parent.document.body) {// all other Explorers 
    yScroll = window.parent.document.body.scrollTop; 
  } 
  arrayPageScroll = new Array('',yScroll)  
  return arrayPageScroll; 
} 

//目的:获取页面高度
//参数说明:
function getPageSize(){   
  var xScroll, yScroll;   
  if (window.innerHeight && window.scrollMaxY) {   
    xScroll = window.parent.document.body.scrollWidth; 
    yScroll = window.innerHeight + window.scrollMaxY; 
  } else if (window.parent.document.body.scrollHeight > window.parent.document.body.offsetHeight){ // all but Explorer Mac 
    xScroll = window.parent.document.body.scrollWidth; 
    yScroll = window.parent.document.body.scrollHeight; 
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 
    xScroll = window.parent.document.body.offsetWidth; 
    yScroll = window.parent.document.body.offsetHeight; 
  } 
  var windowWidth, windowHeight; 
  if (self.innerHeight) {  // all except Explorer 
    windowWidth = self.innerWidth; 
    windowHeight = self.innerHeight; 
  } else if (window.parent.document.documentElement && window.parent.document.documentElement.clientHeight) { // Explorer 6 Strict Mode 
    windowWidth = window.parent.document.documentElement.clientWidth; 
    windowHeight = window.parent.document.documentElement.clientHeight; 
  } else if (window.parent.document.body) { // other Explorers 
    windowWidth = window.parent.document.body.clientWidth; 
    windowHeight = window.parent.document.body.clientHeight; 
  }
  // for small pages with total height less then height of the viewport 
  if(yScroll < windowHeight){ 
    pageHeight = windowHeight; 
  } else {  
    pageHeight = yScroll; 
  } 
  if(xScroll < windowWidth){   
    pageWidth = windowWidth; 
  } else { 
    pageWidth = xScroll; 
  } 
  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);  
  return pageHeight; 
}

