function PageLoadFn()
{
	return true;
}
function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}


if (window.parent && window.parent.synchTab)
  window.parent.synchTab(window.name);
  
function ShowHideBothWOAjax( id, form , SaveIDCtrl) 
{
	var id1 = id + '_1';
	ShowHide( id1);
	//ShowHide( id1+id1);

	var id2 = id + '_2';
	ShowHide( id2);
	//ShowHide( id2+id2);
	var ctrl = form[SaveIDCtrl];
	var otherID = ctrl.value;
	if( otherID != '' )
	{
		var id3 = otherID + '_1';
		ShowHide(id3);
		//ShowHide(id3+id3);

		var id4 = otherID + '_2';
		ShowHide(id4);
		//ShowHide(id4+id4);
	}

	ctrl.value = id;
}



function ShowHideBoth( id, form , SaveIDCtrl,accName) 
{
	var id1 = id + '_1';
	ShowHide( id1);

	var id2 = id + '_2';
	ShowHide( id2);

	var ctrl = form[SaveIDCtrl];
	var otherID = ctrl.value;
	
	if( otherID != '' )
	{
		var id3 = otherID + '_1';
		ShowHide(id3);

		var id4 = otherID + '_2';
		ShowHide(id4);
	}
	
//################################################################################
//Code Added by: Vg_23_10_2007

	form.RadioName.value=accName + '_' + document.getElementById(id).value; //string made of 'AccountName, _ , id
	var varId=id.substring(id.length-(id.length-4));
	var dupOwner=document.getElementById('EntityOwnerDup').value;
	var cmbActionVal=document.getElementById('Action').value;
	if (id.substring(3,4)==4)//if entity split ownership
        HSradioClick(accName);  //Call Ajax function in js/AjaxScript.js
    else if (id.substring(3,4)==1 && dupOwner=='' && cmbActionVal=='OwnHs' )//entity Duplication
    {
        var frm = document.BuildHousehold;
		var selmem = getCheckedValue(frm.selmember);
        var entName=document.getElementById('OwnerCombo').value;
		var entId=selmem.substring(2,4);
	    HSradioClickEnt(entName,entId,'Owner');//Call Ajax function
    }
    else if ((id.substring(3,4)==1 || id.substring(3,4)==2) && dupOwner=='' && cmbActionVal=='AddAcct' )//Account Duplication
    {
        var frm = document.BuildHousehold;
		var selmem = getCheckedValue(frm.selmember);
        var entName=document.getElementById('AcctCombo').value;
		var entId=selmem.substring(2,4);
	    HSradioClickEnt(entName,entId,'Account');//Call Ajax function
        
    }
	else                    // if Account
       HSradioClick(varId); //Call Ajax function in js/AjaxScript.js
       
//##########            //##########           //##########           //##########
	ctrl.value = id;
}

function ShowHide( id ) 
{
//alert (id);
	var e = document.getElementById(id);
	if(e.style.display == 'none')
		e.style.display = 'block';
	else
		e.style.display = 'none';
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) 
{
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
	{
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	}
	
	for(var i = 0; i < radioLength; i++) 
	{
		if(radioObj[i].checked) 
		{
			return radioObj[i].value;
		}
	}
	return "";
}

function IsFutureDate( d ) 
{
	var dt1mdy = d.split("/");
	var dt1 = new Date();
	var yr = parseInt(dt1mdy[2]);
	if ( yr < 2000 )
		yr += 2000;

	dt1.setFullYear( yr, parseInt(dt1mdy[0])-1, parseInt(dt1mdy[1]));
	
	var curDate = new Date();
	if ( dt1 > curDate )
		return true;
	return false;
}

function DateDiff( d1, d2 )
{
	//if d1 < d2, return negative numbers showing #days d1 and d2 are apart
	//if d1 > d2, return positive numbers showing #days d1 and d2 are apart
	//if d1 = d2, return 0

	var dt1mdy = d1.split("/");
	var dt1 = new Date();
	var yr = parseInt(dt1mdy[2]);
	if ( yr < 2000 )
		yr += 2000;
	dt1.setFullYear( yr, parseInt(dt1mdy[0])-1, parseInt(dt1mdy[1]));

	var dt2mdy = d2.split("/");
	var dt2 = new Date();
	yr = parseInt(dt2mdy[2]);
	if ( yr < 2000 )
		yr += 2000;
	dt2.setFullYear( yr, parseInt(dt2mdy[0])-1, parseInt(dt2mdy[1]));

	var diff = new Date();
	diff.setTime(Math.abs(dt2.getTime() - dt1.getTime()));
	timediff = diff.getTime();

	days = Math.floor( timediff/(1000 * 60 * 60 * 24 ));

	if ( dt1 < dt2)
		days *= -1;

	return days;
}

