
/**


javascript utilities package

created by: iancoyle.com

version: alpha

last modifed date: 7.19.2006






METHODS:
ScreenControl
	.resolution()
	.resolutionY()
	.resolutionX()
	
	.availSize()
	.availSizeY()
	.availSizeX()

	.viewport()
	.viewportY()
	.viewportX()

	.scrollOffset()
	.scrollOffsetY()
	.scrollOffsetX()



BrowserControl
	.OS()
	.UA()

DateControl
	.returnDate("today")
	.returnDate("time")
	.returnDate("now")

FlashControl
	.flashVersion()
	.detectFlash(<version>)
	

XMLControl
	.Query()
	.getElementTextNS()

TrackerCOntrol
	.Track(id:Number,alertValue:Boolean)

FormControl
	.focusElement(path:Object,str:String)
	.blurElement(path:Object,str:String)


Tween Engine:
var Tween = new JSTween()
	Tween.Move(top,left)
	Tween.Resize(height,width)


*/


/** 

	BrowserController 
	(alpha)

	last modified date: 7.18.2006
	
	by Ian Coyle (iancoyle.com)
*/

BrowserController = function(){}
BrowserController.prototype.DOMLevel = function(){
	var dlevel = 0;
	if (document.getElementById) dlevel++;
	if (document.createElement) dlevel++;
	
	return (dlevel) ;
}
BrowserController.prototype.DOMMode = function(){
	var dmode = "quirks";
	if (document.documentElement.clientHeight);
	return (dmode) ;
}
BrowserController.prototype.OS = function(){
	var rOS = "UNKN";
	var UA = navigator.userAgent;
	if (UA.toLowerCase().indexOf("linux")) rOS = "Linux";
	if (UA.toLowerCase().indexOf("x11")) rOS = "Unix";
	if (UA.toLowerCase().indexOf("mac")) rOS = "Mac";
	if (UA.toLowerCase().indexOf("win")) rOS = "Windows";
	return (rOS);
}

BrowserController.prototype.UA = function(){
	return (navigator.userAgent);
}

BrowserController.prototype.BroswerName=function(){
	var ua = navigator.userAgent;
	if (ua.toLowerCase().indexOf("opera")>-1) return ("Opera");
	if (ua.toLowerCase().indexOf("msie")>-1) return ("Internet Explorer");
	if (ua.toLowerCase().indexOf("firefox")>-1) return ("Firefox");
	if (ua.toLowerCase().indexOf("safari")>-1) return ("Safari");
	if (ua.toLowerCase().indexOf("netscape")>-1) return ("Netscape");
	if (ua.toLowerCase().indexOf("flock")>-1) return ("Flock");
	if (ua.toLowerCase().indexOf("camino")>-1) return ("camino");
	return ("UNKN");
	
}
BrowserController.prototype.BroswerVersion=function(){
	switch (this.BroswerName()){
		case "Internet Explorer":
		
		break;
		case "FireFox":
			
		break;
		case "Safari":
		
		break;
		case "Opera":
		
		break;
		case "Flock":
		
		break;
		case "Camino":
		
		break;
		case "Netscape":
			
		break;
		default:
		break;
	}
}
var BrowserControl = new BrowserController();



