var InvalidChars = "~,`"; //separate invalid characters with ,

function ShowElement(elm,state)
{
	if(document.getElementById(elm))
		document.getElementById(elm).style.display = (state==true) ? 'inline' : 'none' ;
}
function EnableControl(ctrl,state,color)//color is optional
{
	ctrl.disabled = !state
	if(color)
	ctrl.style.borderColor=color
}
/*function IsBlank(ctrl) // use isEmpty(strVal) function
{
	return ((ctrl.value=="") ? true : false );
}*/
function IsSelected(cbo,StartIndex)//StartIndex is optional,a zero value will exclude 1st element for checking
{
	if(StartIndex >=0)
		return ((cbo.selectedIndex == StartIndex) ? false : true );
	else
		return ((cbo.selectedIndex >= 0) ? true : false );
}

function NVL(val)
{
	if(val == null)
		return '';
	else return val;
}

function IsNumber(num)//num must be positive integer > 0
{
	var reg =/(^-*\d+$)/
	//var reg = /^-?\d+(\.\d{1,2})?$/
	/*if (num.match(reg) && num > 0)
		return true 
	else
		return false
		*/
	if (num.match(reg))
		return true
	else
		return false
}
function IsReal(x,d)//x must be positive float with max 2 digit after decimal > 0;d is optional that denotes no of digits allowed after decimal
{//num must be positive integer
	d = (d) ? d : 2;
//	var reg = /(^-*\d+$)|(^-*\d+\.\d{1,2}$)/
	var reg = eval("/(^-*\\d+$)|(^-*\\d+\\.\\d{1," + d + "}$)/")
	/*if (x.match(reg) && x > 0)
		return true
	else
		return false
		*/
	if (x.match(reg))
		return true
	else
		return false
}
//  ctrl : checkbox/radio button reference
// syntax :  onClick="IsChecked(this.form.ChkBox)"
function IsChecked(ctrl)
{
	if(ctrl) //if any record found
	{
		 if(ctrl.length) //multiple recoed
		 {
			for(var i=0;i<ctrl.length;i++)
			{
				if(ctrl[i].checked == true)
					return true;
			}
			return false; // no record checked	
		 }
		 else // single record
		{
			if(ctrl.checked == true)
				return true;
			else
				return false; // no record checked
		}
	}
	return false;// no record checked		
}
function SelectAll(ctrl,state)//select/deselect checkboxes
{
	if(ctrl)
	{
		 if(ctrl.length) //multiple recoed
			 {
				for(var i=0;i<ctrl.length;i++)
				{
					ctrl[i].checked = state;
				}
			 }
			 else // single record
				ctrl.checked = state
	}
}
function SelectAllCheckBoxes(frm,state,name)//select/deselect serverside_checkboxes
{
	//alert(name);
	for(i=0;i< frm.length;i++)
	{
		e=frm.elements[i];
		if ( e.type=='checkbox' && e.name.indexOf(name) != -1 )
		e.checked= state ;
	}

}
/*
    Purpose : To check/uncheck Select All checkbox for parent checkboxes
	 chkChild = Reference to the child ckeck box
	 chkParent = Referrence to Select All check box
	 isChecked = Checked status of chkChild
	 Usage => ONCLICK="ChangeSelectAll(this.form.chkEmp,this.form.chkSa,this.checked)"
*/
function ChangeSelectAll(chkChild,chkParent,isChecked)
{
	
	if(!isChecked)
	{
	  chkParent.checked = false;
	}
	else
	{
		
		//if(chkChild) //if any record found
		//{
			//alert(chkChild.length);
			if(chkChild.length) //multiple recoed
			{
				for(var i=0;i<chkChild.length;i++)
				{
					if(chkChild[i].checked == false)
					{
						chkParent.checked = false;
						return;
					}
				}
				chkParent.checked = true;
			}
			else // single record
			{
				if(chkChild.checked == true)
					chkParent.checked = true;
				else
					chkParent.checked = false;
			}
		//}
	}
}