function vwlbl(portfile)
{
	window.location = "Tabs.aspx?tabname=writeclientmenu&portfile=" + portfile + "&sid=1"
	return true;
}

function Only1Sel( frm, matchName )
{
	var count = frm.elements.length;
	var bAtLeastOne = false;
	var cnt=0;
	cnt=cnt-0;
	for (var i = 0; i < count; i++) 
  	{
		var e = frm.elements[i];
		if ( e.name == matchName )
    	{
    		if (e.checked== 1)
			{
			    cnt=cnt+1;
			}
   		}
   		if(cnt >1)
   		    return false
  	}
				return true;
}

function AtLeast1Sel( frm, matchName )
{
	var count = frm.elements.length;
	var bAtLeastOne = false;
	for (var i = 0; i < count; i++) 
  	{
		var e = frm.elements[i];
		if ( e.name == matchName )
    	{
    		if (e.checked== 1)
			{
				return true;
			}
   		}
  	}
	return false
}

function ValidateGoToPage()
{
	var pn = document.getElementById('navtopagenum');
	if( pn.value == '' )
	{
		alert('Please enter the page number!');
		return false;
	}

	var a = document.getElementById('navaction');
	a.value = 'gotopage';

	var np = document.getElementById('navnumpages');

	var pnval = parseInt(pn.value);
	if( pnval > parseInt(np.value) )
	{
		pn.value = np.value;
	}
	
	if( pnval < 0 )
		pn.value = 1;

	var f = document.getElementById('navcurpage');
	if (f.value == pn.value )
		return false;

	return true;
}
//Add By Umesh 2008/02/20
//when a = 1 then validations will be done for upper navigation bar
//when a = 2 then validations will be done for upper navigation bar
function ValidGoToPageSort(a)
{
    	
    document.getElementById('cmbid').value = a;
    if(a==1)
    {
        var val = document.getElementById('navtopagenum');
        var isNumeric;
	    isNumeric=chkNumeric(val,"","","","","","go to page");
	    if( isNumeric == false )
	    {
		    val.value="";
		    val.focus();
		    return false;
	    }
        var pn = document.getElementById('navtopagenum');
	    if( pn.value == '' )
	    {
		    alert('Please enter the page number!');
		    return false;
	    }

	    var a = document.getElementById('navaction');
	    a.value = 'gotopage';

	    var np = document.getElementById('navnumpages');

	    var pnval = parseInt(pn.value);
	    if( pnval > parseInt(np.value) )
	    {
		    pn.value = np.value;
	    }
    	
	    if( pnval <= 0 )
		    pn.value = 1;

	    var f = document.getElementById('navcurpage');
	    if (f.value == pn.value )
		    return false;

	    return true;
    }
    else
    {
        var val = document.getElementById('navtopagenum2');
        var isNumeric;
	    isNumeric=chkNumeric(val,"","","","","","go to page");
	    if( isNumeric == false )
	    {
		    val.value="";
		    val.focus();
		    return false;
	    }
        var pn = document.getElementById('navtopagenum2');
	    if( pn.value == '' )
	    {
		    alert('Please enter the page number!');
		    return false;
	    }

	    var a = document.getElementById('navaction2');
	    a.value = 'gotopage';

	    var np = document.getElementById('navnumpages2');

	    var pnval = parseInt(pn.value);
	    if( pnval > parseInt(np.value) )
	    {
		    pn.value = np.value;
	    }
    	
	    if( pnval <= 0 )
		    pn.value = 1;

	    var f = document.getElementById('navcurpage2');
	    if (f.value == pn.value )
		    return false;

	    return true;
    }
	
}



function ValidateSetPages()
{
	var x = document.getElementById('rowsperpage');
	pn = x.value;
	if( pn == '' )
	{
		alert('Please enter the rows per page!');
		return false;
	}

	var np = parseInt(pn);
	if ( np < 0 )
		x.value = 20;

	if ( np > 1000 )
		x.value = 1000;

	return true;
}

