var popUp; 
// This fin will allow input English char(a-z & A-Z) and numeric 0-9
function CheckChar()
{
	var ObjCtrl;
	var KeyPressVal;	
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal <48 || KeyPressVal > 57)
	{
		if ((KeyPressVal <65 || KeyPressVal > 90)&&(KeyPressVal <97 || KeyPressVal > 122))
		{
			ObjCtrl.focus();
			return false;
		}
	}
	
}
function ValidateInput(FldName)
{
	var msg="";
	if(isBlank(document.all.txtEName.value)==true)
	{
		msg=msg+"&nbsp;"+FldName+" (English) can not be blank <br>";
	}
	if(isBlank(document.all.txtAName.value)==true)
	{
		msg=msg+"&nbsp;"+FldName+" (Arabic) can not be blank <br>";
	}
	if(msg!="")
	{
		window.parent.frames['BottomFrame'].document.location.reload();		
		window.parent.frames["BottomFrame"].document.write("<body bgcolor=#F5F9FC><div id=msg style=font-family:verdana;font-size:10;color:#ff0000>"+msg+"</div></body>");
		return false;
	}
	else
	{
		return true;
	}
}
function myDel()
{				
	if(document.all.txtEName.value!="" && document.all.txtAName.value!="")
	{
		if(confirm("Are you sure you want to delete this record?"))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		window.parent.frames['BottomFrame'].document.location.reload();
		window.parent.frames['BottomFrame'].document.write("<body bgcolor=#F5F9FC></body>");
		window.parent.frames["BottomFrame"].document.write("<body bgcolor=#F5F9FC><div id=msg style=font-family:verdana;font-size:10;color:#ff0000>Please select a record</div></body>");
		return false;
	}
}
function mySearch()
{
	if(document.all.txtEName.value!="" && document.all.txtAName.value!="")
	{
		alert("You can not search in both the languages!");
		return false;
	}
	else
	{
		return true;
	}
}
function validateGo()
{	
	if((document.all.txtPage.value=="")||(parseInt(document.all.txtPage.value)==0))
	{
		window.parent.frames['BottomFrame'].document.location.reload();
		window.parent.frames["BottomFrame"].document.write("<body bgcolor=#F5F9FC><div id=msg style=font-family:verdana;font-size:10;color:#ff0000>Please Enter some value greater than 0</div></body>");
		return false;
	}
	else
	{
		return true;
	}		
}			
function OpenCalendar(idname, postBack)
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}
function openWin(URL, name, windowWidth, windowHeight)
{
	newWindow = window.open (URL,name,"width="+windowWidth+",height="+windowHeight+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}

function openTradeWin(URL, name, windowWidth, windowHeight, vTop, vLeft)
{
	newWindow = window.open (URL,name,"width="+windowWidth+",height="+windowHeight+",Top="+vTop+",Left="+vLeft+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}

function OpenPopUp(aspxPg,aspxNm)
{
	//'LeadPopUp.aspx?formname=' + document.forms[0].name + '&name=' + name + '&id=' + id + '&postBack=' + postBack
	//'leadPopup'
	popUp = window.open(aspxPg,aspxNm,'width=570,height=350,left=250,top=225,scrollbars=yes,resizable=yes');
	popUp.focus();
}

function OpenPopUpWithMenu(aspxPg,aspxNm)
{
	popUp = window.open(aspxPg,aspxNm,'width=800,height=450,left=100,top=100,scrollbars=yes,resizable=yes,menubar=yes');
	if(popUp.closed == false)
	{
		popUp.close();
		popUp = window.open(aspxPg,aspxNm,'width=800,height=450,left=100,top=100,scrollbars=yes,resizable=yes,menubar=yes');		
		popUp.focus();
	}	
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}
function SetVal(formName, name, newName, id, newVal, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newVal;
	theform.elements[name].value = newName;
	if (postBack)
		__doPostBack(id,'');
}		
/********Utility Functions added by Arijit on 26/04*******/

//This Function restricts the entry of Comma (,) as User Input . Should be called on KeyPress event
function CheckComma()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal == 44)
	{
		ObjCtrl.focus();
		return false;
	}		
}
//This Function restricts the entry of any character except number . Should be called on KeyPress event
function CheckNumeric()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal <48 || KeyPressVal> 57) /*Only Numeric Validation*/
	{
		ObjCtrl.focus();
		return false;
	}
}
//This Function rejects copy-paste to aviod copy of characters in numeric field. Should be called onKeyDown event
function DisableCopyPaste()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;

    if (KeyPressVal==86) //v key=86, to disable copy paste of alphabets by Ctrl+V
	{
		event.returnValue=false;
	}
}