var CornerController = function(cname,t,r,b,l){
	this.topCorner = t
	this.leftCorner = l
	this.bottomCorner = b
	this.rightCorner = r
	this.cornerClass=cname
}
CornerController.prototype.initCorners=function(cname,t,r,b,l){
	this.topCorner = t
	this.leftCorner = l
	this.bottomCorner = b
	this.rightCorner = r
	this.cornerClass=cname
	//alert(this.topCorner)
}
CornerController.prototype.drawCorners=function(){
	var corners = 	getElementsByClassName(this.cornerClass)
	//alert(this.cornerClass)
	for (var ele in corners){
		
		var thisElement = corners[ele]
		//alert(thisElement)
		var div = document.createElement('div')
		div.innerHTML = '<img src="' + this.topCorner + '" style="position:absolute;top:0;left:0" />'
		div.innerHTML += '<img src="' + this.rightCorner + '" style="position:absolute;top:0;right:0" />'
		div.innerHTML += '<img src="' + this.bottomCorner + '" style="position:absolute;bottom:0;right:0" />'
		div.innerHTML += '<img src="' + this.leftCorner + '" style="position:absolute;bottom:0;left:0" />'
		
		//if (thisElement.style.position != 'absolute') thisElement.style.position='relative'
		
		thisElement.appendChild(div)
		
	}
}
CornerController.prototype.drawCorner=function(ele,typ){
	
}
function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        //if (arrClass[m] == arrObjClass[k]) c++;
        if (arrObjClass[k].indexOf(arrClass[m])>-1) c++;
        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}


/** 
	date control 
	(alpha)
	
	last modified date: 7.18.2006
	
	by Ian Coyle (iancoyle.com)
*/
DateController = function(){
	this.myDate = new Date();
}
DateController.prototype.returnDate = function(dateFormat){
	switch (dateFormat){
		
		case "today":
			return ( this.myDate.getFullYear() + "-" + this.myDate.getMonth() + "-" + this.myDate.getDate() );
		break;
		case "time":
			return (this.myDate.getHours() + ":" + this.myDate.getMinutes() + ":" + this.myDate.getSeconds() );
		break;
		case "now":
		default:
			return ( this.myDate.getFullYear() + "-" + this.myDate.getMonth() + "-" + this.myDate.getDate() + " " + this.myDate.getHours() + ":" + this.myDate.getMinutes() + ":" + this.myDate.getSeconds() );
		break;
	
	}
	
}

var DateControl = new DateController();



/** 
	SWFController 
	(alpha)

	last modified date: 6.26.2006
	
	by Ian Coyle (iancoyle.com)


*/

FlashController = function(){
	this.setDebugMode(false)
}

FlashController.prototype.flashVersion = function(){
	return ( this.checkFlash("version") );
}

FlashController.prototype.detectFlash = function(ver){
	return ( this.checkFlash(ver) );
}

FlashController.prototype.createSWFObject = function(swfPath,swfAttributes,divID,detectionAttributes){
	var detectionNumber = 0
	var detectedNumber = 0
	var errors = new Array()
	var _err = ""
	if (detectionAttributes.detectFlash==true){
		detectionNumber++
		if (this.detectFlash(detectionAttributes.flashVersion)){
			detectedNumber++
		}else{
			errors.push("invalidFlash")
			if (_err=="") _err = "invalidFlash"
			
		}
	}
	
	if (detectionAttributes.detectResolution==true){
		if (detectionAttributes.resolutionY!=undefined){
			detectionNumber++
			if (ScreenControl.resolutionY() >= detectionAttributes.resolutionY){
				detectedNumber++
			}else{
				errors.push("invalidResolutionY")
				if (_err=="") _err = "invalidResolution"
			}
		}
		if (detectionAttributes.resolutionX!=undefined){
			detectionNumber++
			if (ScreenControl.resolutionX() >= detectionAttributes.resolutionX){
				detectedNumber++
			}else{
				errors.push("invalidResolutionX")
				if (_err=="") _err = "invalidResolution"
			}
		}
	}
	
	if (detectionAttributes.detectViewport==true){
		if (detectionAttributes.viewportY!=undefined){
			detectionNumber++
			if (ScreenControl.viewportY() >= detectionAttributes.viewportY){
				detectedNumber++
			}else{
				errors.push("invalidViewportY")
				if (_err=="") _err = "invalidViewport"
			}
		}
		if (detectionAttributes.viewportX!=undefined){
			detectionNumber++
			if (ScreenControl.viewportX() >= detectionAttributes.viewportX){
				detectedNumber++
			}else{
				errors.push("invalidViewportX")
				if (_err=="") _err = "invalidViewport"
			}
		}
	}
	
	
	//alert(detectionNumber + " | " + detectedNumber)
	if (detectionNumber==detectedNumber){
		
		this.outputSWF(swfPath,swfAttributes,divID)
	}else{
		//alert(detectionAttributes.onError)
		detectionAttributes.onError(_err,errors)
	}
	
}

