﻿StringBuilder = function()
{
 this.aStr = new Array();
 this.add = function( inVAL )
 {
  this.aStr[this.aStr.length] = inVAL;
 }
 this.build = function()
 {
  return this.aStr.join("");
 }
 this.init = function()
 {
  this.aStr = null;
  this.aStr = new Array();
 }
}



function popup_open(strUrl,strTitle,intWidth,intHeight)
{
         var intTop,intLeft;
                            
         intTop = (window.screen.height - intHeight)/2;
         intLeft = (window.screen.width - intWidth)/2;
         window.open(strUrl,strTitle,'height='+intHeight+',width='+intWidth+',resizable=no,toolbar=no,status=no,scrollbars=no,dependent=no,left=' + intLeft + ',top=' + intTop );
}


function FindPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}

function FindPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


function HideDIV() {
  var i, args, theObj;
  args = HideDIV.arguments;
   for (i=0; i<(args.length); i+=1) {
      theObj = document.getElementById(args[i]);
      theObj.style.visibility='hidden';
      theObj.style.display ='none';
   }
}

function ShowDIV() {
  var i, args, theObj;
   args = ShowDIV.arguments;
   for (i=0; i<(args.length); i+=1) {
      theObj = document.getElementById(args[i]);
      theObj.style.visibility='visible';
      theObj.style.display='inline';
   }
}

function GetXmlHttpObject(handler)
{ 
    var objXmlHttp = null;
    if (!window.XMLHttpRequest)
    {
        // Microsoft
        objXmlHttp = GetMSXmlHttp();
        if (objXmlHttp != null)
        {
            objXmlHttp.onreadystatechange = handler;
        }
    } 
    else
    {
        // Mozilla | Netscape | Safari | IE 7
        objXmlHttp = new XMLHttpRequest();
        if (objXmlHttp != null)
        {
            objXmlHttp.onload = handler;
            objXmlHttp.onerror = handler;
            objXmlHttp.onreadystatechange = handler;
        }
    } 
    return objXmlHttp; 
} 

function GetMSXmlHttp() {
    var xmlHttp = null;
    var clsids = ["Msxml2.XMLHTTP.6.0",
                  "Msxml2.XMLHTTP.4.0",
                  "Msxml2.XMLHTTP.3.0"];
    for(var i=0; i<clsids.length && xmlHttp == null; i++) {
        xmlHttp = CreateXmlHttp(clsids[i]);
    }
    return xmlHttp;
}

function CreateXmlHttp(clsid) {
    var xmlHttp = null;
    try {
        xmlHttp = new ActiveXObject(clsid);
        lastclsid = clsid;
        return xmlHttp;
    }
    catch(e) {}
}

function SendXmlHttpRequest(xmlhttp, url) { 
    xmlhttp.open('GET', url, true); 
    xmlhttp.send(null); 
}

