var t;
	function generateRequest(method, url, data, process, async, dosend, params)
		{
				var self = this;
				// check the dom to see if this is IE or not
			    if (window.XMLHttpRequest) 
			    {
					// Not IE
			        self.AJAX = new XMLHttpRequest();
			    } else if (window.ActiveXObject) 
			    {
			    	// Hello IE!
			        // Instantiate the latest MS ActiveX Objects
			        if (_ms_XMLHttpRequest_ActiveX) 
			        {
           					 self.AJAX = new ActiveXObject(_ms_XMLHttpRequest_ActiveX);
       				} else 
       				{
					    // loops through the various versions of XMLHTTP to ensure we're using the latest
					    var versions = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
					                        "Microsoft.XMLHTTP"];

			            for (var i = 0; i < versions.length ; i++)
			            {
			                try 
			                {
							    // try to create the object
							    // if it doesn't work, we'll try again
							    // if it does work, we'll save a reference to the proper one to speed up future instantiations
							    self.AJAX = new ActiveXObject(versions[i]);

			                    if (self.AJAX) 
			                    {
			                        _ms_XMLHttpRequest_ActiveX = versions[i];
			                        break;
			                    }
						} catch (objException) {
							// trap; try next one
						} ;
					} ;
				}
			}
				// if no callback process is specified, then assing a default which executes the code returned by the server
			   if (typeof process == 'undefined' || process == null) {
			       process = executeReturn;
			   }

			   	self.process = process;
				self.params = params;
			    // create an anonymous function to log state changes
			    self.AJAX.onreadystatechange = function( ) {
		        //logger("AJAXRequest Handler: State =  " + self.AJAX.readyState);
       			 self.process(self.AJAX);
    			}

			    // if no method specified, then default to POST
			    if (!method)
			    {
			        method = "POST";
			    }

   				 method = method.toUpperCase();

			    if (typeof async == 'undefined' || async == null)
			    {
			        async = true;
			    }

	    			self.AJAX.open(method, url, async);

			    if (method == "POST")
			    {
	        		self.AJAX.setRequestHeader("Connection", "close");
			        self.AJAX.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	        		self.AJAX.setRequestHeader("Method", "POST " + url + "HTTP/1.1");
			    }

				    // if dosend is true or undefined, send the request
				    // only fails is dosend is false
				    // you'd do this to set special request headers
			    if ( dosend || typeof dosend == 'undefined' )
			    {
				    if ( !data ) data="";
					    self.AJAX.send(data);
			    }
	    		return self.AJAX;
	}
	function setDate(element)
         { 
         initFunction(element);
         dateFocus(document.getElementById(element));
         }  
	
	//For Left Trim(Removes starting white spaces)
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}
// a global month names array
var gsMonthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// a global day names array
var gsDayNames = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// the date format prototype
Date.prototype.format = function(f)
{
    if (!this.valueOf())
        return '&nbsp;';

    var d = this;

    return f.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,
        function($1)
        {
            switch ($1.toLowerCase())
            {
            case 'yyyy': return d.getFullYear();
            case 'mmmm': return gsMonthNames[d.getMonth()];
            case 'mmm':  return gsMonthNames[d.getMonth()].substr(0, 3);
            case 'mm':   return (d.getMonth() + 1);
            case 'dddd': return gsDayNames[d.getDay()];
            case 'ddd':  return gsDayNames[d.getDay()].substr(0, 3);
            case 'dd':   return d.getDate();
            case 'hh':   return ((h = d.getHours() % 12) ? h : 12);
            case 'nn':   return d.getMinutes();
            case 'ss':   return d.getSeconds();
            case 'a/p':  return d.getHours() < 12 ? 'a' : 'p';
            }
        }
    );
}

String.prototype.getParseToDate = function()
{
	var attArray = this.split("/");
	var strDate = "";
	strDate = gsMonthNames[parseInt(attArray[0])-1];
	strDate = strDate +' '+ attArray[1];
	if(attArray[2]<"80")
	{strDate = strDate+', 20'+ attArray[2];}else {strDate = strDate+', 19'+ attArray[2];}
	return strDate;
}

String.prototype.getParseBackToDate = function()
{
	var attArray = this.split(" ");
	var strDate = "";
	var monthToParse=trim(attArray[0]);
	i=0;
	while (monthToParse != gsMonthNames[i]){
		i++;
	}
	var monthNum=i++;
	
	strDate = monthNum +'/'+ attArray[1].substr(0, 2)+'/'+attArray[2].substr(2, 2);
	return strDate;
}
function getDateFromDiv(parentNode,childNode){
	var el = document.getElementById(parentNode);
	var dateFromDiv=(document.getElementsByClassName(childNode,el)[0].innerHTML)
	return dateFromDiv;
}
//replaces the old string with new
function replaceAll(OldString,FindString,ReplaceString) {
  	var SearchIndex = 0;
  	var NewString = ""; 
  	while (OldString.indexOf(FindString,SearchIndex) != -1)    {
	    	NewString += OldString.substring(SearchIndex,OldString.indexOf(FindString,SearchIndex));
	    	NewString += ReplaceString;
	    	SearchIndex = (OldString.indexOf(FindString,SearchIndex) + FindString.length);         
 	}
  	NewString += OldString.substring(SearchIndex,OldString.length);
  	return NewString;
}

	
