
/* Javascript Functions to Validate String, Number, Email and String with specified Characters */

var whitespace = " \t\n\r";

function isEmpty(s)  //Checks whether string is Empty
	{  
		return ((s == null) || (s.length == 0))
	}


function isleadingspace (s) //Checks for leading spaces in the string 
	{  
		var i;
	 	if (isEmpty(s)) return true;
	 	   for (i = 0; i < s.length; i++)
	 	   {   
	 	       var c = s.charAt(i);
	 	       if (whitespace.indexOf(c) == -1) 
				return true;
			else
  			   break;
	 	   }
		   return false;
	}

function chkGreaterDate(frmDate,toDate)
{
 	var fromDatec =frmDate.split('/');
	var toDatec = toDate.split('/');  

	if(eval(toDatec[2]) > eval(fromDatec[2])) 
	    return true;
	else if(eval(toDatec[2]) < eval(fromDatec[2])) 
	    return false;	
	else if(eval(toDatec[2]) == eval(fromDatec[2])) 
	{
           if (eval(toDatec[1]) > eval(fromDatec[1]))
		return true;
           else if (eval(toDatec[1]) < eval(fromDatec[1]))
		return false;
           else if(eval(toDatec[0]) >= eval(fromDatec[0]))
		return true;
	   else 
		return false;
	}
}


function isWhitespace (s) //Checks for White spaces in the string 
	{  
		var i;
	 	if (isEmpty(s)) return true;
	 	   for (i = 0; i < s.length; i++)
	 	   {   
	 	       var c = s.charAt(i);
	 	       if (whitespace.indexOf(c) == -1) return false;
	 	   }
		   return true;
	}

function noWhitespace (s) //no white space in between the string
	{  
		var i;
	 	if (isEmpty(s)) return true;
	 	   for (i = 0; i < s.length; i++)
	 	   {   
	 	       var c = s.charAt(i);
				if (whitespace.indexOf(c) == 0)
				{
			   	   return true;
				}
	 	   }
		   return false;
	}
function isValue (s)
	{  
	 
	    var i,a,b,d,check;
                      a=0,b=0,d=0;
	   var bag="1234567890-.,"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i); 	
	        if (s.charAt(0)==',')return false;
	        if(c=='-')a++;
	        if(a>=2) return false;
	        if(c=='.')b++;                        
                          if(b>=2)return false;	
	        if(c==',')d++;
                          if(d>=3)return false;			
	        if (bag.indexOf(c) == -1) 			
	       return false;			
	    }
	   for (j = 1; j < s.length; j++)
	    {   
	        var check = s.charAt(j); 
                          if(check=='-') return false;
	    }
	  return true;
	}

function isNumber (s) //Checks whether the number is numeric
	{  
	    var i;
		var bag="1234567890"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
	function isTextdot (s) //Checks whether the text is text and dot
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz."
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}

function isNumberHyphenPlus(s) //Checks whether the number is numeric
	{  
	    var i;
		var bag="1234567890-+"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
	
function isNumberHyphencommabrac(s) //Checks whether the number is numeric
	{  
	    var i;
		var bag="1234567890+-,() "
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}


function isAmount(s) //Checks whether the amount is valid
	{  
	    var i;
		var bag="1234567890."
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}

function isCharsInBag (s, bag) /* Checks whether the string only contains the characters 
								specified in the parameter bag */
	{  
	    var i;
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}

function isHours (s) //Checks whether the string contains only numbers and .
	{  
	    var i;
		var bag="1234567890."
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
	
function isHtmlTag (s) //Checks whether the string contains only alphabets, . and _
	{  
	    var i;
		var bag="<>"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}


function isStringText (s) //Checks whether the string contains only alphabets, . and _
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -_."
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}


function isName (s) //Checks whether the string contains only alphabets and '
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', "
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
function isStringTitle (s) //Checks whether the string contains only alphabets, . and _
	{  
	    var i; 
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .-!':,&"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) 
	        {
				alert("Only text,numbers and special characters like .-!':,& are allowed");
				return false;
				
			}
	    }
	    
	    return true;
	}
	
function isStringDesc (s) //Checks whether the string contains only alphabets, . and _
		{  
		    var i; 
			var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#()/\!~`#$%^{}[] .-!':,&"
		    for (i = 0; i < s.length; i++)
		    {   
		        var c = s.charAt(i);
		        if (bag.indexOf(c) == -1) 
		        {
					alert("Special characters like \"<> are not allowed");
					return false;
					
				}
		    }
		    
		    return true;
	}
	