//add By Umesh 2008/02/20
//when a = 1 then validations will be done for upper navigation bar
//when a = 2 then validations will be done for upper navigation bar
function ValidSetPagesSort(a)
{
    document.getElementById('cmbid').value = a;
    if(a==1)
    {
        var val = document.getElementById('rowsperpage');
        var isNumeric;
	    isNumeric=chkNumeric(val,"","","","","","rows in page");
	    if( isNumeric == false )
	    {
		    val.value="";
		    val.focus();
		    return false;
	    }
        var x = document.getElementById('rowsperpage');
	    pn = x.value;
	    if( pn == '' )
	    {
		    alert('Please enter the rows per page!');
		    return false;
	    }

	    var np = parseInt(pn);
	    if ( np < 0 )
		    x.value = 20;

	    if ( np > 1000 )
		    x.value = 1000;

	    return true;
    }
    else
    {
        var val = document.getElementById('rowsperpage2');
        var isNumeric;
	    isNumeric=chkNumeric(val,"","","","","","rows in page");
	    if( isNumeric == false )
	    {
		    val.value="";
		    val.focus();
		    return false;
	    }
        var x = document.getElementById('rowsperpage2');
	    pn = x.value;
	    if( pn == '' )
	    {
		    alert('Please enter the rows per page!');
		    return false;
	    }

	    var np = parseInt(pn);
	    if ( np < 0 )
		    x.value = 20;

	    if ( np > 1000 )
		    x.value = 1000;

	    return true;
    }
	
}

function ValidateFirst()
{
	var f = document.getElementById('navcurpage');
	if (f.value ==1 )
		return false;
	else
	{
		f.value =1;
		var a = document.getElementById('navaction');
		a.value = 'firstpage';
		return true;
	}
}

//Add by Umesh 2008/02/20
function ValidFirst(a)
{
    document.getElementById('cmbid').value = a;
    if(a==1)
    {
        var f = document.getElementById('navcurpage');
	    if (f.value ==1 )
		    return false;
	    else
	    {
		    f.value =1;
		    var a = document.getElementById('navaction');
		    a.value = 'firstpage';
		    return true;
	    }
    }
	else
	{
	    var f = document.getElementById('navcurpage2');
	    if (f.value ==1 )
		    return false;
	    else
	    {
		    f.value =1;
		    var a = document.getElementById('navaction2');
		    a.value = 'firstpage';
		    return true;
	    }
	}
}

function ValidatePrev()
{
	var f = document.getElementById('navcurpage');
	if (f.value ==1 )
		return false;
	else
	{
		f.value--;
		var a = document.getElementById('navaction');
		a.value = 'prevpage';
		return true;
	}
}


//Add by Umesh 2008/02/20
function ValidPrev(a)
{
    document.getElementById('cmbid').value = a;
    if(a==1)
    {
        var f = document.getElementById('navcurpage');
	    if (f.value ==1 )
		    return false;
	    else
	    {
		    f.value--;
		    var a = document.getElementById('navaction');
		    a.value = 'prevpage';
		    return true;
	    }
    }
    else
    {
        var f = document.getElementById('navcurpage2');
	    if (f.value ==1 )
		    return false;
	    else
	    {
		    f.value--;
		    var a = document.getElementById('navaction2');
		    a.value = 'prevpage';
		    return true;
	    }
    }
	
}

function ValidateNext()
{
     var f = document.getElementById('navcurpage');
	    f.value++;
	    return true;
	
}


//Add by Umesh 2008/02/20
function ValidNext(a)
{
    document.getElementById('cmbid').value = a;
    if(a==1)
    {
        var f = document.getElementById('navcurpage');
	    f.value++;
	    return true;
    }
    else
    {
        var f = document.getElementById('navcurpage2');
	    f.value++;
	    return true;
    }
	
}

function ValidateLast()
{
	var a = document.getElementById('navaction');
	a.value = 'lastpage';

	var f = document.getElementById('navcurpage');
	var np = document.getElementById('navnumpages');
	f.value = np.value;
	return true;
}


//Add by Umesh 2008/02/20
function ValidLast(a)
{
//alert("hi");
    document.getElementById('cmbid').value = a;
    //alert("a= "+a);
    if(a==1)
    {
        var a = document.getElementById('navaction');
	    a.value = 'lastpage';

	    var f = document.getElementById('navcurpage');
	    var np = document.getElementById('navnumpages');
	    //alert("np "+ np.value);
	    f.value = np.value;
	    return true;
    }
    else
    {
        var a = document.getElementById('navaction2');
	    a.value = 'lastpage';

	    var f = document.getElementById('navcurpage2');
	    var np = document.getElementById('navnumpages2');
	    //alert("np2 "+ np.value);
	    f.value = np.value;
	    return true;
    }
	
}

