/*---------------------------------------------------------------------------------------------
File name		: FormFunctions.js
Purpose			: It comprises of all the javascript functions required for the form controls.
Author			: Aman Gulati
Created on		: 04/07/2005
Last modified	: 
---------------------------------------------------------------------------------------------
Copyright(2004) : 
Developed By	: R Systems International Systems Ltd., Noida (INDIA)
---------------------------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
Function Name	: CheckAll
Purpose			: Call this function in the "onClick" event of chkCheckAll checkbox and 
					pass your "Form" name as parameter. 
					It will check/uncheck the chkDelete checkbox(s).
Input			: formname
Return			: values set into hidden controls
------------------------------------------------------------------------------*/
function trimString (str) 
{
/**********************************************************************************************
* FUNCTION NAME : trimString(str)
* AUTHOR		: PUNEET GUPTA
* DESCRIPTION	: USED TO TRIM WHITESPACES FROM A STRING 
***********************************************************************************************/
//through regular expression
str = this != window? this : str;
return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function CheckAll(form)		
{
	var strCheckValue = "";
	var isReport;
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if ((e.name != 'chkCheckAll') && (e.type=='checkbox') && (e.name == 'chkDelete' || e.name == 'chkReport') && (!e.disabled))
		{
			e.checked = form.chkCheckAll.checked;
			if (e.name == 'chkReport')
				isReport = true;
			else if (e.name == 'chkDelete')
				isReport = false;
		}
	}
	//Call to set the Hidden Box Value
	if (isReport)
		setHiddenRbtnValue(form)
	else
		setHiddenBoxValue(form)
}
		
/*----------------------------------------------------------------------------
Function Name	: setHiddenBoxValue
Purpose			: Call this function to set the value of the hidden text
Input			: formname
Return			: none
------------------------------------------------------------------------------*/

function setHiddenBoxValue(form)
{
	var strCheckValue = "";
	for (var i=0;i<form.elements.length;i++)
	{	
		var e = form.elements[i];
		if ((e.name != 'chkCheckAll') && (e.type=='checkbox') && (e.name == 'chkDelete') && (!e.disabled) && (e.checked))
		{
			if (strCheckValue == "")
			{
				strCheckValue = e.id; 
			}
			else
			{
				strCheckValue = strCheckValue + ', ' + e.id;
			}
		}
	}
	form.hdnCheckValue.value = strCheckValue;
}

/*----------------------------------------------------------------------------
Function Name	: CheckSingle
Purpose			: Call this function in the "onClick" event of every chkDelete checkbox and 
					pass your "Form" name as parameter. 
					It will check/uncheck the chkCheckAll checkbox.
Input			: formname
Return			: values set into hidden controls
------------------------------------------------------------------------------*/

function CheckSingle(form)	
{
	var TotalBoxes = 0;
	var TotalCheckedBoxes = 0;
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if ((e.name != 'chkCheckAll') && (e.type=='checkbox') && (e.name == 'chkDelete') && (!e.disabled))
		{
			TotalBoxes++;
			if (e.checked)
			{
				TotalCheckedBoxes++;
			}
		}
	}
	if (TotalBoxes==TotalCheckedBoxes)
	{
		form.chkCheckAll.checked=true;
	}
	else
	{
		form.chkCheckAll.checked=false;
	}
	//Call to set the Hidden Box Value
	setHiddenBoxValue(form);
}
		
/*----------------------------------------------------------------------------
Function Name	: SelectedChk
Purpose			: This function is called when the user clicks on the delete link.
Input			: formname
Return			: True/False
------------------------------------------------------------------------------*/

function SelectedChk()
{
	var jsMsgDoYouWish = document.getElementById('UclDatagrid1_jsMsgDoYouWish').value;
	var jsMsgSelectAtLeast = document.getElementById('UclDatagrid1_jsMsgSelectAtLeast').value;
	if (document.forms[0].hdnCheckValue.value !="")
	{
		return confirm(jsMsgDoYouWish);
	}
	else
	{
		alert(jsMsgSelectAtLeast);
		return false;
	}
}

