   function DeSLPOSTRequest(url, parameters, delegate) {
	//phased out. replaced with Invok	
   }

   function DeSLLocalExec() {
      if (this.http_request.readyState == 4) {
         if (this.http_request.status == 200 ) {
            result = this.http_request.responseText;
	    eval(result);
         } else {
            alert('There was a problem with the request.' + this.http_request.status + '. ' + this.http_request.responseText);
         }
      }
   }

   function Invok(strURL, strFunction, objPayload, objDelegate) {
      this.http_request=false;

      var self = this;
      var parameters = "DeSLFunction=" + encodeURI( strFunction ) + '&' + objPayload;
      var url=strURL;

      this.delegate = function(){
              if (self.http_request.readyState == 4) {
	         if (self.http_request.status == 200 ) {
	       	    result = self.http_request.responseText;
		    eval(result);
	         } else {
	            alert('There was a problem with the request.' + self.http_request.status + '. ' + self.http_request.responseText);
	         }
	      }
	}


      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         this.http_request = new XMLHttpRequest();
         if (this.http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            this.http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            this.http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               this.http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!this.http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }

	this.http_request.onreadystatechange = this.delegate;
    
      if (window.XMLHttpRequest){
         this.http_request.open('POST', url, true);
         this.http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         this.http_request.setRequestHeader("Content-length", parameters.length);
	 //http_request.setRequestHeader("Connection", "close");
      }else{
         this.http_request.open('POST', url, true);
	 this.http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         this.http_request.setRequestHeader("Content-length", parameters.length);
	 this.http_request.setRequestHeader("Connection", "close");
      }
      this.http_request.send(parameters);

   }

   function InvokeDeSL(strURL, strFunction, objPayload, objDelegate) { 
     var objs=new Invok(strURL, strFunction,objPayload,objDelegate);     	
   }

function DeSLTbSet(tb,val){var obj;obj=document.getElementById(tb);if (obj){obj.value=val;}}
function DeSLLbSet(tb,val){var obj;obj=document.getElementById(tb);if (obj){if(document.all){obj.innerText=val;}else{obj.textContent=val;}}}
function DeSLLbxSet(pv,tb,val){var obj;obj=document.getElementById(pv+tb);if (obj){if(document.all){obj.innerText=val;}else{obj.textContent=val;}}}
function DeSLLbHSet(tb,val){var obj;obj=document.getElementById(tb);if (obj){obj.innerHTML=val;}}
function gE(id){return document.getElementById(id);}
function gEV(id){var obj;obj=gE(id);if (obj){return obj.value;}}
function gEVx(pv,id){var obj;obj=gE(pv+id);if (obj){return obj.value;}}
function gLVe(pv,lbl){var obj;obj=document.getElementById(pv+lbl);if (obj){if(document.all){return obj.innerText;}else{return obj.textContent;}}}
function gLV(lbl){var obj;obj=document.getElementById(lbl);if (obj){if(document.all){return obj.innerText;}else{return obj.textContent;}}}
function PopSel(id,ar1){
var obj;
var obj=gE(id);
if (obj){
for(i=0;i<ar1.length;i+=1)
{
 obj.options[obj.options.length]=new Option(ar1[i][0],ar1[i][1],obj.options.length);
}}}
function ClrSel(id)
{
var obj;
var obj=gE(id);
if (obj){
obj.options.length=0;}
}
function inpInc(tb){var obj;obj=document.getElementById(tb);if(obj){obj.value=obj.value+1;}}
function inpDec(tb){var obj;obj=document.getElementById(tb);if(obj){obj.value=obj.value-1;}}
function getTb(tb){var obj;obj=document.getElementById(tb);if(obj){return obj.value;}else{return '';}}

function getEVENTTARGET()
{

    var theform;
    var obj;

    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
    }
    else {
    	theform = document.forms[0];
    }

    if(theform)
    {
	obj=theform.__EVENTTARGET;
    }
    else
    {
       	obj=document.getElementById('__EVENTTARGET');
    }
    return obj;
}

function getEVENTARGUMENT()
{

    var theform;
    var obj;

    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
    }
    else {
    	theform = document.forms[0];
    }

    if(theform)
    {
	obj=theform.__EVENTARGUMENT;
    }
    else
    {
       	obj=document.getElementById('__EVENTARGUMENT');
    }
    return obj;
}