FlashController.prototype.setVar = function(varname,val){
	this._FlashVars[varname] = val;
}

FlashController.prototype.setProperty = function(ver){
	
}
FlashController.prototype.setDebugMode = function(val){
	this._DebugMode = val
}




/**
	WORKER METHODS
	do not call
*/

FlashController.prototype.outputSWF = function(swfPath,swfAttributes,divID)
{
	var flashDIV = document.getElementById(divID);
	
	
	var _objectHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"'
	var _paramHTML = ""
	var _embedHTML = '<embed '
							
	
	for (var attrib in swfAttributes){
		switch (attrib){
			case "id":
				_objectHTML+= ' ' + attrib + '="' + swfAttributes[attrib] + '" ';
				_embedHTML+= ' name="' + swfAttributes[attrib] + '" ';
			break;
			case "width":
			case "height":
				_objectHTML+= ' ' + attrib + '="' + swfAttributes[attrib] + '" ';
				_embedHTML+= ' ' + attrib + '="' + swfAttributes[attrib] + '" ';
			break;
			default:
				_paramHTML+='<param name="' + attrib + '" value="' + swfAttributes[attrib] + '" />';
				_embedHTML+= ' ' + attrib + '="' + swfAttributes[attrib] + '" ';
			break;
		}
	}
	_paramHTML+='<param name="movie" value="' + swfPath + '" />';
	_embedHTML+= ' src="' + swfPath + '"></embed>';
	_objectHTML +='>'
	
	var _html_ = _objectHTML + _paramHTML + _embedHTML + '</object>'
	if(this._DebugMode){
		alert(_html_)
	}
	flashDIV.innerHTML=_html_;
}

FlashController.prototype.checkFlash = function(ver)
{
		
	
		var myflashversion =0;
		var vNumber;
		var MM_contentVersion = ver;
		
		var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

		if ( plugin ) {

					var words = navigator.plugins["Shockwave Flash"].description.split(" ");
					for (var i = 0; i < words.length; ++i)
					{
					if (isNaN(parseInt(words[i])))
					continue;
					var MM_PluginVersion = words[i]; 
					}
					vNumber = MM_PluginVersion;
					var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
			
			}
			else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {

				try
				{
					var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash")
					vNumber =  parseInt(flash.GetVariable("$version").split(",")[0].split(" ")[1]);
					
				}
				catch(e)
				{
					vNumber=0;
				}
			
				if (vNumber >=MM_contentVersion){
					MM_FlashCanPlay=true
				}

				
				
			}

		var returnVar;
		switch (ver){
			case "version":
				returnVar = vNumber;
			break;
			default:
				returnVar = MM_FlashCanPlay;
			break;
		}
		
		return (returnVar);

}


var FlashControl = new FlashController();










FormController = function(){}
FormController.prototype.focusElement=function(fElement,fValue){
	if (fElement.value==fValue){fElement.value=""}
}
FormController.prototype.blurElement=function(fElement,fValue){
	if (fElement.value==""){fElement.value=fValue}
}
var FormControl = new FormController()


/**
	JSTween
	beta
	by Ian Coyle (iancoyle.com)
	
	// version notes:
	// uses setTimeout instead of setInterval
	
	// to do:
	// 
*/


JSTween = function(nm,id,s)
{	
	this.isActive=false;
	this.myName=nm;
	this.speed=s;
	this.myID = id;
	this.myResizeInterval;
	this.myMoveInterval;
	this.Path = document.getElementById(this.myID);
	this._resizeTimeout = null;
	this._moveTimeout = null;
	this.tH = 0;
	this.tW = 0;
	this.tT = 0;
	this.tL = 0;

}

