        function ArgumentSet() {
        this.arg = new Array;
        this.value = new Array;
        this.length = 0;
        this.add =  function (arg1, value1) {
                        this.arg[this.length] = arg1;
                        this.value[this.length] = value1;
                        this.length++;
                    }
        this.toString = function () {
                            var str = "";
                            for( var i = 0; i < this.length; i++) {
                                str = str + "arg" + i + "=" + this.arg[i] + "&" + 
                                      "value" + i + "=" + this.value[i] + "&";
                            }
                            return str;
                        }
        this.createForURL = function () {
                            var str = "";
                            for( var i = 0; i < this.length; i++) {
                                str = str + this.arg[i] + "=" + this.value[i] + "&";
                            }
                            return str;
                        }
        this.getArg =   function (index) {
                            return this.arg[index];
                        }
        this.getValue = function (index) {
                            return this.value[index];
                        }
    }
            function ArraySet() {
        this.arg = new Array;
        this.value = new Array;
        this.length = 0;
        this.add =  function (arg1, value1) {
                        this.arg[this.length] = arg1;
                        this.value[this.length] = value1;
                        this.length++;
                    }
        this.toString = function () {
                            var str = "";
                            for( var i = 0; i < this.length; i++) {
                                str = str + "arg" + i + "=" + this.arg[i] + "&";
                                for(var j = 0; j < this.value[i].length; j++) {
                                    if(this.value[i][j].selected){
							str = str + "value"+ j + "=" + this.value[i][j].value + "&";
						}
                                }   
                            }
                            return str+"array=true&";
                        }
        this.getArg =   function (index) {
                            return this.arg[index];
                        }
        this.getValue = function (index) {
                            return this.value[index];
                        }
    }
    function ValueSet() {
        this.value = new Array;
        this.length = 0;
        this.add =  function (value1) {
                        this.value[this.length] = value1;
                        this.length++;
                    }
        this.toString = function () {
                            var str = "";
                            for( var i = 0; i < this.length; i++) {
                                str = str + "value" + i + "=" + this.value[i];
                                if(i+1<this.length){
                                    str = str + "&";
                                }
                            }
                            return str;
                        }
        this.getValue = function (index) {
                            return this.value[index];
                        }
    }
        
            /**
             * Returns a function that waits for the specified XMLHttpRequest
             * to complete, then passes its XML response
             * to the given handler function.
             * req - The XMLHttpRequest whose state is changing
             * responseXmlHandler - Function to pass the XML response to
             */
            function getReadyStateHandler(req, listObj, responseXmlHandler) {

              // Return an anonymous function that listens to the 
              // XMLHttpRequest instance
              return function () {

                // If the request's status is "complete"
                if (req.readyState == 4) {
                  // Check that a successful server response was received
                  if (req.status == 200) {
                    // Pass the XML payload of the response to the 
                    // handler function
                    responseXmlHandler(listObj,req.responseXML);
                  } else if (req.status == 500) {
                    // An HTTP problem has occurred
                    alert("HTTP error: "+req.status + "\nThis is probably because session timed out. Please login again.");
                  } else {
                    // An HTTP problem has occurred
                    alert("HTTP error: "+req.status);
                  }
                }
              }
            }

            // Added by Sudharshan
            // AJAX call to get content to display in form elements
            function populateByAJAX(url,listObj,handlerFunction) {
                    
                    var req = false;
                       if (window.XMLHttpRequest) { // Mozilla, Safari,...
                           req = new XMLHttpRequest();
                           if (req.overrideMimeType) {
                               req.overrideMimeType('text/xml');
                           }
                       } else if (window.ActiveXObject) { // IE
                           try {
                               req = new ActiveXObject("Msxml2.XMLHTTP");
                           } catch (e) {
                               try {
                                   req = new ActiveXObject("Microsoft.XMLHTTP");
                               } catch (e) {}
                           }
                       }
                       if (!req) {
                           alert('Browser doesn\'t support Ajax');
                           return false;
                       }
                // Set the handler function to receive callback notifications
                // from the request object
                var handlerFunction = getReadyStateHandler(req, listObj, handlerFunction);
                req.onreadystatechange = handlerFunction;
                req.open("GET", url, true);
                req.send(null);
            }

             // Added by Sachin
            // AJAX call to get content to display in form elements
            function populateByAJAXSyncPostMethod(url,listObj,handlerFunction) {
                    
                    var req = false;
                       if (window.XMLHttpRequest) { // Mozilla, Safari,...
                           req = new XMLHttpRequest();
                           if (req.overrideMimeType) {
                               req.overrideMimeType('text/xml');
                           }
                       } else if (window.ActiveXObject) { // IE
                           try {
                               req = new ActiveXObject("Msxml2.XMLHTTP");
                           } catch (e) {
                               try {
                                   req = new ActiveXObject("Microsoft.XMLHTTP");
                               } catch (e) {}
                           }
                       }
                       if (!req) {
                           alert('Browser doesn\'t support Ajax');
                           return false;
                       }
                // Set the handler function to receive callback notifications
                // from the request object
                var handlerFunction = getReadyStateHandler(req, listObj, handlerFunction);
                req.onreadystatechange = handlerFunction;
                req.open("POST", url, false);
                req.send(null);
            }

            function populateByAJAXSync(url,listObj,handlerFunction) {
	                        var req = false;
	                           if (window.XMLHttpRequest) { // Mozilla, Safari,...
	                               req = new XMLHttpRequest();
	                               if (req.overrideMimeType) {
	                                   req.overrideMimeType('text/xml');
	                               }
	                           } else if (window.ActiveXObject) { // IE
	                               try {
	                                   req = new ActiveXObject("Msxml2.XMLHTTP");
	                               } catch (e) {
	                                   try {
	                                       req = new ActiveXObject("Microsoft.XMLHTTP");
	                                   } catch (e) {}
	                               }
	                           }
	                           if (!req) {
	                               alert('Browser doesn\'t support Ajax');
	                               return false;
	                           }
	                    // Set the handler function to receive callback notifications
	                    // from the request object
	                    var handlerFunction = getReadyStateHandler(req, listObj, handlerFunction);
	                    req.onreadystatechange = handlerFunction;
	                    req.open("GET", url, false);
	                    req.send(null);
            }

            function populatePostByAJAX(url,listObj,handlerFunction,argumentsXML) {
                    var req = false;
                       if (window.XMLHttpRequest) { // Mozilla, Safari,...
                           req = new XMLHttpRequest();
                           if (req.overrideMimeType) {
                               req.overrideMimeType('text/xml');
                           }
                       } else if (window.ActiveXObject) { // IE
                           try {
                               req = new ActiveXObject("Msxml2.XMLHTTP");
                           } catch (e) {
                               try {
                                   req = new ActiveXObject("Microsoft.XMLHTTP");
                               } catch (e) {}
                           }
                       }
                       if (!req) {
                           alert('Browser doesn\'t support Ajax');
                           return false;
                       }
                // Set the handler function to receive callback notifications
                // from the request object
                var handlerFunction = getReadyStateHandler(req, listObj, handlerFunction);
                req.open("POST", url, true);
                req.setRequestHeader("Content-Type","text/xml");
                req.onreadystatechange = handlerFunction;
                req.send(argumentsXML);

            }

            // Generic method to create the option element for select
            function newOption(value,text){
                            var option = document.createElement("OPTION");
           //                 option.selected= true;
                            option.text=  text;
                            option.value= value;
                            return option;
            }

            // Generic method to create the option element for default select
            function newSelectedOption(value,text){
                            var option = document.createElement("OPTION");
                            option.selected= true;
                            option.text=  text;
                            option.value= value;
                            return option;
            }

function populateByAJAXNew(url,parameters,listObj,handlerFunction) {
	                        var req = false;
	                           if (window.XMLHttpRequest) { // Mozilla, Safari,...
	                               req = new XMLHttpRequest();
	                               if (req.overrideMimeType) {
	                                   req.overrideMimeType('text/xml');
	                               }
	                           } else if (window.ActiveXObject) { // IE
	                               try {
	                                   req = new ActiveXObject("Msxml2.XMLHTTP");
	                               } catch (e) {
	                                   try {
	                                       req = new ActiveXObject("Microsoft.XMLHTTP");
	                                   } catch (e) {}
	                               }
	                           }
	                           if (!req) {
	                               alert('Browser doesn\'t support Ajax');
	                               return false;
	                           }
	                    // Set the handler function to receive callback notifications
	                    // from the request object
	                    var handlerFunction = getReadyStateHandler(req, listObj, handlerFunction);
	                    req.onreadystatechange = handlerFunction;
	                    req.open("POST", url,false);
		            req.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
	                    req.send(parameters);
            }