//This Function restricts the entry of any character except English character or Number. Should be called on KeyPress event
function CheckPassport()
{
	var ObjCtrl;
	var KeyPressVal;
	var RaisErr=0;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal <48 || KeyPressVal > 57)
	{
		if (KeyPressVal <65 || KeyPressVal > 90)
		{
			ObjCtrl.focus();
			return false;
		}
	}
}	
//This Function restricts the entry of any character except number and a single decimal(.). Should be called on KeyPress event
function CheckNumericDec()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if ((KeyPressVal <48 || KeyPressVal> 57) && (KeyPressVal != 46)) /*Only Numeric Validation*/
	{
		ObjCtrl.focus();
		return false;
	}
	else
	{
		if (KeyPressVal == 46) /*Checking Existance of 2 decimals*/
		{
			if(!(ObjCtrl.value.indexOf(".") == -1)){return false;}
		}

	}
}
//This Function restricts the entry of Single Quote (') as User Input. Should be called on KeyPress event
function CheckSnglQuotenSpace()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal == 39 || KeyPressVal == 32 ) 
	{
		ObjCtrl.focus();
		return false;
	}
}	

function CheckSnglQuote()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal == 39) 
	{
		ObjCtrl.focus();
		return false;
	}
}
//This Function restricts the entry of doubleQuote (") as User Input. Should be called on KeyPress event
function CheckDblQuote()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal == 34 ) 
	{
		ObjCtrl.focus();
		return false;
	}
}	
//This Function restricts the entry of doubleQuote (") and singleQuote (') as User Input. Should be called on KeyPress event
function CheckQuote()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal == 34 || KeyPressVal == 39) 
	{
		ObjCtrl.focus();
		return false;
	}
}	

//This Function restricts the entry of Spaces ( ) as User Input while saving
function trim(inputString) 
{
		// Removes leading and trailing spaces from the passed string. Also removes
		// consecutive spaces and replaces it with one space. If something besides
		// a string is passed in (null, custom object, etc.) then return the input.
		if (typeof inputString != "string") { return inputString; }
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
		while (ch == " ") { // Check for spaces at the beginning of the string
			retValue = retValue.substring(1, retValue.length);
			ch = retValue.substring(0, 1);
		}
		ch = retValue.substring(retValue.length-1, retValue.length);
		while (ch == " ") { // Check for spaces at the end of the string
			retValue = retValue.substring(0, retValue.length-1);
			ch = retValue.substring(retValue.length-1, retValue.length);
		}
		while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
			retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
		}
		return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


