﻿function checkName(str)
{
    var regex = /[^a-zA-Z\s]/;
    if(str.match(regex))
        return false;
    return true;    
}
function checkEmail(strReceived)
{
    var emailRegex=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(2([0-4]\d|5[0-5])|1?\d{1,2})(\.(2([0-4]\d|5[0-5])|1?\d{1,2})){3} \])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    if(!emailRegex.test(strReceived))
        return false;
	return true;
}
function checkRole(role)
{
      var alphaExp = /[^-',a-zA-Z0-9\s]/;      
      if(role.match(alphaExp))     
           return false;
      return true;
}
function checkOrg(role)
{
      var alphaExp = /[^-'.,a-zA-Z0-9\s]/;      
      if(role.match(alphaExp))     
           return false;
      return true;
}
function checkAddress(address)
{
      var alphaExp = /[^-#.'\/,a-zA-Z0-9\s]/;      
      if(address.match(alphaExp))     
           return false;
      return true;
}
function checkAlphanumeric(str)
{
    var regex = /[^a-zA-Z0-9\s]/;
    if(str.match(regex))
        return false;
    return true;    
}
function checkNumeric(str)
{
    var regex = /[^0-9]/;
    if(str.match(regex))
        return false;
    return true;    
}
function checkAlpha(str)
{
    var regex = /[^a-zA-Z\s]/;
    if(str.match(regex))
        return false;
    return true;    
}
function checkDegreeTitle(str)
{
    var regex = /[^.a-zA-Z\s]/;
    if(str.match(regex))
        return false;
    return true;    
}
function checkWebAddress(str)
{
    var regex = /[^-.a-zA-Z\s]/;
    if(str.match(regex))
        return false;
    return true;    
}

function checkNamewithdot(str)
{
    var regex = /[^a-zA-Z.\s]/;
    if(str.match(regex))
        return false;
    return true;    
}
function checkGroupName(str)
{
    var alphaExp = /[^-.'\/,a-zA-Z0-9\s]/;  
    if(str.match(alphaExp))
        return false;
    return true;    
}
function checkDescription(str)
{       
    if(str.match(/<script>/gi))
        return false;
    if(str.match(/<\/script>/gi))
        return false;    
    if(str.match(/&lt/gi))
        return false;
    if(str.match(/&gt/gi))
        return false;
    if(str.match(/&#60/gi))
        return false;
    if(str.match(/&#62/gi))
        return false;    
}
function datevalidation(date)
{            
    var datesplit;                             
    var entereddate=new Date(date);                                                       
    datesplit=date.split("/");                 
    if(entereddate.getMonth()!=datesplit[1]-1 || entereddate.getDate()!=datesplit[2] ||entereddate.getFullYear()!=datesplit[0])
        return false;                                          
}
var imgHTTP=getreq();
function getreq()
{ // returns false if exists
	if(window.ActiveXObject)
	 { // if IE
		try
		 {
		    return new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
		        return new ActiveXObject("Microsoft.XMLHTTP");
		    }
		    catch(e)
		    {
		        return;
		    }
		}
	}
	else if(window.XMLHttpRequest)
	{ // if Mozilla, Safari, etc.
		return new XMLHttpRequest();
	}
}
function checkGroupName(str)
{
    var alphaExp = /[^-.'\/,a-zA-Z0-9\s]/;  
    if(str.match(alphaExp))
        return false;
    return true;    
}
function restrictSpace(e)
{
    var code;
    if(document.all)
        code=e.keyCode; 
    else if(document.getElementById)
        code=e.which;  
    if(code==32)
        return false;
}
function checkPhone(str)
{
    var regex = /[^-+0-9\s]/;
    if(str.match(regex))
        return false;
    return true;    
}

function isDescription(objValue)
{
      var alphaExp = /[<>]/;        
      if(objValue.match(alphaExp))
           return false;
      return true;
}
