﻿var PopUp = '';
var service = "/webservice/CPSService.asmx/";
var req;

 function DoPopUp(URL,winWidth,winHeight,Scroll)
{
         if(!PopUp || PopUp.closed)
            {
                if(window.showModalDialog)
                {
                    PopUp=window.showModalDialog(URL,"PopUp","dialogHeight:" + winHeight + "px;dialogWidth:" + winWidth + "px;");
                }
                else
                {
                    PopUp=window.open(URL,"PopUp","width=" + winWidth + ",height=" + winHeight + ",scrollbars=" + Scroll + ",modal=yes" );
                }
                
            }else
            {
                PopUp.location=URL;
                PopUp.focus();
            }
 }

 function GetInnerText (node)
{
    if(node==null)
        return '';
	 return (node.textContent || node.innerText || node.text) ;
}
function getData(methodName,funcToCall,params)
{
    req =  zXmlHttp.createRequest();
    req.open('POST', service + methodName, true);
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-13');
    req.setRequestHeader("Content-length", "0");
    req.setRequestHeader("Connection", "close");
    if(params == null)
    {
        params="";
    }
    var lgh = "0";
    if(params != ""){lgh = String(params.length);}
  //  req.setRequestHeader("Content-length", lgh);
   // req.setRequestHeader("Connection", "close");
   req.onreadystatechange = function (aEvt) 
     {
        if (req.readyState == 4) 
           {
              if(req.status==200){window[funcToCall]();}
              else{document.write(req.status + ": " + req.statusText);}
           }
     };
     
    //if(params != null && params != "")
   // {
       req.send(params);
    //}
    //else
    //{
       // qreq.send(null);
    //}
      
}
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}
	