/*----------------------------------------------------------------------------
Function Name	: SelectedChk
Purpose			: This function is called when the user clicks on the delete link.
Input			: formname
Return			: True/False
------------------------------------------------------------------------------*/

function SelectedComboDatagridChk(varClientID)
{
	var jsMsgDoYouWish = document.getElementById(varClientID + '_jsMsgDoYouWish').value;
	var jsMsgSelectAtLeast = document.getElementById(varClientID + '_jsMsgSelectAtLeast').value;
	if (document.forms[0].hdnCheckValue.value !="")
	{
		return confirm(jsMsgDoYouWish);
	}
	else
	{
		alert(jsMsgSelectAtLeast);
		return false;
	}
}


/*----------------------------------------------------------------------------
Function Name	: ChkLength25
Purpose			: Function to check whether the Value in the field exceeds 25 characters
Input			: source,args
Return			: True/False
------------------------------------------------------------------------------*/

function ChkLength25(source,args)
{
	var iDescLength;
	iDescLength = args.Value.length;
    if(iDescLength > 25)
    {
            args.IsValid=false;
    }
    else
    {
            args.IsValid=true;
    }
}
		
/*----------------------------------------------------------------------------
Function Name	: ChkLength50
Purpose			: Function to check whether the Value in the field exceeds 50 characters
Input			: source,args
Return			: True/False
------------------------------------------------------------------------------*/

function ChkLength50(source,args)
{
	var iDescLength;
	iDescLength = args.Value.length;
    if(iDescLength > 50)
    {
            args.IsValid=false;
    }
    else
    {
            args.IsValid=true;
    }
}
	
/*----------------------------------------------------------------------------
Function Name	: ChkLength120
Purpose			: Function to check whether the Value in the field exceeds 120 characters
Input			: source,args
Return			: True/False
------------------------------------------------------------------------------*/

function ChkLength120(source,args)
{
	var iDescLength;
	iDescLength = args.Value.length;
    if(iDescLength > 120)
    {
            args.IsValid=false;
    }
    else
    {
            args.IsValid=true;
    }
}

/*----------------------------------------------------------------------------
Function Name	: ChkLength120
Purpose			: Function to check whether the Value in the field exceeds 120 characters
Input			: source,args
Return			: True/False
------------------------------------------------------------------------------*/

function ChkLength500(source,args)
{
	var iDescLength;
	iDescLength=args.Value.length;
	
    if(iDescLength > 500)
    {
            args.IsValid=false;
    }
    else
    {
            args.IsValid=true;
    }
}
/*----------------------------------------------------------------------------
Function Name	: SelectedChkRpt
Purpose			: This function is called when the user clicks on the view report link.
Input			: formname
Return			: True/False
------------------------------------------------------------------------------*/

function SelectedChkRpt(form)
{
	var jsMsgSelectAtLeast = form.jsMsgSelectAtLeast.value;
	if (form.hdnRbtnValue.value != "")
	{
		return true;
	}
	else
	{
		alert(jsMsgSelectAtLeast);
		return false;
	}
}

/*----------------------------------------------------------------------------
Function Name	: setHiddenRbtnValue
Purpose			: Call this function to set the value of the hidden text
Input			: formname
Return			: none
------------------------------------------------------------------------------*/

function setHiddenRbtnValue(form)
{
	var strCheckValue = "";
	for (var i=0;i<form.elements.length;i++)
	{	
		var e = form.elements[i];
		if ((e.type=='radio') && (e.name == 'rbtnReport') && (!e.disabled) && (e.checked))
		{
			if (strCheckValue == "")
			{
				strCheckValue = e.id; 
			}
			else
			{
				strCheckValue = "";
			}
		}
		else if ((e.type=='checkbox') && (e.name == 'chkReport') && (!e.disabled) && (e.checked))
		{
			if (strCheckValue == "")
			{
				strCheckValue = e.id; 
			}
			else
			{
				strCheckValue = strCheckValue + ', ' + e.id;
			}
		}
	}
	form.hdnRbtnValue.value = strCheckValue;
}