function round_decimals(original_number, decimals) 
{
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {
    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")
    
    // Is there a decimal point?
    if (decimal_location == -1) {
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0     
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {
        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    if (pad_total > 0) {  
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}

function FormatNumber(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 "NaN";

	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;
		}		
	}

	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}

// validate an email address
function isValidEmail(e)
{
	// assume an email address cannot start with an @ or white space, but it
	// must contain the @ character followed by groups of alphanumerics and '-'
	// followed by the dot character '.'
	// It must end with 2 or 3 alphanumerics.
	//
	//var alnum="a-zA-Z0-9";
	//exp="^[^@\\s]+@(["+alnum+"+\\-]+\\.)+["+alnum+"]["+alnum+"]["+alnum+"]?$";
	exp = /^\w(?:\w|-|\.(?!\.|@))*@\w(?:\w|-|\.(?!\.))*\.\w{2,3}/  ;
	emailregexp = new RegExp(exp);

	result = e.match(emailregexp);
	if (result != null)
	{
		return true;
	}
	else
	{
		return false;
	}
}
// This fn checks whether an email address is valid or not
function ValidateEmail(obj,vTextMsg)
{
	var emailval;			
	emailval=obj.value;
	if(isValidEmail(emailval)==true)
	{
		return true;
	}
	else
	{
		if(isBlank(vTextMsg)==true)
		{
			alert("Please put valid e-mail address");
		}
		else
		{
			alert(vTextMsg);
		}
		return false;
	}		
}
// This fn checks whether an email address is valid or not, used in admin section
function ValidateEmailforAdmin(obj)
{
	var emailval;			
	emailval=obj.value;
	if(isValidEmail(emailval)==true)
	{
		return true;
	}
	else
	{
		return false;
	}		
}
// This function checks whether a text is numeric
function IsNumeric(sText,alertMsg)
{	
   var ValidChars = "0123456789";
   var Char; 
   for (i = 0; i < sText.length; i++) 
   { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
				alert(alertMsg);			
				return false;	
		}
    }
}
// This function checks whether a text is numeric
function IsNumericForAdmin(sText)
{	
   var ValidChars = "0123456789";
   var Char; 
   for (i = 0; i < sText.length; i++) 
   { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
				//alert(alertMsg);			
				return false;	
		}
    }
    return true;
}
function IsValidText(sText)
{	
   var ValidChars = "!@#$%^*";
   var Char; 
   for (i = 0; i < ValidChars.length; i++) 
   { 
		Char = ValidChars.charAt(i); 
		if (sText.indexOf(Char) != -1) 
		{
				return false;	
		}
    }
    return true;
}
// This function checks whether a text is numeric and single dot(.) is allowed
function IsNumericDec(sText,alertMsg)
{	
   var ValidChars = "0123456789.";
   var Char; 
   var CountDOT=0;		
   for (i = 0; i < sText.length; i++) 
   { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
				alert(alertMsg);
				CountDOT=0;
				return false;	
		}
		else
		{
			if(Char==".")
			{
				CountDOT=CountDOT+1;
			}
		}
    }
    if(CountDOT>1)
    {
		alert(alertMsg);
		return false;
    }
}
 
function CheckURL(sText,alertMsg)
{	
   var CountDOT=0;
   if (sText.indexOf('.') == 0)
   {
		alert(alertMsg);
		return false;
   }
   for (i = 0; i < sText.length; i++) 
   { 
		Char = sText.charAt(i); 
		{
			if(Char==".")
			{
				CountDOT=CountDOT+1;
			}
		}
    }
    if(CountDOT==0)
    {
		alert(alertMsg);
		return false;
    }
}

//This function checks for blank entry as user input including spaces
function isBlank(val)
{
	var s = val;
	var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
	return (m == null) ? true : false;
}
function CheckAmount(obj1,obj2)
{
	alert(obj1);
	
}

function dateDiff(FromDt,ToDt)
{
	var FDate = new String(FromDt);               //eval("document.MLReport.FromDate.value"));
	var TDate = new String(ToDt);                 //eval("document.MLReport.ToDate.value"));

	if(trim(FDate)=="")
	{
		return false
	}
	if(trim(TDate)=="")
	{
		return false
	}
	var firsttime = new String(FromDt);          //eval("document.MLReport.FromDate.value"));
	var secondtime = new String(ToDt);           //eval("document.MLReport.ToDate.value"));
	if(trim(firsttime)=="")
	{
		firsttime="00:00";
	}
	if(trim(secondtime)=="")
	{
		secondtime="00:00";
	}
	var yy1 = FDate.substring(6,10);    //year
	var dd1 = FDate.substring(0,2);     //day
	var mm1 = FDate.substring(3,5);     //month
	var hr1 = "00"; //hour
	var mn1 = "00"; //minute
	var sc1 = "00"; 						 //second

	var yy2 = TDate.substring(6,10);
	var dd2 = TDate.substring(0,2);
	var mm2 = TDate.substring(3,5);
	var hr2 = "00";
	var mn2 = "00";
	var sc2 = "00";

	var fday = new Date(yy1,mm1,dd1, hr1,mn1,sc1);
	var tday = new Date(yy2,mm2,dd2, hr2,mn2,sc2);
	
	if(tday<fday)
	{
		//alert('To Date is lower than From Date');
		//eval("document.MLReport.ToDate.focus()");
		return false;
	}
	else
	{
		return true;
	}
	if(tday>fday)
	{
		//alert('To Date is lower than From Date');
		//eval("document.MLReport.ToDate.focus()");
		return false;
	}
	else
	{
		return true;
	}
}

