function TrimString(str)
{
	
	var stringInput = new String(str)	//variable to store input string 
	startPosition=0;	//variable to store the postion where the first Non Blank character comes
	stringLength = stringInput.length;	//stores string length
	endPosition = stringLength-1;			//stores the position where the last non blank character comes
		
	while(startPosition<stringLength)	//starts finding first non blank character from begining of the string
	{
		if(stringInput.substr(startPosition,1)!=' ')	
		{
			break;
		}
		startPosition=startPosition+1;	//if non blank character is found then the position is stored and loop breaks
	}
		
		
	while(endPosition>=startPosition)
	{
		if(stringInput.substr(endPosition,1)!=' ')
		{
			break;
		}
		endPosition=endPosition-1;
	}
	var stringReturn = stringInput.substring(startPosition,endPosition+1);	//gets the string between 2 postions
	return stringReturn;
}



function popUp(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin";
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  objWin = window.open(theURL,winName,features);
}

/*****************************************************************
    Function :ValidateEmailAddress
    Purpose  : to validate Email address
    Algorithm:
    Input    :objEmail (text field)
    Output   :
    Author   : Ashish Dawra
    Created On:09/16/2003
 *****************************************************************/

function ValidateEmailAddress(objEmail)
{
	try
	{
		var strEmail = objEmail.value;
		if(strEmail!="")//check for blank 
		{		
			var objRegExp =/^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$/;
			var flag=strEmail.match(objRegExp);//validate Email Address.
			if(flag==null)
			{
				return false;
			}
			return true;
		}
	}
	catch(e){alert(e.description)}
}

/*****************************************************************
    Function :catchKeyPress
    Purpose  : to catch Key Press
    Algorithm:  1) Check for Key Code
				2) if Key Code is '13' 
				3) click 'Submit' button available on form
    Input    :Key Code , Submit Button Id 
    Output   :
    Author   : Ashish Dawra
    Created On:09/16/2003
 *****************************************************************/
function catchKeyPress(code,ElementId) {
    var ret=null;
	if (code == '13') {
		event.cancelBubble = true;
		event.returnValue = false;
        ret=document.getElementById(ElementId);
        if(ret) { 
            ret.click(); 
        }
    }
}
    

/*
'*****************************************************************
'Function :closewindow_onunload
'Purpose  :closes the calendar on leaving this page
'Algorithm:
'Input    :
'Output   :
'Author   :Ashish Dawra
'Created On: 17/4/2003
'*****************************************************************
*/
function closewindow_onunload() 
{
	try
	{
	
		if (objWin != null)
		{
			objWin.close();
		}
	}
	catch(e){}
	finally {
      
   }		
}