/*----------------------------------------------------------------------------
Function Name	: CheckSingle
Purpose			: Call this function in the "onClick" event of every chkDelete checkbox and 
					pass your "Form" name as parameter. 
					It will check/uncheck the chkCheckAll checkbox.
Input			: formname
Return			: values set into hidden controls
------------------------------------------------------------------------------*/

function CheckRbtn(form)	
{
	var TotalBoxes = 0;
	var TotalCheckedBoxes = 0;
	var isCheckBox;
	isCheckBox = false;
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if ((e.name != 'chkCheckAll') && (e.type=='checkbox') && (e.name == 'chkReport') && (!e.disabled))
		{
			isCheckBox=true;
			TotalBoxes++;
			if (e.checked)
			{
				TotalCheckedBoxes++;
			}
		}
	}
	if (isCheckBox)
	{
		if (TotalBoxes==TotalCheckedBoxes)
		{
			form.chkCheckAll.checked=true;
		}
		else
		{
			form.chkCheckAll.checked=false;
		}
	}
	//Call to set the hidden value
	setHiddenRbtnValue(form);	
}

/*----------------------------------------------------------------------------
Function Name	: popUpComboValue
Purpose			: This will display a Pop Up Menu
Input			: the Control
Return			: PopUp Box
------------------------------------------------------------------------------*/
var oPopup = window.createPopup();
function popUpComboValue(objValue)
{
    x= window.event.clientX;
    y= window.event.clientY;
    
    var oPopBody = oPopup.document.body;
    var iMaxLength;
    var iMaxHeight;
    var iXDisplacement;
    var iLen;
    var iCount;
    var strText;
    var finalCount;
    iLen = objValue.options[objValue.selectedIndex].innerText.length
    //objValue.options[objValue.selectedIndex].innerText = '01234567890123456789012340123456789012345678901234'
    //
    iCount = 0
    iMaxHeight = 0
    strText = ""
    finalCount = (iLen/25)
//    alert(objValue.options[objValue.selectedIndex].innerText)
	while(finalCount > 0)
    {
		if (strText == '')
			strText = objValue.options[objValue.selectedIndex].innerText.substring(iCount, iCount+25)
		else
			strText = strText + ' ..\n ' + objValue.options[objValue.selectedIndex].innerText.substring(iCount, iCount+25)
		iMaxHeight = iMaxHeight + 15
		finalCount = finalCount - 1
		iCount = iCount + 25
	}
    
    /*
    if (iLen <= 25)
    {
    		iMaxLength = 160;
			iMaxHeight= 16;
			iXDisplacement = 150;
	}
    else if (iLen >= 25 && iLen <= 50)
    {
		
    		iMaxLength = 160;
			iMaxHeight= 48;
			iXDisplacement = 150;
	}
	else if (iLen >= 50 && iLen <= 200)
    {
			iMaxLength = 505;
			iMaxHeight = 29;
			iXDisplacement = 250;
	}
	else if (iLen >= 200 && iLen <= 500)
    {
			iMaxLength = 505;
			iMaxHeight = 50;
			iXDisplacement = 250;
	}*/
	
	iMaxLength  = 140
	iXDisplacement = 80
    oPopBody.style.backgroundColor = "#E1E1F1";
    oPopBody.style.border = "solid black 1px";
    oPopBody.style.margin = "0 0 0 3px;"
    if(objValue.disabled == false && objValue.length>0)
    {
		//alert(strText)
		oPopBody.innerHTML = strText
		oPopBody.style.fontSize = "11px";
		oPopBody.style.fontFamily = "Arial";
		oPopup.show(x-iXDisplacement , y+15, iMaxLength , iMaxHeight, document.body);
    }
}
function hidePopUp()
{
	oPopup.hide();
}