JSTween.prototype._resize = function()
{
	var newH = this.tH;
	var tmpH = parseInt(this.Path.style.height) - ((parseInt(this.Path.style.height)-newH)/this.speed)

	var newW = this.tW;
	var tmpW = parseInt(this.Path.style.width) - ((parseInt(this.Path.style.width)-newW)/this.speed)
	this.Path.style.height= Math.round(tmpH) + "px"
	this.Path.style.width= Math.round(tmpW) + "px"
	if ( (Math.abs(tmpH-newH)<4)  && (Math.abs(tmpW-newW)<4) ){
		this.Path.style.height=newH + "px";
		this.Path.style.width=newW + "px";
		//this.isSizing=false;
	}else{
		this._resizeTimeout = setTimeout(this.myName+"._resize()",25);
		
		
	}
	
	
	
}

JSTween.prototype.Resize = function(nH,nW)
{

	this.tH = nH;
	this.tW = nW;
	this.Release("Resize")
	this._resizeTimeout = setTimeout(this.myName+"._resize()",30);
	
}

JSTween.prototype.Move = function(nT,nL)
{
	this.tT = nT;
	this.tL = nL;
	this.Release("Move")
	//this._moveTimeout = setTimeout(this.myName+"._move()",30);
	var tmpMoveTimout = setTimeout(this.myName+"._move()",30);
}



JSTween.prototype._move = function()
{
	
	var newT = this.tT;
	var tmpT = parseInt(this.Path.style.top) - ((parseInt(this.Path.style.top)-newT)/this.speed)

	var newL = this.tL;
	var tmpL = parseInt(this.Path.style.left) - ((parseInt(this.Path.style.left)-newL)/this.speed)
	

	this.Path.style.top=(tmpT>parseInt(this.Path.style.top))? Math.ceil(tmpT) + "px" :  Math.floor(tmpT) + "px" 
	this.Path.style.left=(tmpL>parseInt(this.Path.style.left))? Math.ceil(tmpL) + "px" :  Math.floor(tmpL) + "px" 

	if ( (Math.abs(tmpT-newT)<1)  && (Math.abs(tmpL-newL)<1) ){
		this.Path.style.top=newT + "px";
		this.Path.style.left=newL + "px";
		//this.isMoving = false
		
	}else{
		
		this._moveTimeout =	setTimeout(this.myName+"._move()",25);
		
	}
}

JSTween.prototype.Release = function(prop){
	switch (prop){
		case "Move":
			clearTimeout(this._moveTimeout)
			this._moveTimeout = null;
			//delete this._moveTimeout;
		break;
		case "Resize":
			clearTimeout(this._resizeTimeout)
			this._resizeTimeout = null;
			
		break;
	}
}






LayoutController = function(){

}
LayoutController.prototype.getY = function(inputObj){
	var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
	while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
	return returnValue;
}

LayoutController.prototype.getX = function(inputObj){
	var returnValue = inputObj.offsetLeft;
	while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
	//alert(returnValue)
	return returnValue;
}

LayoutController.prototype.getCoords = function(obj){

	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	alert([curleft,curtop])
	return [curleft,curtop];

}

var LayoutControl = new LayoutController()


/** 
	ScreenController 
	v. 0.5 (alpha)
	last modified date: 7.17.2006
	by Ian Coyle (iancoyle.com)
*/

ScreenController = function(){}

ScreenController.prototype.resolution = function(){return (screen.width + "x" + screen.height);}
ScreenController.prototype.resolutionY = function(){return (screen.height);}
ScreenController.prototype.resolutionX = function(){return (screen.width);}

ScreenController.prototype.availSize = function(){return (screen.availWidth + "x" + screen.availHeight )}
ScreenController.prototype.availY = function(){return (screen.availHeight);}
ScreenController.prototype.availX = function(){return (screen.availWidth);}