function IsEnterPress()
{
	var ObjCtrl;
	var KeyPressVal;
	ObjCtrl = event.srcElement;
	KeyPressVal = event.keyCode;
	if (KeyPressVal == 13)
	{
		return true;
	}		
}
function CancelCheck(alertMsg)
{
	return confirm(alertMsg);	
}

function ValidateDate(strdate)
{
	/*var DateText = new String(DText);
	var DateLength = new Number(DateText.length);
	if(DateLength<10)
	{
		return false;
	}
	var FFS=0;
	if(DateText.indexOf("/")==-1)
	{
		return false;
	}
	else
	{
		if(DateText.indexOf("/",FFS+1)==-1)
		{
			return false;
		}
	}
	var FFS=DateText.indexOf("/");
	var LFS=DateText.indexOf("/",FFS+1);
	if(FFS<2)
	{
		return false;
	}
	if(FFS<5)
	{
		return false;
	}
	var DateLength = new Number(DateText.substring(0,2))
	if(DateLength==0)
	{
		//alert(DateLength);
		return false;
	}
	var DateLength = new Number(DateText.substring(3,5))
	if(DateLength==0)
	{
		//alert(DateLength);
		return false;
	}
	var DateLength = new Number(DateText.substring(6,10))
	alert(DateLength);
	if(DateLength==0)
	{
		//alert(DateLength);
		return false;
	}
	return true;*/
	n1 = strdate.indexOf("/");
	n2 = strdate.indexOf("/",n1+1);
	
	if (n1 != 2 || n2 != 5)
	{
		return false;
	}
	strday = strdate.substring(0,n1);
	strmon = strdate.substring(n1+1,n2);
	stryear = strdate.substring(n2+1);
	
	if (stryear.length < 4)
	{
		return false;
	}

	if (IsNumericForAdmin(strday) == false || IsNumericForAdmin(strmon) == false || IsNumericForAdmin(stryear) == false)
	{
		return false;
	}

	d = parseInt(strday,10);
	m = parseInt(strmon,10);
	y = parseInt(stryear,10);

	if (strmon < 1 || strmon > 12)
	{
		return false;
	}
	if (y == 0)
	{
		return false;
	}
	if (d < 1 || d > daysinmonth(m,y))
	{
		return false;
	}
	return true;
}

function isleap(y)
{
	return (((y%4 == 0) && (!(y%100 == 0) || (y%400 == 0))) ? 1 : 0);
}

function daysinmonth(n,y)
{
	if (n == 4 || n == 6 || n == 9 || n == 11)
		return 30;
	if (n == 2)
		if (isleap(y)) return 29;
		else return 28;
	return 31;
}
// this fn is used for field help
function showfldhelp(ename,aname)
{
	var leftpos=((screen.width/2)-(400/2));
	var toppos=((screen.height/2)-(200/2));
	if (typeof(vLanguageSelected)=="undefined" || vLanguageSelected == "E")
	{
		window.open(ename,"Help","width=400,height=280,top="+toppos+",left="+leftpos+",scrollbars=yes");
	}
	else
	{
		window.open(aname,"Help","width=400,height=280,top="+toppos+",left="+leftpos+",scrollbars=yes");
	}
}

