// JavaScript Document
var PromptMaskName="PromptMask";
function Prompt_Mask(){

	var arrayPageSize   = getPageSize();
	var arrayPageScroll = getPageScroll();
	var maskObj = document.createElement("div");
	maskObj.setAttribute("id",PromptMaskName);
	maskObj.style.position = "absolute";
	maskObj.style.top = "0";
	maskObj.style.left = "0";
	maskObj.style.filter = "Alpha(opacity=30);";
	maskObj.style.opacity = "0.3";
	maskObj.style.width = "100%";
	maskObj.style.height = (arrayPageSize[1]+35+"px");
	maskObj.style.background="#999999";
	maskObj.style.zindex="999";
	document.body.appendChild(maskObj);
}

function Prompt_Mask_Close(){
	var MaskObj=document.getElementById(PromptMaskName);
	if(MaskObj!=null){
		MaskObj.innerHTML="";
		MaskObj.style.display="none";
		MaskObj.parentNode.removeChild(MaskObj);
	}
}

function Prompt_Page(_pageName,_className,_content){
		var pageObj = document.createElement("div");
		pageObj.setAttribute("id",_pageName);
		if(_className!=null&&_className!=""){
			pageObj.className=_className;
		}
		document.body.appendChild(pageObj);
		pageObj.innerHTML=_content;
}

function Prompt_Page_Close(_pageName){
	var pageObj=document.getElementById(_pageName);
	if(pageObj!=null){
		pageObj.innerHTML="";
		pageObj.style.display="none";
		pageObj.parentNode.removeChild(pageObj);
	}
}

function Prompt_Combo(_comboName,_className,_width,_height,_left,_top,_content){
		Pop_Combo_Close(_comboName);
		var comboObj = document.createElement("div");
		comboObj.setAttribute("id",_comboName);
		if(_className!=null&&_className!=""){
			comboObj.className=_className;
		}

		if(_left!=0){
			comboObj.style.left=_left+"px";
		}
		if(_top!=0){
			comboObj.style.top=_top+"px";
		}


		if(_width!=0){
			comboObj.style.width=_width+"px";
		}
		if(_height!=0){
			comboObj.style.height=_height+"px";
		}

		document.body.appendChild(comboObj);
		comboObj.innerHTML=_content;
}

function Prompt_Combo_Close(_comboName){
	var comboObj=document.getElementById(_comboName);
	if(comboObj!=null){
		comboObj.innerHTML="";
		comboObj.style.display="none";
		comboObj.parentNode.removeChild(comboObj);
	}
}


function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {
		yScroll = document.body.scrollTop;
	}
	
	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}

function getPageSize(){
	var xScroll,yScroll;
	
	if (window.innerHeight && window.scrollMaxY){
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		sScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth,windowHeight;

	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	
	var pageWidth,pageHeight
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	if(xScroll < windowWidth) {
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function PageCenter(pageObj){
	var arrayPageSize   = getPageSize();
	var arrayPageScroll = getPageScroll();
	pageObj.style.top  = arrayPageScroll[1] + (arrayPageSize[3] - pageObj.offsetHeight) / 2-50 + "px";
	pageObj.style.left = ((arrayPageSize[2] - pageObj.offsetWidth) / 2 -30) + "px";
}

function PageLeftTop(pageObj){
	var arrayPageSize   = getPageSize();
	var arrayPageScroll = getPageScroll();
	pageObj.style.top  = 0;
	pageObj.style.left = 0;
}

function PageRightTop(pageObj){
	var arrayPageSize   = getPageSize();
	var arrayPageScroll = getPageScroll();
	pageObj.style.top  = 0;
	pageObj.style.left = (arrayPageSize[2] - pageObj.offsetWidth)+"px";
}

function PageLeftBottom(pageObj){
	var arrayPageSize   = getPageSize();
	var arrayPageScroll = getPageScroll();
	pageObj.style.top  = (arrayPageSize[3] - pageObj.offsetHeight)+"px";
	pageObj.style.left = 0;
}

function PageRightBottom(pageObj){
	var arrayPageSize   = getPageSize();
	var arrayPageScroll = getPageScroll();
	pageObj.style.top  = (arrayPageSize[3] - pageObj.offsetHeight)+"px";
	pageObj.style.left = (arrayPageSize[2] - pageObj.offsetWidth)+"px";
}
