
function timesout(url,timeValue) {

	alert("Your session has expired after " +timeValue+" min. \nPlease login again.")
	document.location.href = url
}

	//checking whether any checkbox is selected.
	function deleteList(formID,fieldName,count)
	{ 
		selectList="";
		for(var i=0;i<count;i++)
		{
			if(eval('document.forms[0].'+fieldName+i+'.checked'))
			{
			
				if(selectList !="")
				selectList=selectList+",";
				
				selectList=selectList+eval('document.forms['+formID+'].'+fieldName+i+'.value');
			
			}	
		}
		if(selectList == "")
		return false;
		else
		{
			document.forms[0].msgList.value=selectList;
			return true;
		
		}
	}


//open the calendar in a separate window
	function openCalendar(dirpath)
		{
			dateWin=window.open(dirpath+"common/calendar.htm","Calendar","width=250,height=220,status=1") ;
			dateWin.focus();
			dateWin.opener=this.window;
			
		}


//open the calendar in a separate window
	function openNewWindow(abc,dirpath,w,h)
		{
			dateWin=window.open(dirpath,"PopUp","scrollbars=1,width="+w+",height="+h) ;
			dateWin.focus();
			dateWin.opener=this.window;
			
		}



//added by Serene 		
	function textCounter(field, maxlimit) 
	{	
		if (field.value.length > maxlimit)
		{
			field.value = field.value.substring(0, maxlimit);
		}
	}

/*
function checkAll(formID,keyfield,fieldname,i)
{
	var x, cnt_del=0;
		
	if (document.'+formID+'.'+keyfield+'.checked == true)
	{
		if (i == 1)
		{
			document.'+formID+'.'+fieldname+'.checked = true;
		}
		else
		{
			for (x=0; x<i; x++)
			{	
				document.'+formID+'.'+fieldname+'(x).checked = true;
			}
		}
	}
	else
	{
		if (i == 1)
		{
			document.'+formID+'.'+fieldname+'.checked = false;
		}
		else
		{
			for (x=0; x<i; x++)
			{	
				document.'+formID+'.'+fieldname+'(x).checked = false;
			}
		}		
	}
	
	
}
*/

function check_checkboxes(formID,fieldname,i,action)
{
	var x, cnt_del=0;

	if (i == 1)
	{
		if (eval('document.'+formID+'.'+fieldname+'.checked') == true)
		{
			cnt_del = cnt_del + 1;
		}
	}
	else
	{
		for (x=0; x<i; x++)
		{	
			if (eval('document.'+formID+'.'+fieldname+'(' + x + ').checked') == true)
			{
				cnt_del = cnt_del + 1;
			}
		}
	}
	if (cnt_del<1) 
	{
		alert('You have not selected anything to '+action+' . Please tick the relevant boxes.');
		return false;
	}
	else
	{
		if (cnt_del == i)
		{
			return confirm('Are you sure to '+action+' all?      ');
		}
	}
	
	return true;
	
	
}
/*
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)

function textCounter(field, maxlimit) 
{	alert(maxlimit)
	if (field.value.length > maxlimit)
	{
		field.value = field.value.substring(0, maxlimit);
	}
}


*/


function convertUpperCaps(fieldName)
{
	fieldValue=fieldName.value
	fieldName.value=fieldValue.toUpperCase();
}