// ----- Time
function dotime(e, obj1) 
{

    var tempstr=new String("");
    tempStr=obj1.value;
    tempStr=tempStr.replace(/ /g, "");
    obj1.value=tempStr;
    //alert(tempStr);

    if (document.all) 
    {
        e = window.event;
    }

    var key;
    if (document.layers)
    {
        key = e.which;
    }
    if (document.all)
	 {        
        key = e.keyCode;

if (((key<48)&&(key!=8)&&(key!=13)&&(key!=46)&&(key!=37)&&(key!=39 &&(key!=16 &&(key!=17))))||(key>57)&&(key<96)||(key>105))     
	{
      if(obj1.value.length!="")
       {
      /*alert("Invalid entry")
      obj1.value=obj1.value.substring(0,obj1.value.length-1);
      obj1.focus();
      return false;*/
       } 
     }	


     if ((key==8) && ((obj1.value.length==2)||(obj1.value.length==5))){
        obj1.value=obj1.value.substring(0,obj1.value.length-1);
     }

     if(obj1.value.length<5)    
	{
     if (isNaN(obj1.value.substring(0,2)))
     	{
	  //alert("Invalid Hour");
	  //return false;  
	}
     else
	{
     	if(obj1.value.substring(0,2)>23)
	   {
    		//alert("Invalid Hour")
	      	//obj1.value=obj1.value.substring(0,1)
 	      	//obj1.focus();
	      	//return false;
	   }
	}

     if (isNaN(obj1.value.substring(3,5)))
     	{
	  //alert("Invalid Minute");
	  //return false;  
	}
     else
	{

         if(obj1.value.substring(3,5)>59)
	   {
	      	//alert("Invalid Minute")
	      	//obj1.value=obj1.value.substring(0,4)
	      	//obj1.focus();
	      	//return false;
	   }
	}
	}	 	
	if(obj1.value.length==2)
         {
	  if(obj1.value.substring(obj1.value.length-1,obj1.value.length)!=":")
           {
	   obj1.value=obj1.value.toUpperCase() +":";
	   obj1.focus();
           }
         }
		 /*if (obj1.value.length==5)
         {
		   if(obj1.value.substring(obj1.value.length-1,obj1.value.length)!=":")
           {
	       obj1.value=obj1.value.toUpperCase() +":00";
	       obj1.focus();
           }
         }*/
    }
     else
    {
       if(obj1.value.length>5)   //(obj1.value.length>5) - Pushpal
         {	
          //alert("Invalid Input")
          //obj1.value=obj1.value.substring(0,obj1.value.length-1);
	      //obj1.focus();
          //return false;
         }
     }
}

function tmcheck(obj)
{
 if((obj.value!="" && obj.value.length<5)||(obj.value.length>5))
 {
  obj.focus();
 }
     if (isNaN(obj.value.substring(0,2)))
     	{
	  return false;  
	}
     else
	{
	if(obj.value.substring(0,2)>23)
	   {
	      	//obj.value=obj.value.substring(0,1)
 	      	//obj.focus();
	      	//return false;
	   }
	}

     if (isNaN(obj.value.substring(3,5)))
     	{
	  return false;  
	}
     else
	{

	if(obj.value.substring(3,5)>59)
	   {
	      	//obj.value=obj.value.substring(0,4)
	      	//obj.focus();
	      	//return false;
	   }
	}
      /*if (isNaN(obj.value.substring(6,8)))
      {
	     //alert("Invalid Second");
	     //return false;  
	  }
	  else
	  {
	     if(obj.value.substring(6,8)>59)
 	     {
	   	   //alert("Invalid Second")
	       //obj.value=obj.value.substring(0,8)
	       //obj.focus();
	       //return false;
   	     }
	  }*/
}

// This function checks whether a text is numeric and have only one char ":" 
function IsTime(sText,alertMsg)
{	
	var ValidChars = "0123456789:";
	var Char;
	var CountColon=0;
	for (i = 0; i < sText.length; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
				alert(alertMsg);			
				return false;	
		}
		else
		{
			if(Char==":")
			{
				CountColon=CountColon+1;
			}
			if((i==0) || (i==1) || (i==3) || (i==4))
			{
				if(Char==":")
				{
					alert(alertMsg);			
					return false;
				}
			}
		}
	}
	if(CountColon>1)
	{
		alert(alertMsg);
		return false;
	}
}

