//Start STC_JS Functions

function STC_CheckDelete()
    {
    return confirm('Are you SURE you wish to delete this record?');
    }

function STC_RefreshCaller()
	{
	window.opener.location.reload();
	}

function STC_ReadParameters()
{
	var GETDATA = new Array();
	// Get the string that follows the "?" in the window's location.
	var sGet = window.location.search;
	
	if (sGet) // if has a value...
	{
	    sGet = sGet.substr(1);
	    var sNVPairs = sGet.split("&");
	    for (var i = 0; i < sNVPairs.length; i++)
	    {
	        var sNV = sNVPairs[i].split("=");
	        var sName = sNV[0];
	        var sValue = sNV[1];
	        GETDATA[sName] = sValue;
	    }
	}
	return GETDATA;
}

function STC_PopWin(windowName,  aWidth, aHeight, aTop, aLeft)
	{
	var nW;
	var nTop;
	var nLeft;
	var nWidth;
	var nHeight;
	nHeight = 420;
	if (aHeight >= 0) 
		{
		nHeight = aHeight;
		}
	nWidth = 650;
	if (aWidth >= 0) 
		{
		nWidth = aWidth;
		}
	// allows autocentering
	nTop = (screen.height-nHeight)/2 ;
	if (aTop >= 0) 
		{
		nTop = aTop;
		}
	nLeft = (screen.width-nWidth)/2;
	if (aLeft >= 0) 
		{
		nLeft = aLeft;
		}
	nW = window.open("", "popup", "resizable=yes,scrollbars=yes,top=" + nTop.toString() + ",left=" + nLeft.toString() + ",width=" + nWidth.toString() + ",height=" + nHeight.toString() );
	nW.location.href = windowName;
	nW.blur();
    nW.focus(); 
	nW = null;
	}

function STC_AjaxInstance()
	{  
  	var A=null;  
  	try
		{
		A=new ActiveXObject("Msxml2.XMLHTTP")  
  		}
	catch(e)
		{ 
		try
			{ 
			A=new ActiveXObject("Microsoft.XMLHTTP")  
		    } 
		catch(oc){ A=null  // No XML Available  
	 		}  
		}  
  	if(!A && typeof XMLHttpRequest != "undefined") 
		{ 
		A=new XMLHttpRequest() 
		}  
  	return A  
	}  
function STC_FireAjaxURL(aURL)
	{
	var instXML = STC_AjaxInstance(); 
	var Url = aURL;
	if (instXML)
		{
		 instXML.open("GET", Url, true); 
		 instXML.onreadystatechange=function() 
	 	{  
			if (instXML.readyState==4) 
				{   
				try {
					eval(instXML.responseText);
					}
				catch(e)
					{
					alert('AJax Call Failed');
					//alert(instXML.responseText);
					}  
				}  
		 	} 
		instXML.send();
		}
	}

function STC_Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function STC_Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function STC_Mid(str, start, len)
        /***
                IN: str - the string we are LEFTing
                    start - our string's starting position (0 based!!)
                    len - how many characters from start we want to get

                RETVAL: The substring from start to start+len
        ***/
        {
                // Make sure start and len are within proper bounds
                if (start < 0 || len < 0) return "";

                var iEnd, iLen = String(str).length;
                if (start + len > iLen)
                        iEnd = iLen;
                else
                        iEnd = start + len;

                return String(str).substring(start,iEnd);
        }

//End STC_JS Functions
