$(document).ready(
			function () {
				$('code').each(
					function() {
						eval($(this).html());
					}
				)
			}
		);
		var prevGridRowClass;
		function changeCssOnMouseover(gridRowId,cssClass)
		{
			prevGridRowClass=document.getElementById(gridRowId).className;
			document.getElementById(gridRowId).className=cssClass;				
		}
		function changeCssOnMouseout(gridRowId,cssClass)
		{
			document.getElementById(gridRowId).className=cssClass;
		}
		
function validateFormOnSubmit(id)
		{
			//alert(ag);
			var elementDivId="TR_" + id;
			var myDivElement = document.getElementById(elementDivId);
			var mySelects = myDivElement.getElementsByTagName('INPUT');						
			errorTextToDisplay = "";
			 for (var i=0;i<mySelects.length;i++)
				{
					if (mySelects[i].getAttribute("error_text") != null)
					{
						curVal = document.getElementById(mySelects[i].name).value;
						columnId=mySelects[i].name;
						errorText = mySelects[i].getAttribute("error_text");
						//alert(errorText)
						
						if (errorText == "" || errorText == null)    {
							errorTextArray = "";
							errorText = "";
							
						}    else    {
							myRegArray = errorText.split("~");
							errorTextArray = myRegArray[0].split("#");
							errorText = myRegArray[1].split("#");
							
						}
						//alert(errorTextArray.length);
						for (myRegCount = 0; myRegCount < errorTextArray.length; myRegCount++)
						{
							if ("isEmpty" == errorTextArray[myRegCount])
							{
								message=isBlank(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
									
								 }
									
							}
							if ("isBlank" == errorTextArray[myRegCount])
							{
								message=isBlank(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("isCharacter" == errorTextArray[myRegCount])
							{
								message=isCharacter(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("ischeckboxConfirm" == errorTextArray[myRegCount])
							{
								message=ischeckboxConfirm(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("isSpecialCharacter" == errorTextArray[myRegCount])
							{
								message=isSpecialCharacter(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
			
							if ("isFirstCharBlank" == errorTextArray[myRegCount])
							{
								message=isFirstCharBlank(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("isNumeric" == errorTextArray[myRegCount])
							{
								message=isNumeric(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("isEmail" == errorTextArray[myRegCount])
							{
								message=isEmail(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("isDecimal" == errorTextArray[myRegCount])
							{
								message=isDecimal(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
			
							if ("isDate" == errorTextArray[myRegCount])
							{
								message=isDate(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
							if ("isPhonrNumber" == errorTextArray[myRegCount])
							{
								message=isPhonrNumber(columnId,errorText[myRegCount]);
								 if(message!="")
								 {
									errorTextToDisplay += errorText[myRegCount] + "\n";
								 }
									
							}
											
							if ("FirstChar" == errorTextArray[myRegCount])
							{
								var first_char=curVal.charAt(0);
								if (first_char == " ")
								{
									errorTextToDisplay += errorText[myRegCount]+ "\n";
						
								}
							}
						}
					}
				}
				if (errorTextToDisplay !="")
				{
				alert(errorTextToDisplay);
				//displayMessage("gridErrorLabel",errorTextToDisplay,2);
				 return false;   
				}
			 return true;	
			}
function validateFormOnChange(columnId,errorText)
	{
		//alert(errorText);
		//return false;					
		errorTextToDisplay = "";				 
		if (errorText == "" || errorText == null)    {
			errorTextArray = "";
			errorText = "";
			
		}    else    {
			myRegArray = errorText.split("~");
			errorTextArray = myRegArray[0].split("#");
			errorText = myRegArray[1].split("#");
			
		}
		//alert(errorText);
		curVal = document.getElementById(columnId).value;
		//alert(curVal);
		for (myRegCount = 0; myRegCount < errorTextArray.length; myRegCount++)
		{
			if ("isEmpty" == errorTextArray[myRegCount])
			{
				message=isBlank(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isBlank" == errorTextArray[myRegCount])
			{
				message=isBlank(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isCharacter" == errorTextArray[myRegCount])
			{
				message=isCharacter(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("ischeckboxConfirm" == errorTextArray[myRegCount])
			{
				message=ischeckboxConfirm(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isSpecialCharacter" == errorTextArray[myRegCount])
			{
				message=isSpecialCharacter(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}

			if ("isFirstCharBlank" == errorTextArray[myRegCount])
			{
				message=isFirstCharBlank(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isNumeric" == errorTextArray[myRegCount])
			{
				message=isNumeric(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isEmail" == errorTextArray[myRegCount])
			{
				message=isEmail(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isDecimal" == errorTextArray[myRegCount])
			{
				message=isDecimal(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}

			if ("isDate" == errorTextArray[myRegCount])
			{
				message=isDate(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
			if ("isPhonrNumber" == errorTextArray[myRegCount])
			{
				message=isPhonrNumber(columnId,errorText[myRegCount]);
				 if(message!="")
				 {
					errorTextToDisplay += errorText[myRegCount] + "\n";
				 }
					
			}
							
			if ("FirstChar" == errorTextArray[myRegCount])
			{
				var first_char=curVal.charAt(0);
				if (first_char == " ")
				{
					errorTextToDisplay += errorText[myRegCount]+ "\n";
		
				}
			}
		}
		if (errorTextToDisplay !="")
		{
		alert(errorTextToDisplay);
		 //displayMessage("gridErrorLabels",errorTextToDisplay,2);
		 return false;   
		}
		return true;	
	}				
function download(downloadType,formName,gridId,gridQuery,queryLimit,paginationQuery,paginationType,isMultiLevelGridAllowed,multiLevelGridUrl,sortByColumnNameGridList,sortOrderGridList)
{
	//alert(HOST_ROOT_PATH_VAR +   "   "  + downloadType + "   " +  formName + "   " +  gridId + "   " +  gridQuery + "   " +  queryLimit + "   " + paginationQuery);
	document.getElementById('downloadType').value=downloadType;				
	$.post( HOST_ROOT_PATH_VAR + 'code/Plugin/GirdList/gridAjax.php', {'downloadType' : downloadType, 'id':gridId, 'query':gridQuery, 'formName':formName, 'queryLimit':queryLimit, 'paginationQuery':paginationQuery,'paginationType':paginationType,'isMultiLevelGridAllowed':isMultiLevelGridAllowed,'multiLevelGridUrl':multiLevelGridUrl,'sortByColumnNameGridList':sortByColumnNameGridList,'sortOrderGridList':sortOrderGridList}, getAjaxData, "json");
}
		
function getAjaxData(data, s)
{
	//alert(data.formName);
	if(data.success == 1)
	{
		document.getElementById('downloadGridHtml').value = data.gridHtml; 
		//document.getElementById(data.formName).submit(); 
		$("form#"+data.formName).submit();
		document.getElementById('downloadType').value="";
	}
}

function getGridDataByAjax(data, s)
	{
		//alert(data);
		if(data.success == 1)
		{
			//alert(data.paginationQuery );
			document.getElementById('div'+data.gridName+data.gridId).innerHTML=data.gridHtml;
			document.getElementById('pagination'+data.gridName+data.gridId).innerHTML = data.paginationHtml; 
			
		}
	}
function gridListActionPlugin(actionMode,actionParameterHFID,rowId,gridName,formName,gridId,gridQuery,queryLimit,paginationQuery,paginationType,isMultiLevelGridAllowed,multiLevelGridUrl,sortByColumnNameGridList,sortOrderGridList)
{
	
	var answer=true;			
	if(actionMode == "A")
	{
				
	}			
	if(actionMode == "U")
	{				
		answer=validateFormOnSubmit(rowId);					
		var modifyColumnArray=document.getElementsByName('columnNameid[]');			
		var gridListModifyParameterArray = new Array(10);	
		var gridListModifyString='';		
		for (var countArray=0;  countArray < modifyColumnArray.length;  countArray++)
		{	
			gridListModifyParameterArray[countArray] = new Array(2);					
			gridListModifyParameterArray[countArray][0] = modifyColumnArray[countArray].value;
			gridListModifyParameterArray[countArray][1] = document.getElementById(gridName+"Modify"+modifyColumnArray[countArray].value+rowId).value;	
			gridListModifyString+='~!@#'+gridListModifyParameterArray[countArray][0]+'~!@#'+gridListModifyParameterArray[countArray][1];
			//alert("gridListModifyParameterArray[" + countArray + "][0]" + gridListModifyParameterArray[countArray][0] + "\n" + "gridListModifyParameterArray[" + countArray + "][1]" + gridListModifyParameterArray[countArray][1] + "\n");
		}
	}
	//alert(gridListModifyString);
	var gridListActionParameterArray = new Array(10);
	var columnNameArray=document.getElementById(actionParameterHFID).value;
	//alert(columnNameArray);	
	var columnName=columnNameArray.split(",");
	for (var count=0;  count < columnName.length;  count++)
	{	
		gridListActionParameterArray[count] = new Array(2);
		gridListActionParameterArray[count][0] = columnName[count];
		gridListActionParameterArray[count][1] = document.getElementById(gridName+columnName[count]+"Row"+rowId).value;
		
		//alert("gridListActionParameterArray[" + count + "][0]" + gridListActionParameterArray[count][0] + "\n" + "gridListActionParameterArray[" + count + "][1]" + gridListActionParameterArray[count][1] + "\n");
	}
	
	var paginationCurrentPage		= '';
	var linksPageSet				= '';
	var linksToDisplayPagination	= '';
	var recordsPerPage				= '';
	
	if(document.getElementById('paginationCurrentPage'+gridId))
	{
		paginationCurrentPage		= document.getElementById('paginationCurrentPage'+gridId).value;
	}
	if(document.getElementById('linksPageSet'+gridId))
	{
		linksPageSet				= document.getElementById('linksPageSet'+gridId).value;
	}
	if(document.getElementById('linksToDisplayPagination'+gridId))
	{
		linksToDisplayPagination	= document.getElementById('linksToDisplayPagination'+gridId).value;
	}
	if(document.getElementById('recordsPerPage'+gridId))
	{
		recordsPerPage				= document.getElementById('recordsPerPage'+gridId).value;	
	}
	
	if(answer)
	{	
		eval (gridName + "Action(actionMode, gridListActionParameterArray,gridListModifyString);");
		//alert(eval (gridName + "Action(actionMode, gridListActionParameterArray,gridListModifyString);"))
		$.post( HOST_ROOT_PATH_VAR + 'code/Plugin/GirdList/gridAjax.php', {'id':gridId, 'query':gridQuery, 'formName':formName, 'queryLimit':queryLimit, 'paginationQuery':paginationQuery,'paginationType':paginationType,'isMultiLevelGridAllowed':isMultiLevelGridAllowed,'multiLevelGridUrl':multiLevelGridUrl,'sortByColumnNameGridList':sortByColumnNameGridList,'sortOrderGridList':sortOrderGridList,'paginationCurrentPage':paginationCurrentPage,'linksPageSet':linksPageSet ,'linksToDisplayPagination':linksToDisplayPagination,'recordsPerPage':recordsPerPage}, getGridDataByAjax, "json");
	}
}
		
	
	
function sortByColumn(columnName,formName)
{
	document.getElementById('sortByColumnNameGridList').value=columnName;
	eval("document.getElementById('" + formName + "').submit();");
}		

function switchMenu(Id,DivId) 
{	
	if ((document.getElementById(Id).src) == HOST_ROOT_PATH_VAR + "images/plus_img.gif" ) 
	{
		document.getElementById(Id).src= HOST_ROOT_PATH_VAR + "images/minus_img.gif";
		document.getElementById(DivId).style.display = 'block';				
	}
	else
	{
		document.getElementById(Id).src = HOST_ROOT_PATH_VAR + "images/plus_img.gif";
		document.getElementById(DivId).style.display = 'none';
	}
}