ScreenController.prototype.viewportSize = function(d){
	
	
	var x,y;

	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}

	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	
	switch (d){
		case "y":
			return y;
		break;
		case "x":
			return x;
		break;
		default:
			return (x + "x" + y )
		break;
	}
}
ScreenController.prototype.viewportY = function(){return this.viewportSize("y")}
ScreenController.prototype.viewportX = function(){return this.viewportSize("x")}

ScreenController.prototype.scrollOffset = function(d){
	var x,y;
	if (self.pageYOffset) // all except Explorer
	{
		x = self.pageXOffset;
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	
	switch (d){
		case "y":
			return y;
		break;
		case "x":
			return x;
		break;
		default:
			return (x + "x" + y )
		break;
	}
}
ScreenController.prototype.scrollOffsetY = function(){return this.scrollOffset("y")}
ScreenController.prototype.scrollOffsetX = function(){return this.scrollOffset("x")}

ScreenController.prototype.pageSize =function(d){
	var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	if (test1 > test2)
	{
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else 
	{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	switch (d){
		case "y":
			return y;
		break;
		case "x":
			return x;
		break;
		default:
			return (x + "x" + y )
		break;
	}
}
ScreenController.prototype.pageSizeY=function(){return this.pageSize("y");}
ScreenController.prototype.pageSizeX=function(){return this.pageSize("x");}

/*
Nathan Kurach Addition
8/15/08
Function to determine if a users screen resolution is acceptable
*/
ScreenController.prototype.testScreen=function(X, Y){return ((this.resolutionX() >= X) && (this.resolutionY() >= Y))}


/*
Codin Pangell Addition
6-09
Function to determine if a users view port resolution is acceptable
*/
ScreenController.prototype.testScreenViewPort=function(X, Y){return ((this.viewportX() >= X) && (this.viewportY() >= Y))}



/*
Nathan Kurach Addition
8/15/08
Function to hide the invalid resolution content
*/
ScreenController.prototype.setValidContent=function(divID){
		var screenDiv = document.getElementById(divID);
		screenDiv.style.display = "none"
}

/*
Nathan Kurach Addition
8/15/08
Function to show the invalid resolution content
*/
ScreenController.prototype.setInvalidContent=function(sURL){
		/*var screenDiv = document.getElementById(sdivID);
		screenDiv.style.display = "block"
		var screenDiv = document.getElementById(fdivID);
		screenDiv.style.display = "none"
		*/
		
		location.href = sURL
}
var ScreenControl = new ScreenController();





/**
Ian Coyle
www.iancoyle.com

(alpha)

last modified date:7.18


*/

TrackerController= function(id){
	this.AcctID=0;
	this.URL = "http://tracker.iancoyle.com/track.aspx";
}
TrackerController.prototype.Track = function(id,dBug,loadWin){
	this.AcctID = id;
	
	var QVars = new Array();
	QVars["flashversion"] = FlashControl.flashVersion();
	QVars["screenresolution"] = ScreenControl.resolution();
	QVars["viewportsize"] = ScreenControl.viewportSize();
	QVars["uastring"] = BrowserControl.UA();
	QVars["sitereferrer"] = document.referrer;
	QVars["visitdate"] = DateControl.returnDate();
	QVars["accountid"] = this.AcctID;
	
	var displayString = ""
	var querystring = "";
	var count = 0;
	for (var qvar in QVars){
		querystring += (count>0) ? "&" + qvar + "=" + QVars[qvar] : "?" + qvar + "=" + QVars[qvar];
		displayString += qvar + ": " + QVars[qvar]+"\r\n";
		count++;
	}
	if (dBug) alert(displayString);
	//alert(querystring)
	if (loadWin) location.href=this.URL + querystring;
	
	processRequest=function(){
		if (XMLControl.querySuccess("track_result")){
		    var items = XMLControl._XMLREQ["track_result"].responseXML.getElementsByTagName("interfacedata");
		    for (var i = 0; i < items.length; i++) {
		        alert(XMLControl.getElementTextNS("", "results", items[i], 0));
		    }
		    document.getElementById("details").innerHTML = "";
		}else{
			
		}
	}

	
	//XMLControl.Query("track_result",this.URL + querystring,processRequest);
	//note: use imagebug because XMLHttp cannot load crossdomain...
	
	var hiddenImage = new Image();
	hiddenImage.src = this.URL + querystring;
	
}

var TrackerControl = new TrackerController();


/**
Ian Coyle
www.iancoyle.com

(alpha)

last modified date: 7.18

*/

XMLController = function(){
	this.isIE = false;
	this._XMLREQ=new Array();
}

XMLController.prototype.Query=function(nm,url,callbackfunction,vars) {
	try {
	
	this.loadXMLDoc(nm,url,callbackfunction,vars);
		
	}
	catch(e) {
		var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
		alert("Unable to get XML data:\n" + msg);
		return;
	}
}

XMLController.prototype.loadXMLDoc=function (nm,url,CBfunc,vars) {
    // branch for native XMLHttpRequest object
	if (vars != undefined){
		for (var v in vars){
			//alert(v + " : " + vars[v])
			CBfunc[v] = vars[v]
		}
	}
	
    if (window.XMLHttpRequest) {
		this._XMLREQ[nm] = new XMLHttpRequest();
		this._XMLREQ[nm].onreadystatechange = CBfunc;
        this._XMLREQ[nm].open("GET", url, true);
        this._XMLREQ[nm].send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
       this.isIE = true;
       this._XMLREQ[nm] = new ActiveXObject("Microsoft.XMLHTTP");
        if (this._XMLREQ[nm]) {
			this._XMLREQ[nm].onreadystatechange = CBfunc;
            this._XMLREQ[nm].open("GET", url, true);
            this._XMLREQ[nm].send();
        }
    }
}


// retrieve text of an XML document element, including
// elements using namespaces
XMLController.prototype.getElementTextNS=function(prefix, local, parentElem, index) {
    var result = "";
    if (prefix && this.isIE) {
        // IE/Windows way of handling namespaces
        result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
    } else {
        // the namespace versions of this method 
        // (getElementsByTagNameNS()) operate
        // differently in Safari and Mozilla, but both
        // return value with just local name, provided 
        // there aren't conflicts with non-namespace element
        // names
        result = parentElem.getElementsByTagName(local)[index];
    }
    if (result) {
        // get text, accounting for possible
        // whitespace (carriage return) text nodes 
        if (result.childNodes.length > 1) {
		try
		{
			return result.childNodes[1].nodeValue;
		}
		catch(err)
		{
			return("")
		}
            
        } else {
		try
		{
           		 return result.firstChild.nodeValue;
		} 
		catch(err)
		{
			return("")
		}   		
        }
    } else {
        return "n/a";
    }
}

XMLController.prototype.querySuccess=function(nm) {
	var qS=this.queryStatus(nm)
	if (qS=="complete"){
		return true;
	}else{
		return false;
	}
}
XMLController.prototype.queryStatus=function(nm,typ) {
    // only if req shows "loaded"
	switch (this._XMLREQ[nm].readyState){
	case 4:
        // only if "OK"
        if (this._XMLREQ[nm].status == 200) {
			return("complete")
        } else {
			if (typ=="errordetect"){
				return(this._XMLREQ[nm].statusText);
			}else{
				return(this._XMLREQ[nm].statusText);
			}
        }
		break;
		
	case 3:
		return("interactive");
	break;
	
	case 2:
		return("loaded");
	break;
	
	case 1:
		return("loading");
	break;

	case 0:
	default:
		return("uninitialized");
	break;
	}
}

var XMLControl = new XMLController();