function isAlpha (s) //Checks whether the string contains only alphabets
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}

function isAlphaDot(s) //Checks whether the string contains only alphabets
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ."
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
function isAlphaNumerics (s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}
function isAlphaNumeric (s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-/ ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
}
	
function isAlphaNumHyphen (s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789- ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}
function isAlphaHyphenDot(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-. ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}


function isAlphaHyphenDotamp(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.& ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}
function isAlphaquotes(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}

	
function isAlphaNumHyphenComma(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-, ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}
	
function isAlphaNumHyphenCommaDot(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-,. ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}

function isAlphaNumplusminus(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+.";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}

function isAlphaNumFolder(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
	    
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-. '@!#$%^&()`;";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}


function isStringLength(s,l)
{
	
		if (parseInt(s.length) > parseInt(l) )
		{
		return true;
		}
		else
		{
		return false;
		}
	
	
}
	


	function isFileName (s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}
function isTextNumeric (s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}
function isEmailText(s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@.";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}		

function isEmail (emailStr) //Checks whether the given string is a valid EMail address
 	{
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr.match(emailPat)

		if (matchArray==null) 
		{
			return false
		}
		
		var user=matchArray[1]
		var domain=matchArray[2]
		
		
		if (user.match(userPat)==null) 
		{
		    return false
		}
		
		var IPArray=domain.match(ipDomainPat)
		
		if (IPArray!=null) 
		{
		  	for (var i=1;i<=4;i++) 
		  		{
			    if (IPArray[i]>255) 
					{
			    		return false
			    	}
		    	}
		    return true
		}
	
		var domainArray=domain.match(domainPat)
		
		if (domainArray==null) 
			{
		    	return false
			}
		
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length

		if (domArr[domArr.length-1].length<2 || 
		    domArr[domArr.length-1].length>3) 
			{
			   return false
			}
		
		if (len<2) 
			{
			   var errStr="This address is missing a hostname!"
	   		   return false
			}

		return true;
	}

function isValidDate(dateStr) 	// Checks for the following valid date formats:
	{							// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY

		var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year
		
		var matchArray = dateStr.match(datePat); // is the format ok?
		if (matchArray == null) 
		{
			alert(dateStr + " Date is not in a valid format.")
			return false;
		}
		
		// parse date into variables
		
		month = matchArray[1]; 
		day = matchArray[3];
		year = matchArray[4];
		
		if (month < 1 || month > 12) 
		{ // check month range
			alert("Month must be between 1 and 12.");
			return false;
		}
		
		if (day < 1 || day > 31) 
		{	//check day range
			alert("Day must be between 1 and 31.");
			return false;
		}
		
		if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) 
		{ //check whether the month has 31 days
			alert("Month "+month+" doesn't have 31 days!")
			return false;
		}
		if (month == 2) 
		{ // check for february 29th
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); //leap year check
			if (day > 29 || (day == 29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + day + " days!");
				return false;
		    }
		}
//included by saravanan for checking year
		if(year < 1900 || year > 2100)
		{
			alert('year is  not valid')
			return false;
		}		
		return true; 
	}	
/* End of Validation Java Scripts */
/* Function added on 25/03/2002 By lingaraju */
function isGreaterDate(toDate,frmDate)
{
		
    //The function checks if toDate is greater than or equal to from date
	//Breaking up the start and End date into month, day, year formats
	var fromDatec =frmDate.split('/');
	var toDatec = toDate.split('/');
	if(eval(toDatec[2] > fromDatec[2]))
		
	    return true;
	   
	else if(eval(toDatec[2] < fromDatec[2]))
	
	    return false;
	   
	else if(eval(toDatec[2] == fromDatec[2]))
	{
		
	   if (eval(toDatec[0] - fromDatec[0])>=1)
	   
		     return true;
	   
	   else if(eval(toDatec[0] - fromDatec[0])== 0)
	   {
		
		  if(eval(toDatec[1] -fromDatec[1]) > 0)
		  
		      return true;
		      
	      else if(eval(toDatec[1] - fromDatec[1]) < 1)
		    
			   return false;
			
	   }	
	   else if(eval(toDatec[0] - fromDatec[0]) < 1)
	   {
	 	    //alert('in month2 - month1'+eval(fromDatec[0] > toDatec[0]));
			return false;
	   }  	   	   	   
	}	
}	
/* End of function to find wheter a give date is greater than equal to a date or not */	


/* fucntion added by saravanan to check whether end time is earlier than start date 
given the start noon and end noon by saravanan on 19/11/2004 */
function chkStartEndTime(startTime,startNoon,endTime,endNoon)
{
/*alert('startTime' + startTime)
alert('startNoon' + startNoon)
alert('endTime' + endTime) 
alert('endNoon' + endNoon)*/

	// start time is the time in integer 
	// startNoon is AM/PM
	
	// end time is the time in integer 
	// end Noon is AM/PM
	
	if(startNoon == 'AM')
	{
		var start = 1;
	}
	else
	{
		var start = 2;
	}
	
	if(endNoon == 'AM')
	{
		var end = 1;
	}
	else
	{
		var end = 2;
	}
	
	if(start==1)
	{
		if(end==2)
			{
				return true;
			}
		else
		{
			if(start==end)
			{
				if(parseInt(endTime)>=parseInt(startTime))
				{
					return true;
				}
				else
				{
					return false;
				}
			}
		}
	}
	else
	{
		if(end==1)
		{
			return false;
		}
		else
		{
			if(parseInt(endTime)>=parseInt(startTime))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	return true;
			
	
	
	/*if(end == start)
	{
		if(parseInt(endTime) < parseInt(startTime))
		{
			return false;
		}
	}
	else
	{
		if(parseInt(endTime) >= parseInt(startTime))
		{
			return true;
		}	 
		else
		{
			return false;
		}
		
	}*/
}
/* end of function check end time */
/* popup function will open the url
	included by saravanan on 23/11/2004 
function popup(URL) 
{
window.open(URL) 
//window.open(URL, toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300);
}
end of popup function*/



//Rtrim
function RTrim(str)
{ 
 var whitespace = new String(" \t\n\r");
 var s = new String(str);
 if (whitespace.indexOf(s.charAt(s.length-1)) != -1) 
 {
 var i = s.length - 1;       
 while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
 i--;
 s = s.substring(0, i+1);
 }
 return s;
 }
 
//Added by shibu The email validation with Domain Checking 
 function emailCheck (emailStr) {
var checkTLD=1;

 

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

 

var emailPat=/^(.+)@(.+)$/;

 

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

 
var validChars="\[^\\s" + specialChars + "\]";

 

var quotedUser="(\"[^\"]*\")";

 

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

 

var atom=validChars + '+';

 

var word="(" + atom + "|" + quotedUser + ")";



var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
 

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

 
var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

 

alert("Enter a valid email format");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

 

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Enter a valid email format");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Enter a valid domain name");
return false;
   }
}
 

if (user.match(userPat)==null) {
 
alert("Enter a valid email format");
return false;
}

 
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Enter a valid email ");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("Enter the valid domain name");
return false;
   }
}
 

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Enter the valid domain name");
return false;
}

 