/*----------------------------------------------------------------------------
Function Name	: PageReload
Purpose			: This will reload the page after searching for the specified criteria
Input			: None
Return			: None
------------------------------------------------------------------------------*/
function PageReload()
{
	window.location.reload() ;
}


/*----------------------------------------------------------------------------
Function Name	: OpenSearchWindow
Purpose			: This function opens the Search window
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var SearchWindow;
function OpenSearchWindow(strSearchPath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (SearchWindow && SearchWindow.open && !SearchWindow.closed)
	{
		if (confirm('Please note that you already have a Search Window Open.\nThe Previous window would be closed.'))
		{
			SearchWindow.close()
			
			strSearchPath = '../' + strSearchPath
			SearchWindow = window.open(strSearchPath,'','scrollbars=1, width=750, height=505, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			SearchWindow.focus();
	}
	else
	{
		strSearchPath = '../' + strSearchPath
		SearchWindow = window.open(strSearchPath,'','scrollbars=1, width=750, height=505, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}
/*----------------------------------------------------------------------------
Function Name	: OpenExportWindow
Purpose			: This function opens the Export window
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var ExportWindow;
function OpenExportDataWindow(strExportPath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (ExportWindow && ExportWindow.open && !ExportWindow.closed)
	{
		if (confirm('Please note that you already have a Export Window Open.\nThe Previous window would be closed.'))
		{
			ExportWindow.close()
			
			strExportPath = '../' + strExportPath
			ExportWindow = window.open(strExportPath,'','scrollbars=1, width=600, height=450, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			ExportWindow.focus();
	}
	else
	{
		strExportPath = '../' + strExportPath
		ExportWindow = window.open(strExportPath,'','scrollbars=1, width=600, height=450, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}

/*----------------------------------------------------------------------------
Function Name	: OpenImportWindow
Purpose			: This function opens the Export window
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var ImportWindow;
function OpenImportWindow(strImportPath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (ImportWindow && ImportWindow.open && !ImportWindow.closed)
	{
		if (confirm('Please note that you already have a Import Window Open.\nThe Previous window would be closed.'))
		{
			ImportWindow.close()
			
			strImportPath = '../' + strImportPath
			ImportWindow = window.open(strImportPath,'','scrollbars=1, width=550, height=250, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			ImportWindow.focus();
	}
	else
	{
		strImportPath = '../' + strImportPath
		ImportWindow = window.open(strImportPath,'','scrollbars=1, width=550, height=250, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}
/*----------------------------------------------------------------------------
Function Name	: OpenComboSelectWindow
Purpose			: This function opens the Select window instead of a Combobox
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var ComboSelectWindow;
function OpenComboSelectWindow(strComboSelectPath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (ComboSelectWindow && ComboSelectWindow.open && !ComboSelectWindow.closed)
	{
		if (confirm('Please note that you already have a Combo Window Open.\nThe Previous window would be closed.'))
		{
			ComboSelectWindow.close()
			
			strComboSelectPath = '../' + strComboSelectPath
			ComboSelectWindow = window.open(strComboSelectPath,'','scrollbars=yes, width=650, height=452, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			ComboSelectWindow.focus();
	}
	else
	{
		strComboSelectPath = '../' + strComboSelectPath
		ComboSelectWindow = window.open(strComboSelectPath,'','scrollbars=yes, width=650, height=452, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}

/*----------------------------------------------------------------------------
Function Name	: OpenListCntrlWindow
Purpose			: This function opens the Select window instead of a List Control
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var ListCntrlWindow;
function OpenListCntrlWindow(strListCntrlPath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (ListCntrlWindow && ListCntrlWindow.open && !ListCntrlWindow.closed)
	{
		if (confirm('Please note that you already have a List Control Window Open.\nThe Previous window would be closed.'))
		{
			ListCntrlWindow.close()
			
			strListCntrlPath = '../' + strListCntrlPath 
			ListCntrlWindow = window.open(strListCntrlPath,'','scrollbars=yes, width=650, height=455, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			ListCntrlWindow.focus();
	}
	else
	{
		strListCntrlPath = '../' + strListCntrlPath 
		ListCntrlWindow = window.open(strListCntrlPath,'','scrollbars=yes, width=650, height=455, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}

/*----------------------------------------------------------------------------
Function Name	: OpenPageHelp_Collapse
Purpose			: This function opens the Help Page pop up menu
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var PageHelp_CollapseWindow;
function OpenPageHelp_Collapse(strHelpPagePath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (PageHelp_CollapseWindow && PageHelp_CollapseWindow.open && !PageHelp_CollapseWindow.closed)
	{
		if (confirm('Please note that you already have a Help Window Open.\nThe Previous window would be closed.'))
		{
			PageHelp_CollapseWindow.close()
			
			strHelpPagePath = '../' + strHelpPagePath 
			PageHelp_CollapseWindow = window.open(strHelpPagePath,'','scrollbars=yes, width=600, height=455, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			PageHelp_CollapseWindow.focus();
	}
	else
	{
		strHelpPagePath = '../' + strHelpPagePath 
		PageHelp_CollapseWindow = window.open(strHelpPagePath,'','scrollbars=yes, width=600, height=455, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}

/*----------------------------------------------------------------------------
Function Name	: OpenExportWindow
Purpose			: This function opens the Export Page pop up menu
Input			: strPageName
Return			: False
------------------------------------------------------------------------------*/
var ExportWindow;
function OpenExportWindow(strExportWindowPath)
{
	var intWidth;
	var intHeight;
	
	var scrWidth;
	var scrHeight;
	
	scrWidth = parseInt((screen.width)/5)
	scrHeight = parseInt((screen.height)/4)
	
	if (ExportWindow && ExportWindow.open && !ExportWindow.closed)
	{
		if (confirm('Please note that you already have a Export Window Open.\nThe Previous window would be closed.'))
		{
			ExportWindow.close()
			
			strExportWindowPath = '../' + strExportWindowPath 
			ExportWindow = window.open(strExportWindowPath,'','scrollbars=yes, width=600, height=455, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
		}
		else
			ExportWindow.focus();
	}
	else
	{
		strExportWindowPath = '../' + strExportWindowPath 
		ExportWindow = window.open(strExportWindowPath,'','scrollbars=yes, width=600, height=455, left=' + scrWidth + ', top=' + scrHeight + ', resizable=no');
	}
	return false;
}

//This function trims off the white spaces
function Trim(strTrimValue)
{
	if(strTrimValue.length < 1)
	{
		return"";
	}
	strTrimValue = RTrim(strTrimValue);
	strTrimValue = LTrim(strTrimValue);
	if(strTrimValue=="")
	{
		return "";
	}
	else
	{
		return strTrimValue;
	}
} 

//This function trims off the trailing white spaces
function RTrim(strValue)
{
	var w_space = String.fromCharCode(32);
	var v_length = strValue.length;
	var strTemp = "";
	if(v_length < 0)
	{
		return"";
	}
	var iTemp = v_length -1;
	while(iTemp > -1)
	{
		if(strValue.charAt(iTemp) == w_space)
		{
		}
		else
		{
			strTemp = strValue.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} 
	return strTemp;
} 

//To trim off the leading white spaces
function LTrim(strValue)
{
	var w_space = String.fromCharCode(32);
	if(v_length < 1)
	{
		return"";
	}
	var v_length = strValue.length;
	var strTemp = "";
	var iTemp = 0;

	while(iTemp < v_length){
	if(strValue.charAt(iTemp) == w_space)
	{
	}
	else
	{
		strTemp = strValue.substring(iTemp,v_length);
		break;
	}
	iTemp = iTemp + 1;
	} 
	return strTemp;
} 

//This function restrains the user from using mouse right button
function stopthief(ie) 
{
	var warning = "Right clicking this page is not allowed.";
	if (navigator.appName == 'Netscape' && ie.which == 3) 
	{
		alert(warning);
		return false;
	}
	else
		if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) 
	{
		alert(warning);
		return false;
	}
	return true;
}

//Function to Read the Value of the Cookie from the Client Machine
function getCookies(name) 
{
	var prefix = name + '=';
	var cookieStartIndex = document.cookie.indexOf(prefix);
	if (cookieStartIndex == -1)
	{
		return 'None';
	}
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
	{
		cookieEndIndex = document.cookie.length;
	}
	return document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex);
}