//------------------------------------------------------------------------------------------------------
function IsDate(dt,sep) //mm/dd/yyyy or m/d/yyyy or mm/d/yyyy ; sep optional parameter
{
	var p = (sep) ? sep : "/" ; //holds separator , defaults '/'
	var d,m,y
	var DaysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var dtparts = dt.split(p);
	if(dtparts.length!=3) return false
	m = dtparts[0] //month
	d = dtparts[1]//day
	y = dtparts[2] //year
	if(m.length>2 || d.length>2 || y.length>4)
	  return false;
	m=parseInt((m.charAt(0)=="0") ?  m.charAt(1) : m);
	d=parseInt((d.charAt(0)=="0") ?  d.charAt(1) : d);
	y=parseInt(y);	

	if(isNaN(m)||isNaN(d)||isNaN(y)) return false
	if(y < 1000 || y >9999 || d >31 || m >12) return false
	if(d<=0||m<=0||y<=0) return false
	
	if(m==2 && y%4 == 0 && d > 29) return false; //feb & leapyear check
	else if(m==2 && y%4 != 0 && d > 28) return false;//feb & leapyear check
	else if(m!=2 && d > DaysInMonth[m-1]) return false;//days in month
	
	return true
}

//---------------------------------------------------------------------------------
function IsValidEmail(email)
{
	if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}
