
function __Screen(){}
__Screen.show=function (){

	var GrayScreen=document.createElement("div");
    GrayScreen.id="QToolScreenID";//_id
    with(GrayScreen.style)
    {
        position="absolute";
        top="0px";
        background="#777";
        filter="progid:DXImageTransform.Microsoft.Alpha(opacity=45)";
        opacity="0.6";
        left="0px";
        width="100%";
        height=document.documentElement.scrollHeight+"px";   
        zIndex = "10000";
    }
    document.body.appendChild(GrayScreen);
}
__Screen.hide=function (){
	var GrayScreen=__$("QToolScreenID");
    if(GrayScreen)
    {
        document.body.removeChild(GrayScreen);
        delete GrayScreen;
        GrayScreen=null;
    }
}

function __LoadingDialog() {}
__LoadingDialog.show=function (title) {
    __Screen.show();
    
    var strHTML="<table width=100% cellspacing=0 cellpadding=0 bgcolor=#f1f1e1 >";
    strHTML+="<tr><td height=10></td></tr>";
    strHTML+="<tr><td height=25 style='background-color:white;border-top:solid 1px gray;border-bottom:solid 1px gray;'><table height=100% ><tr><td width=20></td><td><img src='imgs/T_D.jpg'></td><td>"+title+"</td></tr></table></td></tr>"
    strHTML+="<tr><td align=center valign=middle height=100><img src='imgs/smallloading.gif'></td></tr>";
    strHTML+="<tr><td ></td></tr>";
    strHTML+="</table>";
        
    var dvLoading=document.createElement("DIV");
    dvLoading.id="QToolLoadingID";
    document.body.appendChild(dvLoading);
        
    dvLoading.innerHTML=strHTML;
    with(dvLoading.style)
    {
        position="absolute";
        zIndex="10001";
        width="450px";
        height="150px";
        border="solid 2px white";
        backgroundColor="#f1f1e1";  
        visibility="visible";
        

    }
    __setPosAtCenter("QToolLoadingID");
    
    __addEvent("resize",__AdjustLoadingDialogPos);
    __addEvent("scroll",__AdjustLoadingDialogPos);
}
__LoadingDialog.hide=function () {
    var dvLoading=__$("QToolLoadingID");
    if(dvLoading)
    {
        document.body.removeChild(dvLoading);
        delete dvLoading;
        dvLoading=null;
    }
    __Screen.hide();
}

function __AdjustLoadingDialogPos()
{
    __setPosAtCenter("QToolLoadingID");
}



function __Point(_left,_top) {this.Left=_left;this.Top=_top;}

function __Rect( _left, _top, _width, _height) {this.Left=_left;this.Top=_top;this.Width=_width;this.Height=_height;}
__Rect.prototype.PtInRect=function(pt) {
    return (pt.Left<=this.Width+this.Left && pt.Left>=this.Left && pt.Top>=this.Top && pt.Top<=this.Top+this.Height) ;
}

function __addEvent(_event,proc)
{
    if(window.attachEvent) window.attachEvent("on"+_event,proc);
    else window.addEventListener(_event,proc,false);
}


function __toURL(_url) { var dt=new Date();window.location=_url+"&tms="+dt.valueOf(); }
function __openW(_url,_left,_top,_width,_height) { window.open(_url,"_blank","left="+_left+",top="+_top+",width="+_width+",height="+_height); }
function __closeW(_objWindow) { window.close(); }

function __trim(str) { return str.replace(/^\s*(.*?)\s+$/,"$1");} 
function __isEmail(str) {
    var reg=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    return reg.test(str);
}

function __$(domid) {return document.getElementById(domid);}

function __setLeft (domid,_left) 
{
	var obj=__$(domid);
	if(obj) { obj.style.left=_left+"px"; }
}
function __$left(domid)
{
	var obj=__$(domid);
	if(obj) return obj.offsetLeft;	
	else return null;	
}

function __setTop(domid,_top)
{
	var obj=__$(domid);
	if(obj) { obj.style.top=_top+"px"; }
}
function __$top(domid)
{
	var obj=__$(domid);
	if(obj) return obj.offsetTop;
	else return null;
}

function __setWidth(domid,_width)
{
	var obj=__$(domid);
	if(obj) { obj.style.width=_width+"px"; }
}
function __$width(domid)
{
	var obj=__$(domid);
	if(obj) { return obj.offsetWidth; }
	else return null;
}

function __setHeight(domid,_height)
{
	var obj=__$(domid);
	if(obj) { obj.style.height=_height+"px"; }
}
function __$height(domid)
{
	var obj=__$(domid);
	if(obj) return obj.offsetHeight;
	else return null;
}

function __setZIndex(domid,_zIndex)
{
	var obj=__$(domid);
	if(obj) { obj.style.zIndex=_zIndex; }
}

function __setLocation(domid,_zIndex,_left,_top,_width,_height)
{
	var obj=__$(domid);
	if(obj) 
	{ 
	    obj.style.position="absolute";
		obj.style.zIndex=_zIndex;
		obj.style.left=_left+"px";
		obj.style.top=_top+"px";
		obj.style.width=_width+"px";
		obj.style.height=_height+"px";
	}
}

function __setPosition(domid,_left,_top,_width,_height)
{
	var obj=__$(domid);
	if(obj) 
	{ 
		obj.style.left=_left;
		obj.style.top=_top;
		obj.style.width=_width;
		obj.style.height=_height;
	}
}
function __clientWidth() {return document.documentElement.clientWidth;}
function __clientHeight() {return document.documentElement.clientHeight;}
function __setPosAtCenter(domid)
{
    var div=__$(domid);
    if(div && div.style.visibility=="visible")
    {
        div.style.left=Math.round((__clientWidth()-div.offsetWidth)/2)+"px";
        div.style.top=Math.round((__clientHeight()-div.offsetHeight)/2+document.documentElement.scrollTop)+"px";
    }
}

function __setVisible(domid,_isVisible)
{
	var obj=__$(domid);
	if(obj) 
	{
		if(_isVisible)
			obj.style.visibility="visible";
		else
			obj.style.visibility="hidden";
	}
}
/*_display: inline block none*/
function __setDisplay(domid,_displaytype) 
{
	var obj=__$(domid);
	if(obj)
	{
		obj.style.display=_displaytype;
	}
}

function __$TextValue(domid)
{
	var obj=__$(domid);
	if(obj)
		return obj.value;
	else 
		return null;
}
function __setTextValue(domid,_value)
{
	var obj=__$(domid);
	if(obj)
		obj.value=_value;
}

function __copyToClipboard(str)
{
    window.clipboardData.setData("text",str);
}

function __BrowserType()
{
	return navigator.appName;	
}

function __isIE()
{
	return (__BrowserType()=="Microsoft Internet Explorer");
}



function __AjaxTimeOut(seconds) {if(AjaxPro) AjaxPro.timeoutPeriod=seconds*1000;}
function __AjaxTimeOutDefault() {if(AjaxPro) AjaxPro.timeoutPeriod=50*1000;}