//Drop Down Functionality
function clear_value()
        {
			obj = window.event.srcElement;
			obj.setAttribute("persistValue","");
        }

function divert_entry()
{
	obj = window.event.srcElement;
    //debugger;
    if  (obj.getAttribute("persistValue") == null)
            obj.setAttribute("persistValue","");                           
    var iKey;
    var eAny_Event = window.event;
    iKey = eAny_Event.keyCode;
    var sChr = String.fromCharCode(iKey);
    if (iKey == 13)
    {
			obj.setAttribute("persistValue","");
            return true;
    }
    if (iKey == 27)
    {
            sDelete_Chr = obj.getAttribute("persistValue");
            obj.setAttribute("persistValue", sDelete_Chr.substring(0,sDelete_Chr.length - 1));
            sChr = '';
    }
    obj.setAttribute("persistValue",obj.getAttribute("persistValue") + sChr);
    lookupItem(obj);
    if ((((iKey > 33) && (iKey < 255)) || (iKey == 8)) && (iKey != 40) && (iKey != 38))
            eAny_Event.returnValue = false;
}

function lookupItem(obj)
{
		var sCurValue = obj.getAttribute("persistValue").toLowerCase();
        var bFound = false;
        var iIndex = obj.selectedIndex;
        var iNumOptions = obj.options.length;
        var iPos = 0;
        // Repeat until found or end of list is reached
        while ((!bFound) && (iPos < iNumOptions))
        {
                // Do comparisons in lowercase
                bFound = (obj.options[iPos].text.toLowerCase().indexOf(sCurValue)==0) ;
                if (bFound)
                        iIndex = iPos;
                iPos++;
        }
        if (bFound)
                // Updated listbox
                obj.selectedIndex = iIndex;
}
//This function restrains the user from using mouse right button
function CheckAndValidateLength(strText) 
{
	strText=Trim(strText);
	if(strText.length >0)
	{
		if(strText.length <3)
			{
			alert('Please use atleast three characters in the search criteria selected');
			return false;
			}
	
	}
return true;	
}
function CheckAndValidateBlankString(strText) 
{
	strText=Trim(strText);
	if(strText.length <1)
		return false;
return true;	
}
function CompareEqualString(strText,strNext) 
{
	strText=Trim(strText);
	strNext=Trim(strNext);
	if(strText == strNext)
		return true;
		else
		return false;

}


function CheckAndTextBoxesForSearchReport(strText1,strText2,strText3,strText4) 
{
 
	if (CheckIsZeroLength(strText1)==false)
		return true; 
	if (CheckIsZeroLength(strText2)==false)
		return true; 
	if (CheckIsZeroLength(strText3)==false)
		return true; 
	if (CheckIsZeroLength(strText4)==false)
		return true; 
	
alert('Please use one or more search criteria');
return false;
}
function CheckIsZeroLength(strText) 
{
 
	strText=Trim(strText);
	if (strText.length<1)
		return true;
	return false;
}