if (len<2) {
alert("Enter a valid email");
return false;
}
 
return true;
}

//Function added by shibu for image 

function ImageCheck(formname,filename)
{
	var str,strplit,strplit1,strplace,strplace1;
	str = eval("document."+formname+"."+filename+".value")
	
	strplace = str.lastIndexOf("\\")
	strplace = parseInt(strplace+1);
	strsplit = str.substring(strplace)
	strplace1 = strsplit.lastIndexOf(".")
	if(strplace1=='-1')
	{
		alert("Please enter a valid filename")
		eval("document."+formname+"."+filename+".focus()");
		return false; 
	}
	strplace1 = parseInt(strplace1+1);
	url = strsplit;
	strsplit1 = strsplit.substring(strplace1)
	if ( (strsplit1=='gif')  || (strsplit1=='jpg') || (strsplit1=='jpeg') )
	{
			return true;	
	}
	else
	{
		alert("Only gif/jpg files can be formname")
		eval("document."+formname+"."+filename+".focus()");
		return false; 
	}
	
}


function isFloats (s) //Checks whether the string contains only numbers and .
	{  
	    var i;
		j=0;
		var bag="1234567890."
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (c=='.') j++;
	        if (j>=2) return false;
	        {
	        }
	        
	if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
	
function Rightmenu()
{	
document.write("<table width='173' border='0' cellpadding='8' cellspacing='1' bgcolor='#FFFFFF'>")
document.write("<tr>")
document.write("<td bgcolor='#EEEEEE'><span class='blutxt12'>Search:</span><br>")
document.write("<input name='search' readonly type='text' class='txtBox' size='15'>")
document.write("<input name='image' type='image' src='../../images/go_btn.gif'></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td bgcolor='#EEEEEE'><span class='blutxt12'><span class='blutxt12'>Quick Links :<br>")
document.write("<select name='menu1' class='txtBox' onChange='jump(this.value);' style='margin:5px;' >")
document.write("<option selected>- Select -</option>")
document.write("<option value='HD'>ION Helpdesk </option>")
document.write("<option value='CN'>ION Connect</option>")
document.write("<option value='LV'>Leave</option>")
document.write("</select></span></span></td>")
document.write("</tr>")
document.write("</table>")
document.write("<table width='173' border='0' cellspacing='0' cellpadding='0'>")
document.write("<tr>")
document.write("<td><img src='../../images/wline.gif' width='173' height='2'></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td height='50' valign='top'><a href='../../Employee/EmpSearchprofile.asp'><img src='../images/right_menu_inside/emp.gif' alt='Directory' width='173' height='45' border='0' longdesc='../Employee/EmpSearchprofile.asp'></a></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td><a href='#'><img src='../images/right_menu_inside/pro_req.gif' alt='Procurement Request' width='173' height='50' border='0'></a></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td><a href='../../Feedback/feedback.asp'><img src='../images/right_menu_inside/feedback.gif' alt='Feedback' width='173' height='45' border='0'></a></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td><a href='../../eForms/Expenses.asp'><img src='../images/right_menu_inside/forms.gif' alt='Forms' width='173' height='46' border='0'></a></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td><a href='../../cranes/policies_guide_lines.htm'><img src='../images/right_menu_inside/policies.gif' alt='Policies' width='173' height='45' border='0'></a></td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td><a href='../../leave/LeaveRequest.asp'><img src='../images/right_menu_inside/policies.gif' alt='Leave Request' width='173' height='45' border='0'></a></td>")
document.write("</tr>")

document.write("</table>")
}

function jump(t)
{
if (t=='HD')
{
document.location.href="../../ionhelpdesk/nctickets.asp"

}

if (t=='CN')
{
document.location.href="../../forum/Current_rooms.asp"

}

if (t=='LV')
{
document.location.href="../../Leave/LeaveRequest.asp"

}

}

//Added By Gunavathi
function chkselect(fname,fdesc)
{
	if(fname.value=="" || fname.value < 1)
	{
	alert("Select " + fdesc);
	fname.focus();
	return false;
	}
	return true;
}



function replace(str, from, to) 
{
	var i = str.indexOf(from);
    if (!from || !str || i == -1) 
	return str;
    var newstr = str.substring(0, i) + to;
	if (i+from.length < str.length)
	newstr += replace(str.substring(i+from.length,str.length),from,to);
	return newstr;
}

//Added by shibu
function trimSpace(str)
{
  var str1=str.replace(/\S/g,"|");
  var i=str1.indexOf("|")-1;
  var j=str1.lastIndexOf("|")+1;
  var trimStr=str.substring(0,i).replace(/\s/g,"") + str.substring(i+1,j)
      trimStr = trimStr + str.substring(j).replace(/\s/g,"");
  return trimStr;
}
//added by ram
function popupcalendar(url) {
	newWindow = window.open(url,'daughter3','menubar=no,toolbar=no,location=no,scrollbars=yes,resizable=no,width=2000,height=600,screenX=100,screenY=100,top=10,left=10');
	if (newWindow.opener == null) newWindow.opener = self;
	newWindow.focus();
}
//


/*
function trimSpace(strReceived)
{
	var empty=/ /g;
	strAfter=strReceived.replace(empty,"");
	return strAfter;
}
*/

function isAlphaNumber (s) //Checks whether the string contains only alphabets
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	    lclint_count = 0
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) != -1)
	        {
				lclint_count = parseInt(lclint_count) + 1		
	        }
	    }
	    if (lclint_count == s.length)
	    {
			alert("Your Password must be Alphanumaric")
			return false;
	    }
	    var j;
		var bag_N="1234567890"
		lclint_count = 0
	    for (j = 0; j < s.length; j++)
	    {   
	        var K = s.charAt(j);
	        if (bag_N.indexOf(K) != -1) 
	        {
				lclint_count = parseInt(lclint_count) + 1	        
			}
	    }
	    if (lclint_count == s.length)
	    {
			alert("Your Password must be Alphanumaric")
			return false;
	    }
	    return true;
	}