function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
	var numberfield = objName;
	if (chkNumeric(objName,minval,maxval,comma,period,hyphen,'') == false)
	{
	    numberfield.value = "";
		numberfield.select();
		numberfield.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function chkNumeric(objName,minval,maxval,comma,period,hyphen,displayname)
{
	// only allow 0-9 be entered, plus any values passed
	// (can be in any order, and don't have to be comma, period, or hyphen)
	// if all numbers allow commas, periods, hyphens or whatever,
	// just hard code it here and take out the passed parameters
	var checkOK = "0123456789" + comma + period + hyphen;
	var checkStr = objName;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";

	for (i = 0;  i < checkStr.value.length;  i++)
	{
		ch = checkStr.value.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		
		if (ch != ",")
			allNum += ch;
	}
	
	if (!allValid)
	{	
	    var ctrlName;
	    if(displayname=='')
	        ctrlName=checkStr.name;
	    else
	        ctrlName=displayname;
	    
		alertsay = "Please enter only these values \""
		
		alertsay = alertsay + checkOK + "\" in the \"" + ctrlName+ "\" field."
		alert(alertsay);
		return (false);
	}

	// set the minimum and maximum
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && minval != '' && maxval != '' && !(prsVal >= minval && prsVal <= maxval))
	{
		alertsay = "Please enter a value greater than or "
		alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
		alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
		alert(alertsay);
		return (false);
	}
	
}

function FillCompute( valFill, PriceCtrlName, QtyCtrlName, AmtCtrlName, frmName )
{
	var docfrm = document[frmName];
	var count = docfrm.elements.length;
	var nL = PriceCtrlName.length;
	
	for (var i = 0; i < count; i++) 
  	{
		var e = docfrm.elements[i];
		var subE = e.name.substring(0, nL);
		if ( subE == PriceCtrlName )
		{
			var bFill = false;
			if( valFill == '' )
			{
				valFill = e.value;
				bFill = true;
			}
			else
			{
				//dont fill value in disabled controls
				if( e.disabled == false)
				{
					if( !isNaN(valFill))
						e.value=valFill;
					bFill = true;
				}
			}

			if ( bFill == true )
			{
				var nCL = e.name.length;
				var nCtrlID = e.name.substring(nL, nCL);
				var qty = QtyCtrlName + nCtrlID;
				var amt = AmtCtrlName + nCtrlID;
				var valQty = docfrm[qty].value;
				
				if( isNaN(valQty) || isNaN(valFill))
					docfrm[amt].value = '';
				else
					docfrm[amt].value =  valQty * valFill;
			}
		}
	}
}

function FillDown( valFill, ctrlName, frmName, bCopyFirst, bFillIfDisabled )
{
	if( bCopyFirst )
		valFill = '';
	var docfrm = document[frmName];
	var count = docfrm.elements.length;
	var nL = ctrlName.length;
	for (var i = 0; i < count; i++) 
  	{
		var e = docfrm.elements[i];
		var subE = e.name.substring(0, nL);
		if ( subE == ctrlName )
		{
			if( bCopyFirst && valFill == '' )
				valFill = e.value;
			else
			{
				//dont fill value in disabled controls
				if( e.disabled == false || bFillIfDisabled == true )
				{
					e.value=valFill;
				}
			}
		}
	}
}

function cell_over(cell, classname) 
{
    if (document.all || document.getElementById) 
	{
        cell.classBackup = cell.className;
        cell.className   = classname;
    }
}
function cell_out(cell)
{
    if (document.all || document.getElementById) 
	{
        cell.className   = cell.classBackup;
    }
}

function ToggleCheck(chkboxName,frm)
{
	var count = document[frm].elements.length;
	for (var i = 0; i < count; i++) 
  	{
		var e = document[frm].elements[i];
		if ( e.name == chkboxName)
    		{
    		    if(e.disabled==false)
    		    {
    			if (e.checked== 1)
				    e.checked = 0;
			    else
				    e.checked = 1;
				}
    		}
  	}
}

function ExportExcel()
{

	_url = "export.aspx";
	_name = "_blank";
	_params = "menubar=0,resizable=1,width=250,height=100,scrollbars=0";
	window.open( _url, _name, _params);
	return false;
}