function SetInputVals(strparent, strfield){
    var inputs = document.getElementById(strparent).getElementsByTagName('INPUT');
    var input;
    var val='';

    for (var i = 0; i < inputs.length; i++) { 
        input=inputs[i];

	if (input.id.indexOf('ctlVS')>-1){}
	else if (input.id.indexOf('ctlINP')>-1){}
	else if (input.id=='__EVENTARGUMENT'){}
        else if (input.type=='checkbox')
        {
            if (input.checked==true){
            val=val+'&' + input.name + '=checked';
            }
        }
	else if (input.type=='radio')
        {
            if (input.checked==true){
            val=val+'&' + input.name + '=' + input.value;
            }
        }
	else if (input.type=='submit')
	{
		//ignore
	}
	else if (input.type=='button')
	{
		//ignore
	}
	else if (input.type=='image')
	{
		//ignore
	}
	else if (input.type=='reset')
	{
		//ignore
	}
        else
        {
            val=val+'&' + input.name + '=' + encodeURI(input.value);
        }
    }

    inputs = document.getElementById(strparent).getElementsByTagName('TEXTAREA');
    for (var i = 0; i < inputs.length; i++) { 
        input=inputs[i];
        val=val+'&' + input.name + '=' + encodeURI(input.value);
    }
    inputs = document.getElementById(strparent).getElementsByTagName('SELECT');
    for (var i = 0; i < inputs.length; i++) { 
        input=inputs[i];
	for (var o = 0; o < input.options.length; o++){
		if (input.options[o].selected==true || input.options[o].checked==true)
		        val=val+'&' + input.name + '=' + encodeURI(input.options[o].value);
	}
    }

    val=val+'&__EVENTTARGET='+getEVENTTARGET().value;
    val=val+'&__EVENTARGUMENT='+getEVENTARGUMENT().value;
    document.getElementById(strfield).value=val;  
}

function TextboxTotal(strparent, strlabel){
    var inputs = document.getElementById(strparent).getElementsByTagName('INPUT');
    var input;
    var val=0;
    for (var i = 0; i < inputs.length; i++) { 
        input=inputs[i];
        if (input.type=='text')
        {
	    try
	    {
            val=val+parseInt(input.value);
	    }
            catch(e)
            {}
        }
    }
    document.getElementById(strlabel).innerText=val;  
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		if (oldonload) {
			oldonload();
		}
		func();
		}
	}
}
	
function addResizeEvent(func) {
	var oldonload = window.onresize;
	if (typeof window.onresize != 'function') {
		window.onresize = func;
	} else {
		window.onresize = function() {
		if (oldonload) {
			oldonload();
		}
		func();
		}
	}
}

function replaceAll(str,c1,c2){
 var strReplaceAll = str;
 var intIndexOfMatch = strReplaceAll.indexOf(c1);

 while (intIndexOfMatch != -1){

	strReplaceAll = strReplaceAll.replace(c1, c2);
	intIndexOfMatch = strReplaceAll.indexOf(c1);
 }
 return strReplaceAll;
}

function __desldopostback(invfunc,divid,inpid,vsid,cid,uid,tabid,moduleid,target,argument)
{

 	var ViewState='';
	var strParams=' ';
	var inpState='';
	var theform;

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
	}
	else {
		theform = document.forms[0];
	}

	if(theform)
	{
		theform.__EVENTTARGET.value=replaceAll(target,'$',':');
	        theform.__EVENTARGUMENT.value=argument;
	}
	else
	{
        	document.getElementById('__EVENTTARGET').value=replaceAll(target,'$',':');
	        document.getElementById('__EVENTARGUMENT').value=argument;
	}
	SetInputVals(divid,inpid);

        ViewState=gEV(vsid);
	strParams='&ViewState='+ViewState;
	strParams=strParams+document.getElementById(inpid).value;

	InvokeDeSL('Applications/DeSLAJAXCon/Modules/ACall.aspx',invfunc,'&CID='+cid+'&UID='+uid+'&TabId='+tabid+'&ModuleId='+moduleid+'&DIVID='+divid+'&VSID='+vsid+'&ModuleIsPostback=True&INPID='+inpid+strParams,DeSLLocalExec);

}


