/*
Writen by: Phillip (OnSite Computer Services)
Email: phil@osComputerServices.ca

Use this to learn, don't jack my code sucka
*/

function AJAXClass() { }

AJAXClass.prototype.xmlhttp = false;
AJAXClass.prototype.httpCheckString = '';
AJAXClass.prototype.httpReturnData = '';
AJAXClass.prototype.httpReturnFunction = '';

AJAXClass.prototype.createRequestObject = function()
{
	var xmlhttp;
	try { xmlhttp = new ActiveXObject("Msxml2.XMLHttp"); }
	catch(e) {
		try { xmlhttp = new ActiveXObject("Microsoft.XMLHttp"); }
		catch(e2){ }
		}
	if(xmlhttp == undefined && (typeof XMLHttpRequest != 'undefined')) { xmlhttp = new XMLHttpRequest(); }
	return xmlhttp;
}

AJAXClass.prototype.GetRemoteData = function(urlRequestType,urlObj,urlPostData)
{
	var _this = this;
	if (this.xmlhttp == false) { this.xmlhttp = this.createRequestObject(); }
	this.httpReturnData = '';
	if (urlRequestType == 'post')
		{
    	this.xmlhttp.open('post',urlObj);
    	this.xmlhttp.onreadystatechange = function(){_this.handleResponse()};
		this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		this.xmlhttp.send(urlPostData);
		}
	else
		{
	    this.xmlhttp.open('get', urlObj);
    	this.xmlhttp.onreadystatechange = function(){_this.handleResponse()};
	    this.xmlhttp.send(null);
		}
}

AJAXClass.prototype.handleResponse = function()
{
if(this.xmlhttp.readyState == 4)
	{
	var response = this.xmlhttp.responseText;
    if(response.indexOf(this.httpCheckString != -1))
		{
		//alert(response);
		delete this.xmlhttp;
		this.httpReturnData = response;
		eval(this.httpReturnFunction);
		}
    }
}
//Other functions used in this web page

var nPosY;
var nPosX;

function ShowElement(ObjElm,PosX,PosY)
{
	if (PosY != '' && PosX != '') { ObjElm.style.top = PosY; ObjElm.style.left = PosX; }
	ObjElm.style.display = 'block';
	ObjElm.style.visibility = 'visible';
}
function HideElement(ObjElm)
{
	ObjElm.style.display = 'none';
	ObjElm.style.visibility = 'hidden';
}
function findPosition( oLink )
	{
	if( oLink.offsetParent )
		{
	    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent )
			{
		    posX += oLink.offsetLeft;
	      	posY += oLink.offsetTop;
    		}
		nPosY = posY;
		nPosX = posX;
  } else {
	nPosY = oLink.y;
	nPosX = oLink.x;
  	}
}
function isEmpty(str)
	{
    if ((str == null) || (str.length == 0)) { return true; }
    else { return false; }
	}
function isEmail(str)
	{
	if ((str == null) || (str.length == 0) || (str.indexOf("@")) == -1 || (str.indexOf(".")) == -1) { return true; }
    else { return false; }
	}