function ExportReport(qryString)
{
	_url = 'Rpt.aspx?' + qryString ;
	_name = "_blank";
	_params = "menubar=0,resizable=1,width=700,height=500,scrollbars=0";
	window.open( _url, _name, _params);
	return false;
}
//Added by Umesh 2008/03/03
//For quick report
//function ExportQuickReport(SrNo)
//{
//	_url = 'QuickRpt.aspx?SrNo=' + SrNo ;
//	_name = "_blank";
//	_params = "menubar=0,resizable=1,width=700,height=500,scrollbars=0";
//	window.open( _url, _name, _params);
//	return false;
//}

function SynchSM()
{
	//window.location ="http://www.google.com";
	window.location.href="synch.aspx?action=synchsm";
	return true;
}

function SynchCli()
{
	//window.location ="http://www.google.com";
	window.location.href="synch.aspx?action=synchcli";

	return true;
}

function SynchPri()
{
	window.location.href = "synch.aspx?action=synchpri";
}

function ServerLogs()
{
	window.location = "synch.aspx?action=serverlogs&sync=1";
	return true;
}

function ServerStatus()
{
	window.location = "synch.aspx?action=status";
	return true;
}

function currencyToNum(curr) 
{
	var num = curr.toString().replace(/\$|\,/g,'');
	return num;
}

function formatCurrency2(num) 
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function FormatCurrency(num,decimalNum)
{
	return '$' + FormatNum(num,decimalNum, true, true, true);
}

//FormatNum(Expression, NumDigitsAfterDecimal, IncludeLeadingDigit,
//UseParensForNegativeNumbers, GroupDigits)
function FormatNum(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
/**********************************************************************
	IN:
		NUM - the number to format
		decimalNum - the number of decimal places to format the number to
		bolLeadingZero - true / false - display a leading zero for
										numbers between -1 and 1
		bolParens - true / false - use parenthesis around negative numbers
		bolCommas - put commas as number separators.
 
	RETVAL:
		The formatted number!
 **********************************************************************/
{ 
	if (isNaN(parseInt(num))) return "-";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) 
	{
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) 
		{
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}		
	}

	var nZeroAdd = 0;
	var decPt = tmpNumStr.indexOf('.');
	if ( decPt == -1 )
	{
		tmpNumStr += '.';
		nZeroAdd = decimalNum;
	}
	else
		nZeroAdd = decimalNum - (tmpNumStr.length - decPt)+1;

	for( x=0; x<nZeroAdd;x++)
		tmpNumStr += '0';
	
	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}


function ShowHideAll( id, form , SaveIDCtrl) 
{
	var arid = id.split("_");
	var nIDs = parseInt(arid[1]);
	var z;
	for( z = 2; z <= nIDs; z++ )
	{
		var tag = id + '_' + z.toString();
		var id1 = tag + '_1';
		ShowHide(id1);

		var id2 = tag + '_2';
		ShowHide(id2);
	}
		
	var ctrl = form[SaveIDCtrl];
	var otherID = ctrl.value;
	if( otherID != '' )
	{
		for( z = 2; z <= nIDs; z++ )
		{
			var tag = otherID + '_' + z.toString();
			var id3 = tag + '_1';
			ShowHide(id3);

			var id4 = tag + '_2';
			ShowHide(id4);
		}
	}
	ctrl.value = id;
}

function showme(id,str1,str2,frmNm){
if(document.getElementById('previd').value == '9999' || document.getElementById('previd').value == id )
{
//alert("str1 - "+str1);
if(str1=='0')
{
//alert("frmName - "+ frmNm);
pagefunction(frmNm);
}
//pagefunction();
//document.getElementById('PortCombo')style.visibility = "hidden";
			if(document.getElementById('cew').value == 'unzip')
			{
					document.getElementById('R'+id).style.display='';

		
					document.getElementById('m'+id).src="images/MenuImg/mins.jpg";
					for (var i=1; i<=10; i++){
					     if (id!=i)
				     	{
					      document.getElementById('R'+i).style.display='none';
						  document.getElementById('m'+i).src="images/MenuImg/plus.jpg";
					    }
					}
					document.getElementById('cew').value = 'zip';
			}
			else
				if(document.getElementById('cew').value == 'zip')
				{
				   document.getElementById('R'+id).style.display='none';
				   document.getElementById('m'+id).src="images/MenuImg/plus.jpg";
					for (var i=1; i<=10; i++){
					    if (id!=i)
					    {
					       document.getElementById('R'+i).style.display='none';
						   document.getElementById('m'+i).src="images/MenuImg/plus.jpg";
					    }
					}
					document.getElementById('cew').value = 'unzip';
			
				}		
}
else
{  
    document.getElementById('R'+id).style.display='';
	document.getElementById('m'+id).src="images/MenuImg/mins.jpg";
	 for (var i=1; i<=10; i++){
	     if (id!=i)
		 {
				document.getElementById('R'+i).style.display='none';
				document.getElementById('m'+i).src="images/MenuImg/plus.jpg";
		 }
         }
}		 
 document.getElementById('previd').value = id; 		
}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