function CalShowClick( theDivName, btnShowCal )
{
	var ContainerDiv = document.getElementById(theDivName);
	var but = document.getElementById(btnShowCal);
		
	if( ContainerDiv.style.display == 'none') 
		{
		ContainerDiv.style.zIndex=1000;
		ContainerDiv.style.display = "inline";
		ContainerDiv.style.left=but.clientLeft-130;
		ContainerDiv.style.top=but.clientTop+3;
		hideCalElement("SELECT",ContainerDiv);
		//hideCalElement("INPUT",ContainerDiv);
		} 
	else {
		showCalElement("SELECT",ContainerDiv);
		//showCalElement("INPUT",ContainerDiv);
		ContainerDiv.style.display = "none";
	}
}

	function hideCalElements( theDivName )
	{
		var ContainerDiv = document.getElementById(theDivName);
			
		if( ContainerDiv.style.display == "none")
			{
				
			}
		else 
			{
				
				hideCalElement("SELECT",ContainerDiv);
				hideCalElement("INPUT",ContainerDiv);
				
			}
	}

	function showCalElements( theDivName )
	{
		var ContainerDiv = document.getElementById(theDivName);

		ContainerDiv.style.display='inline';
				
		showCalElement("SELECT",ContainerDiv);
		showCalElement("INPUT",ContainerDiv);
		
	}

	function hideCalElement(elmID, eMenu)
	{
		var objs;
		var obj;
		var doR=false;

		objs=document.all.tags(elmID);
		
		// Hide any element that overlaps with the dropdown menu
		for (i = 0; i < objs.length; i++)
		{
			obj = objs[i];

			doR=false;

			if (obj.tagName=='INPUT')
			{
				if (obj.type.toLowerCase()=='button' || obj.type.toLowerCase()=='submit')
				{
					doR=true;
				}
			}
			else
			{
				doR=true;
			}

			if (doR==true){
			
				if (elementTop(obj) > elementTop(eMenu) + eMenu.offsetHeight)
				{
					
					//if element is below bottom of menu then do nothing
				}
				else if (elementLeft(obj) > elementLeft(eMenu) + eMenu.offsetWidth)
				{
					
				//if element is to the right of menu then do nothing
				}
				else if (elementLeft(obj) + obj.offsetWidth < elementLeft(eMenu))
				{
					
					//if element is to the left of menu then do nothing
				}
				else if (elementTop(obj) + obj.offsetHeight < elementTop(eMenu))
				{
					
					//if element is to the top of menu then do nothing
				}
				else
				{

					obj.deslhid=1;
					obj.style.visibility = "hidden";
				}
			}
		}
	}

	function showCalElement(elmID, eMenu)
	{
		var objs;
		var obj;
		var doR=false;

		objs=document.all.tags(elmID);

		// Hide any element that overlaps with the dropdown menu
		for (i = 0; i < objs.length; i++)
		{
			obj = objs[i];

			doR=false;

			if (obj.tagName=='INPUT')
			{
				if (obj.type.toLowerCase()=='button' || obj.type.toLowerCase()=='submit')
				{
					doR=true;
				}
			}
			else
			{
				doR=true;
			}

			if (doR==true){

			if (elementTop(obj) > elementTop(eMenu) + eMenu.offsetHeight)
			{
				//if element is below bottom of menu then do nothing
			}
			else if (elementLeft(obj) > elementLeft(eMenu) + eMenu.offsetWidth)
			{
				//if element is to the right of menu then do nothing
			}
			else if (elementLeft(obj) + obj.offsetWidth < elementLeft(eMenu))
			{
				//if element is to the left of menu then do nothing
			}
			else if (elementTop(obj) + obj.offsetHeight < elementTop(eMenu))
			{
			
				//if element is to the top of menu then do nothing
			}
			else
			{
				obj.deslhid=0;
				obj.style.visibility = "visible";
			}
			}
			
		}
	}
	
	function elementTop(eSrc)
	{
		var iTop = 0;
		var eParent;
		eParent = eSrc;
		while (eParent.tagName.toUpperCase() != "BODY")
		{
			iTop += eParent.offsetTop;
			eParent = eParent.offsetParent;
		}
		return iTop;
	}
	
	function elementLeft(eSrc)
	{	
		var iLeft = 0;
		var eParent;
		eParent = eSrc;
		while (eParent.tagName.toUpperCase() != "BODY")
		{
			iLeft += eParent.offsetLeft;
			eParent = eParent.offsetParent;
		}
		return iLeft;
	}

function fCur(strValue)
{
	strValue = strValue.toString().replace(/\$|\,/g,'');
	dblValue = parseFloat(strValue);

	dblValue = Math.floor(dblValue*100+0.50000000001);
	intCents = dblValue%100;
	strCents = intCents.toString();
	dblValue = Math.floor(dblValue/100).toString();
	if(intCents<10)
		strCents = "0" + strCents;
	for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
		dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
		dblValue.substring(dblValue.length-(4*i+3));
	return dblValue + '.' + strCents;
}
function mo(o){ 
		o.style.backgroundColor='#ddddff';
		o.style.border='1px solid #000000';
		o.style.cursor='hand';
	}
	function mt(o){ 
		o.style.backgroundColor='transparent';
		o.style.border='1px solid #d4d0c8';
	}
	function clickButton(buttonid){
		document.getElementById(buttonid).click(); return false; 
	}