function isBirthDate(frmDate,toDate)
{	
    //The function checks if toDate is greater than or equal to from date
	//Breaking up the start and End date into month, day, year formats
	var fromDatec =frmDate.split('/');
	var toDatec = toDate.split('/');	
	if(eval(toDatec[2] < fromDatec[2]))
	{	
		return false;
	}
	else
	{		
	  if (eval(toDatec[2] - fromDatec[2])<18)
	   {
		return false;
	   }
		
	}
return true;
}
 

function isValidUrl(urlStr)
{
var flag=0;
var urlPat=/^(.+):\/\/(.+)$/
var matchArray=urlStr.match(urlPat)
var splitdomain = new Array()

if(matchArray==null)
return false;
var urlprot=matchArray[1];
var domainpath=matchArray[2]
switch(urlprot)
{
case "http": flag=1;
	     break;
case "https": flag=2;
	     break;
case "ftp": flag=3;
	     break;
default: flag=0;
}

   var s=urlStr;
	var i;
	var k = new Array()
	if (s.lastIndexOf(".") == -1)
		{
		flag=0;
		}
	k = s.split(".")
	i = k.length	
		
		if (i < 3)
		{
			flag=0;
		}
		if (k[2] < 3)
		{
			flag=0;			
		}

splitdomain = domainpath.split(".")
i = splitdomain.length;
if(splitdomain==null)
return false;
if (splitdomain[0]!=null && splitdomain[0].length < 3)
 return false;
if (splitdomain[1]!=null && splitdomain[1].length < 1)
 return false;	
if (splitdomain[2]!=null && splitdomain[2].length < 2)
 return false;	
if (i < 2)
  flag=0;		
if(flag!=0)
return true;
else
return false;
}