//Add By Umesh 2008/02/23
//This function is used to store column name by which we want to sort table column
function SortTableColumn(sortOn,frmName) 
{
	    var frm = document[frmName];
        frm.sortcol.value = sortOn;
        frm.submit();
}


//Added By Vishal 2008/02/23
//synchTab and goSetHeight are Used Tab Interface
//Web-link : http://www.dyn-web.com/dhtml/iframes/height.html

function synchTab(frameName) {

  var elList, i;

  // Exit if no frame name was given.

  if (frameName == null)
    return;

  // Check all links.

  elList = document.getElementsByTagName("A");
  for (i = 0; i < elList.length; i++)

    // Check if the link's target matches the frame being loaded.

    if (elList[i].target == frameName) {

      // If the link's URL matches the page being loaded, activate it.
      // Otherwise, make sure the tab is deactivated.

      if (elList[i].href == window.frames[frameName].location.href) {
        elList[i].className += " activeTab";
        elList[i].blur();
      }
      else
        removeName(elList[i], "activeTab");
    }
}

function goSetHeight() {
  if (parent == window) return;
  // arg: id of iframe element this doc is to be loaded into
  else parent.setIframeHeight('tabIframe2');
}

function goSetWidth() {
//  if (parent == window) return;
//  // arg: id of iframe element this doc is to be loaded into
//  else parent.setIframeWidth('tabIframe2');
}

//Added By Vishal 2008/02/25
//pagefunction used for AJAX Combobox for hiding ajax combo when normal[HTML] combo is to be displayed 
function pagefunction(frmNm)
{
    var frm = document[frmNm];
    //alert('hit'+ frmNm);
    frm.txtName.style.display = 'none';    
}

// Added BY Umesh 2008/03/06
//used in Sector page to check that Sector should contain only numbers
function ValidSector()
{
     var val = document.getElementById('Sector');
     var isNumeric;
	 isNumeric=chkNumeric(val,"","","","","","Sector");
	 if( isNumeric == false )
	 {
	    val.value="";
	    val.focus();
	    return false;
	 }
}

// Added BY Umesh 2008/03/06
//used to check that field should not contain only numbers and special characters
function ValidNumAndSpecChar(object,ctrlName)
{
    var txtValue = object;
    if(txtValue.value !="" && txtValue.value.charAt(0)!=" ")
    {
        if(!isNaN(txtValue.value))
        {
             alert("Do not use only Numbers"+" in the " + ctrlName+ " field.");
             txtValue.value ="";
             txtValue.focus();
             return false;
        }
    
    else
    {
        secNm =txtValue.value;
        var specChar = "!?^#";
        for(var i=0; i<secNm.length; i++) 
        {
            //alert(specChar.indexOf(secNm.charAt(i)));
            if(specChar.indexOf(secNm.charAt(i)) != -1 )
            {
                txtValue.value ="";
                txtValue.focus();
                alert("Do not use special characters.")
                return false;
            }
        }
    }
    }
}

// Added BY Umesh 2008/03/10
//used to check that phone number should not contain only zero and only characters for Create Security page
function ValidContactNumber(object,ctrlName)
{
    //alert("objectVal "+object.value);
    var phNo = object.value;
    //alert("ln "+phNo.length);
    var isNumeric=chkNumeric(object,"","","","","","Contact Number");
	 if( isNumeric == false )
	 {
	    object.value="";
	    object.focus();
	    return false;
	 }
    var flag = 0;
    for (var i=0; i< phNo.length; i++)
    {
        if(phNo.charAt(i)!= "0")
        {
            flag = 0;
        }
        else
        {
            flag = 1;
        }
        
    }
    if(flag == 1)
    {
        alert("Please enter proper Contact Number!");
        object.value="";
        object.focus();
        return false;
    }
    else
    {
        return true;
    }
}