function IsValidUrl(url)
{
	//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56reconBackreferences.asp
	if (url.search(/(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/) != -1)
		return true;
	else
		return false;
}
//-------------------------------------------------------------------------------------
/*  dates are in m/d/yyyy format
0 if value1=value2
1 if value1>value2
-1 if value1<value2
-2 if invalid format or invalid date
*/
function CmpDate(value1, value2) {
   var date1, date2;
   var month1, month2;
   var year1, year2;
   if(!IsDate(value1)) return -2 ; if(!IsDate(value2)) return -2 ;
	value1= value1.split("/")
	month1=parseInt((value1[0].charAt(0)=="0") ?  value1[0].charAt(1) : value1[0]);
	date1=parseInt((value1[1].charAt(0)=="0") ?  value1[1].charAt(1) : value1[1])
	year1=value1[2]	

   	value2= value2.split("/")
	month2=parseInt((value2[0].charAt(0)=="0") ?  value2[0].charAt(1) : value2[0]);
	date2=parseInt((value2[1].charAt(0)=="0") ?  value2[1].charAt(1) : value2[1]);
	year2=value2[2]	

   /*if (year1 > year2) return 1;
   else if (year1 < year2 ) return -1;
   else if (month1 > month2) return 1;
   else if (month1 < month2) return -1;   
   else if (date1 > date2) return 1;
   else if (date1 < date2) return -1;
   else if (date1 == date2 && month1 == month2 && year1 == year2 ) return -1;
   else return 0;*/
    if((month1 == month2) && (date1 == date2) && (year1 == year2))
     return 0;
   else if (year1 > year2) return 1;
   else if (year1 < year2) return -1;
   else if (month1 > month2) return 1;
   else if (month1 < month2) return -1;
   else if (date1 > date2) return 1;
   else if (date1 < date2) return -1;
   else return 0;
} 

//type is either of "both", "left", "right". Not giving any second parameter will trim all.
function Trim(value,type)						 
{
	var s,l
	s=value   // value of control
	t=type    // 
	l=s.length
	if(t==null || t=="both" || t=="left")
	while(s.substr(0,1)==" ")
	{
		s=s.substr(1,l-1)
		l=l-1
	}
	if(t==null || t=="both" || t=="right")
	while(s.substr(l-1,1)==" ")
	{
		s=s.substr(0,l-1)
		l=l-1
	}
	return s
}
/* 
	TO add/remove ITEMS FROM SOURCE LIST BOX TO DESTINATION
		PARAMETER : SourceLst=REFERRENCE TO SOURCE COMBO
					DestLst=REFERRENCE TO DESTINATION COMBO
		This function allows multiple selection of items to move
*/
function DoMove(SourceList, DestList)
{ 
	DestList.selectedIndex = -1
	var str = "", IsExists=0
	if(	SourceList.selectedIndex>=0)
	{
		for (var j=SourceList.selectedIndex;j<SourceList.length;j++)
		{			
			var ListItemValue=SourceList.options[j].value;
			var ListItemText = SourceList.options[j].text;
			IsExists=0
			if (SourceList.options[j].selected == true)
			{
				for(var i=0;i<DestList.length;i++)
				{	
					if(DestList.options[i].value==ListItemValue)
						IsExists = 1;
				}
				if ( IsExists == 0 )
				{
					DestList.options[DestList.length] = new Option(ListItemText,ListItemValue);
					SourceList.options[j].selected = false
				}
			}
		}
	
		SourceList.selectedIndex = -1
	}
}

function DoRemove(cbo)
{
	if(cbo.selectedIndex>=0)
	{	
		for(var i=cbo.length-1;i>=0;i--)
		{
			if(cbo.options[i].selected)	
				cbo.remove(i)
		}

		return true;
	}
	
	else
		return false;
}
//Select all items in a listbox
function SelectAllListItems(cbo)
{
	for(var i=cbo.length-1;i>=0;i--)
		{
			cbo.options[i].selected = true;
		}
}

//Select all items in a listbox
function DeselectAllListItems(cbo)
{
	for(var i=cbo.length-1;i>=0;i--)
		{
			cbo.options[i].selected = false;
		}
}

// Date Difference Function 
function DateDiff(d1, d2) {           
    var days = (Date.parse(d1.toString()) - Date.parse(d2.toString())) / (1000 * 60 *60 * 24);               
    return days;
}
//New window open at the center of the screen
/*function OpenWin(URL,WindowName,Width,Height,Resize)
{
	WindowName = (WindowName == null ? "d_efa_ult_" : WindowName);
	Width = (Width == null? 650 : Width);
	Height = (Height == null ? 450 : Height);
	Resize = (Resize == null ? true : Resize);
	
	var tp = (screen.height-Height)/2
	var lft = (screen.width-Width)/2
	var w
	var sFeatures
	if(Resize==true)
		 sFeatures="height="+Height+",width="+Width+",status=no,toolbar=no,menubar=no,scrollbars=yes,location=no,resizable=yes,top="+tp+",left="+lft
	else
		 sFeatures="height="+Height+",width="+Width+",status=no,toolbar=no,menubar=no,scrollbars=yes,location=no,top="+tp+",left="+lft	
	w = window.open(URL,WindowName,sFeatures)
	w.focus()
	return w
}*/
function OpenWin(URL,WindowName,Width,Height,Resize,WidthUnit)
{
	var tp,lft ,w;
	var sHeight,sWidth;
	var sFeatures ;
	WindowName = (WindowName == null ? "d_efa_ult_" : WindowName);
	Width = (Width == null? 650 : Width);
	Height = (Height == null ? 450 : Height);
	Resize = (Resize == null ? true : Resize);
	WidthUnit = (WidthUnit == null ? "-1" : "%");

	sHeight = screen.height
	sWidth = screen.width
	if(WidthUnit == "%")
	{
		Height = (sHeight * Height)/100;
		Width = (sWidth * Width)/100;
	}
	tp = parseInt((sHeight-Height)/2)
	lft = parseInt((sWidth-Width)/2)
	if(Resize==true)
		 sFeatures="height="+Height+",width="+Width+",status=no,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=yes,top="+tp+",left="+lft
	else
		 sFeatures="height="+Height+",width="+Width+",status=no,toolbar=no,menubar=no,scrollbars=no,location=no,top="+tp+",left="+lft	
	w = window.open(URL,WindowName,sFeatures)
	if(w)
	  w.focus()
	 else
		alert('please allow popup from your browser.')
	return false;
	
}
/*Required field Validator*/
function isEmpty(str) {
	// Check whether string is empty.
	for (var intLoop = 0; intLoop < str.length; intLoop++)
	   if (" " != str.charAt(intLoop))
		  return false;
	return true;
 }


 //Purpose::To use automatic paging 
 function ShowPage(PageNo)
{
	var frm = document.forms[0]
	if(frm.PageNo)
		frm.PageNo.value = PageNo
	else
	{
		var hid_pageno =  document.createElement ("<input type='hidden' value='" + PageNo + "' name=PageNo>");
		frm.appendChild(hid_pageno)
	}

	elm=frm.elements; 
	for(i=0;i<elm.length;i++)
		{
			if(elm[i].type=="checkbox")
				{
					elm[i].checked= false;
				}
		}
	frm.submit()
	ShowWait(frm);
	return false
}
 //Purpose::To use automatic sorting in reports
 //Assumptions:: The sorting fields are contained in the 1st form of the page and the form contains
 //contains 2 hidden fields OrderBy ,OrderMode 
function SetOrder(i)
{	
	var frm = document.forms[0]
	if(frm.TotRecs)
	{
		if(parseInt(frm.TotRecs.value) < 2)
		return false;
	}
	if(!frm.OrderBy)
	{
		var hid_orderBy =  document.createElement ("<input type='hidden' value='"+ i + "' name='OrderBy'>");
		frm.appendChild(hid_orderBy)
		var hid_orderMode = document.createElement ("<input type='hidden' value='ASC' name='OrderMode'>");
		frm.appendChild(hid_orderMode)
		frm.submit();
	}
	
	if(frm.OrderBy.value == i)
		frm.OrderMode.value = ((frm.OrderMode.value == "ASC") ? "DESC" : "ASC" );
	else
	{
		frm.OrderBy.value = i ;
		frm.OrderMode.value = "ASC" ;
	}
	
	frm.submit();
}
//Purpose : To prevent form submission while hitting enter key
//Usage : add  onkeypress="return noenter()" attribite to all form controls that cause page submit when enter 
//key is hit
function noenter() 
{
  return !(window.event && window.event.keyCode == 13); 
}
//to get all selected item values of a listbox
function GetSelectedValues(cbo,separator)
{
	var val = "";
	for(var i=cbo.length-1;i>=0;i--)
		{
			if(cbo.options[i].selected)
			{	
				if(val == "")
					val = cbo.options[i].value ;
				else
					val =  cbo.options[i].value  + separator + val;
			
			}
		}
	return val;
}
//To retrieve selected radio button value
function GetRadioButtonListValue(ctrl)
{
	if(ctrl) //if any record found
	{
		if(ctrl.length) //multiple recoed
		{
			for(var i=0;i<ctrl.length;i++)
			{
				if(ctrl[i].checked == true)
					return ctrl[i].value;
			}
			return ; // no record checked	
		}
		else // single record
		{
			if(ctrl.checked == true)
				return ctrl.value;
			else
				return ; // no record checked
		}
	}
	return;
}
	
function setViewFrame(grid)
{
	var hw = screen.height
	var dv = document.getElementById(grid)
	if(hw == 600)
	dv.style.height=280
	else
	dv.style.height=440
}
//Purpose: To disable all submit buttons of a form while submitting the page
//window.document.body.onunload = DisableBtns;
//if (window.document.body.captureEvents) window.document.body.captureEvents(Event.UNLOAD);
var isSubmitMsgVisible = false
function ShowWait()
{
	var lbl = document.getElementById("lblWait")
	if(lbl)
	{
		lbl.className = "errmsg"
		lbl.innerText= "Processing your request.Please wait...";
		ShowElement("lblWait",true)
		document.body.style.cursor = "wait";
	}
}
function Checkbox_ConfirmDel(frm,name) // required to validate whtether at least on check boxes get selected while deleyting or no.
{
				
	var icount;
	icount =0;
	for(i=0;i< frm.length;i++)
			{
				e=frm.elements[i];
				if ( e.type=='checkbox' && e.name.indexOf(name) != -1 && e.checked == true)
					{
						icount =1;
						break;
					}
										
			}
			
			if (icount==0)
			{
				alert("Please select atleast one record to delete.");
				return false;
									
			}
			
			else
			
			{
				var v_confirm = confirm('Are you sure you want to delete?');
				return v_confirm;
			}
					
	}
	function Checkbox_Confirm(frm,name,action) // required to validate whtether at least on check boxes get selected while doing the action as specified or no.
	{
					
				var icount;
				icount =0;
				for(i=0;i< frm.length;i++)
						{
							e=frm.elements[i];
							if ( e.type=='checkbox' && e.name.indexOf(name) != -1 && e.checked == true)
							 {
							      icount =1;
							      break;
							 }
													
						}
						
						if (icount==0)
						{
						   alert("Please select atleast one record to " + action + ".");
						   return false;
											   
						}
						else
						{
						  return true;
						}
						
						
						
		}
	function ChangeRowColor(rowNum,tblname,chkStatus) // To highlight Grid row.
		{
			var tbl = document.getElementById(tblname)
			
			if(chkStatus != null)
			{
				var row = tbl.rows[rowNum];
				if(chkStatus == true)
					row.className = "HighLight"
				else
				{
					if(rowNum%2==0)
						row.className = "altrow2"
	     			else
	     				row.className = "altrow1"
				}
				return
			}
	     	for(var i=1;i<tbl.rows.length;i++)
	     	{
	     		var row = tbl.rows[i];
	     		if(i==rowNum)
	     			row.className = "HighLight"
	     		else
	     		{
	     			if(i%2==0)
	     				row.className = "altrow2"
	     			else
	     				row.className = "altrow1"
	     		}
	     	}
		}
		
    function CheckAll_childCheckBoxes(state,chkAll,frm,name) // child checkboxes are serverside control
    {
        // alert(state);
        // alert(chkAll);
        // alert(frm);
        // alert(frm.length);
         
        if(state==false)
					{
						document.getElementById(chkAll).checked=false;
					}
		else
					{
						var ret;
						for(i=0;i< frm.length;i++)
								{
									e=frm.elements[i];
									//alert(e.name)
									//alert(i)
									if ( e.type=='checkbox' && e.name != chkAll)
									{
										//alert(e.name)
										if (e.name.indexOf(name) != -1 && e.checked == true)
										{
										   ret =true;
										   continue;
										 }
										 else
										 {
										    ret =false;
									        break;
										 }
										  
									}
									
															
								}
						
						//alert (ret);
						if (ret==true)
						{
							document.getElementById(chkAll).checked=true;
						}
					}

    
    
    }	
function ChangeAllRowColors(tbl,chkState)
{
	var tbl = document.getElementById(tbl)
			
	   for(var i=1;i<tbl.rows.length;i++)
	   {
	     	var row = tbl.rows[i];
	     	if(chkState)
	     		row.className = "HighLight"
	     	else
	     	{
	     		if(i%2==0)
	     			row.className = "altrow2"
	     		else
	     			row.className = "altrow1"
	     	}
	   }
}	
/*  Functions for fixed table header row
    table->tr->td->div->grid{having fixed table header}
*/
function SetBorder(tblId)
{
	var tbl = document.getElementById(tblId)
	if(tbl)
	{
		/*for(var i=1;i<tbl.rows.length;i++)
		{
			for(var j=0;j<tbl.rows[i].cells.length;j++)
			{
				tbl.rows[i].cells[j].style.borderWidth = "1px" ;
				tbl.rows[i].cells[j].style.borderColor = "black" ; 
				tbl.rows[i].cells[j].style.borderStyle = " solid ";
			}
			
		}*/
	}
}  
function FixTableColumn(tblId,colNo)
{
	var tbl = document.getElementById(tblId)
	if(tbl)
	{
		for(var i=0;i<tbl.rows.length;i++)
		{
			/*if(i%2==0)
				tbl.rows[i].cells[colNo].className = "FixedRow2Heading" ; 
			else
				tbl.rows[i].cells[colNo].className = "FixedRow1Heading" ; */
				tbl.rows[i].cells[colNo].className = "FixedRowHeading" ;
		}
		//SetBorder(tblId)
		
	}
}
function FixTableRow(tblId,rowNo)
{
	var tbl = document.getElementById(tblId)
	if(tbl)
	{
		tbl.rows[rowNo].className = "FixedColHeading" ; 
		
		/*for(var i=0;i<tbl.rows[rowNo].cells.length;i++)
		{
			tbl.rows[rowNo].cells[i].style.borderRight = " 1px solid black"				   
			tbl.rows[rowNo].cells[i].style.borderBottom = " 1px solid black"
		}  */
		
	}	
}
function ConfirmAction(frm,name,action)
	{
			
		var icount;
		icount =0;
		for(i=0;i< frm.length;i++)
				{
					e=frm.elements[i];
					if ( e.type=='checkbox' && e.name.indexOf(name) != -1 && e.checked == true)
						{
							icount =1;
							break;
						}
											
				}
				
				if (icount==0)
				{
					alert("Please select at least one record to " + action + ".");
					return false;
										
				}
				
				else
				
				{
					var v_confirm = confirm("Are you sure you want to " + action + "?");
					 return v_confirm;
					/*if(v_confirm)
					{
						__doPostBack('btnDel','')
					}
					else
					return false;*/
				}
				
	}
	function ShowHideErrors(tblErr,state)
	{
		if(state)
		{
			ShowElement(tblErr,true);
			ShowElement("m" + tblErr,true);
			ShowElement("p" + tblErr,false);
		}
		else
		{
			ShowElement(tblErr,false);
			ShowElement("p" + tblErr,true);
			ShowElement("m" + tblErr,false);
		}
	}
	function GetText(obj)
	{
			if(document.all)
				return Trim(obj.innerText) ;
			else
				return Trim(obj.textContent) ;
	}
	function CalcLength(ctrlVal,maxLen,ctrlCtr)
	{
		
		if(event.keyCode==8 || event.keyCode==46)//backspace and delete key
		{
			ctrlCtr.value = maxLen - ctrlVal.value.length + 1
			if(parseInt(ctrlCtr.value) > parseInt(maxLen))
				ctrlCtr.value = maxLen
			return true;
		}
		if(parseInt(ctrlCtr.value)<=0)
		{
			ctrlCtr.value = 0
			return false;
		}
		ctrlCtr.value = maxLen - (ctrlVal.value == "" ? 1 : ctrlVal.value.length+1 )
		
		return true;
	}
	
function OpenModalWin(URL,Width,Height,Resize,WidthUnit)
{
	var tp,lft ,w;
	var sHeight,sWidth;
	var sFeatures ;
	Width = (Width == null? 650 : Width);
	Height = (Height == null ? 450 : Height);
	Resize = (Resize == null ? yes : Resize);
	WidthUnit = (WidthUnit == null ? "-1" : "%");

	sHeight = screen.height
	sWidth = screen.width
	if(WidthUnit == "%")
	{
		Height = (sHeight * Height)/100;
		Width = (sWidth * Width)/100;
	}
	tp = parseInt((sHeight-Height)/2)
	lft = parseInt((sWidth-Width)/2)
	
	
	var returnArray = new Array(); 
	var windowStyle = "dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;edge=raised;status=no;help=no+resizable=" + Resize + ";scroll=yes;center=yes";		
	returnArray = showModalDialog(URL,'',windowStyle);
	return returnArray;

}
//Purpose : to handle enter key hit while entering text in a textbox
function CheckSubmit(frm,btnName)
{
	if(event.keyCode == "13")
	{
		if(ValidateInput(frm))
		{
			document.frmMain.innerHTML += "<input type=hidden name=" + btnName + " value=Save>";
			frm.submit();
			return true;
		}
		else
			return false;
	}
	else
		return true; 
}
function SetTable(divId,gridId,maxRowCount,height,width)
{
	var dv = document.getElementById(divId);
	var tbl = document.getElementById(gridId);
	
	if(tbl)
	{
		if(tbl.rows.length > parseInt(maxRowCount))
		{
			if(dv)
			{
				dv.style.height = height
				if(width)
					dv.style.width = width ;
			
				dv.style.position = "relative";
				dv.style.overflow = "scroll";
			}
		
		}
		else
		{
			if(dv)
			{
				if(width)
					dv.style.width = width ;
			}
		}
	}
}


//ALS/ER0019 To populate in listbox in aligned format
//Added in Feb-Mar 2001
function ItemFormat(ControlValue,RequiredLength,DotRequired)
{
//This is made by Subrata Nayek
//This function is mainly for alignment in listbox.
   CVal = ControlValue //Value of Control
   CLen = ControlValue.length
   RLen = RequiredLength //Required Full Length 
   DReq = DotRequired //DReq=1 for Adding Dots at the End of Larger Control Value
	if(CLen<=RLen)
	{
	CLen=RLen-CLen
	for(j=0;j<CLen;j++)
	{
	CVal=CVal+" "
	}
	}
	else
	if(DReq==1)
	{
	CVal=CVal.substr(0,RLen-3)
	CVal=CVal+"..."
	}
   return CVal
}
