// JavaScript Document
//################################################################################################
//#				     KEYPRESS FOR ACCEPT NUMBER ONLY		                                   #//
//################################################################################################
/*DAL PATH BEGINS DONT DELETE IT */
var dalpath="dal/";
/*DAL PATH ENDS */
/*	GENERAL VALIDATION	*/
function noCharecter(e)
{
var keynum;
var keychar;
var numcheck;

if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
 /* if(NoSpecialChar(keynum)==0)
 { 
	return false;  
 }*/
keychar = String.fromCharCode(keynum);
numcheck = /[a-z]/;

return !numcheck.test(keychar);
 
if( (e.keyCode ==  8 )|| (e.keyCode ==  46 )|| (e.keyCode ==  37) )
{
return true;
}
else
{
return false;
}
}

//It will accept Integer Only 
function IntegerOnly(e)
{
var keynum;
var keychar;
var numcheck;
if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
 if(NoSpecialChar(keynum,"int")==0)
 { 
	return false;  
 }
keychar = String.fromCharCode(keynum);
numcheck = /[a-z]/;

return !numcheck.test(keychar);
 
if( (e.keyCode ==  8 )|| (e.keyCode ==  46 )|| (e.keyCode ==  37) )
{
return true;
}
else
{
return false;
}
}
	
function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid E-mail ID")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid E-mail ID")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid E-mail ID")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid E-mail ID")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert("Invalid E-mail ID")
		return false
	 }

	 return true					
}
function catching()
{
	 var date = new Date(); 
	 var cache = date.getTime();
	 return cache;
}
function confirmCancel() 
{ 
    var agree=confirm("Are you sure you wish to cancel this entry?"); 
    if (agree) 
        return true; 
    else 
        return false; 
}
function confirmDelete() 
{ 
    var agree=confirm("Are you sure you wish to delete this entry?"); 
    if (agree) 
        return true; 
    else 
        return false; 
}
/*	FILTER VALUES	*/
function escapeamp(s) 
{
	s = s.replace(/&/g,"|amp;|");
	s = s.replace(/,/g,"|comma;|");
	return s;
}
/*	DATE CONVERTER */
function DateConvert(str) {
	var dataitems = str.split("-");
	str=dataitems[2] +'-' + dataitems[1] + '-' + dataitems[0]; 
	return  str;
}
/*	URL VALIDATION 	*/
function isURL(s) {
 	var regexp = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
	if(regexp.test(s))
     {
         return true;
     }else{
         return false; 
     }
}