function isUrlName(s)
{

	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$&-_.+,/:;=?@";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;

}

function isFraction(s) //Checks whether the number is numeric
	{  
	    var i,j,flagchkdeci,isnum;
	    flagchkdeci=0;
	    isnum=0;
		var bag="1234567890."
		j=0;
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1 || j > 1 || flagchkdeci > 1 ) 
	          return false;
	          
	         if(c=='.')
	         {
	          flagchkdeci=flagchkdeci+1; 
	         }
	         else
	         {
	          isnum=isnum+1;
	          if(flagchkdeci==1)  
	          j=j+1;
	         } 
	          if(isnum==0)
	           	return false;
	    }
	    if(flagchkdeci==1 &&  j==0)
	    {
	     return false;
	    } 
	    if(flagchkdeci > 1)
	    {
	     return false;
	    } 
	    return true;
	}


function ismaxlength(obj)
{
var mlength= 2000;//obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	{
	obj.value=obj.value.substring(0,mlength)
	alert("Maximum no.of characters allowed is 2000");
	}
}
function trimSpace1(str)
{
  var str1=str.replace(/\S/g,"|");
  var i=str1.indexOf("|")-1;
  var j=str1.lastIndexOf("|")+1;
  var trimStr=str.substring(0,i).replace(/\s/g,"") + str.substring(i+1,j)
      trimStr = trimStr + str.substring(j).replace(/\s/g,"");
  return trimStr;
}
function checkhtml(s,obj,type)
{
var i; 
//s=trimSpace(s)
		var bag="<>"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) != -1) 
	        {
		
				alert("Html tags are not allowed");
				if(type=='sr' || type=='cxo')
				{
				obj.value="";
				}
				document.getElementById("txtbestFirm").value = "";
				document.getElementById("Bestchange").innerHTML = "";
				document.getElementById("Bestchange1").innerHTML = "";
				document.getElementById("Bestchange2").innerHTML = "";
				if(type=='sr' || type=='cxo')
				{
				document.getElementById("Bestchange3").innerHTML = "";
				document.getElementById("Bestchange4").innerHTML = "";
				}
				
				
				return false;
				
			}
	    }
	    
	    return true;
}


function checkhtml1(s,obj)
{
var i; 
		var bag="<>"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) != -1) 
	        {
		
				alert("Html tags are not allowed");
				
				obj.value="";
				
				
				return false;
				
			}
	    }
	    
	    return true;
}


