
function inputLimiter(e,allow)
{

    var AllowableCharacters = '';

    if (allow == 'Letters'){
        AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    }

    if (allow == 'Numbers'){
        AllowableCharacters='1234567890';
    }

    if (allow == 'MobileNumbers'){
        AllowableCharacters='1234567890,';
    }

    if (allow == 'NameCharacters'){
        AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.\'';
    }

    if (allow == 'NameCharactersAndNumbers'){
        AllowableCharacters='1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-\'';
    }

    var k;

    k=document.all?parseInt(e.keyCode): parseInt(e.which);

    if (k!=13 && k!=8 && k!=0){

        if ((e.ctrlKey==false) && (e.altKey==false)) {

            return (AllowableCharacters.indexOf(String.fromCharCode(k))!=-1);

        } else {

            return true;

        }

    } else {

        return true;

    }
}
      
      
      
function selectallfun(){

    var objform = document.forms[0].elements;
    var selectallcheckbox = document.getElementById('selectall');



    for(var i=0;i<objform.length;i++){
        //alert(objform[i].type);
        if(objform[i].type == 'checkbox' && objform[i].name != selectallcheckbox.name ){
            objform[i].checked = selectallcheckbox.checked;
        }

    }

}
function confirmdel(){
    var objform = document.forms[0].elements;
    var selectallcheckbox = document.getElementById('selectall');
    var contact;
    for(var i=0;i<objform.length;i++)
    {
        if(objform[i].type =="checkbox" && objform[i].name != selectallcheckbox.name ){
            if(objform[i].checked ==true){
                contact = 'selected';
            }
            else{
                continue;
            }
        }
    }
    if(contact == 'selected')
    {
        var msg=confirm("Are you sure want to Delete?");
        if(msg){
            document.getElementById('action').value='delete';
            return true;
        }
        else{
            return false;
        }
    }
    else{
        alert("Please select atleast one contact");
        return false;
    }
}
function checkall(){
    var objform = document.forms[0].elements;
    // alert("hello");
    var msg;
    for(var i=0;i<objform.length;i++)
    {
        if(objform[i].type =="checkbox" && objform[i].name != document.getElementById('selectall').name )
        {
            if(objform[i].checked == true)
            {
                continue;
            }
            else
            {
                msg = 'checkednotall';
                break;
            }
        }
    }
    if(msg == 'checkednotall'){
        document.getElementById('selectall').checked = false;
    }
    else{
        document.getElementById('selectall').checked = true;
    }
}
function confirmdelet(){
    var msg=confirm("Are you sure want to Delete this ?");
    if(msg){
        return true;
    }
    else{
        return false;
    }
}
function ClearData_dept()
{
    document.getElementById("deptname").value="";
    document.getElementById("status").value="";
    document.getElementById("deptname").focus();
}
function ClearData_level()
{
    document.getElementById("alname").value="";
    document.getElementById("passcode").value="";
    document.getElementById("alname").focus();
}
function getXMLHTTP() { //fuction to return the xml http object
    var xmlhttp=false;
    try{
        xmlhttp=new XMLHttpRequest();
    }
    catch(e)	{
        try{
            xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e){
            try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e1){
                xmlhttp=false;
            }
        }
    }

    return xmlhttp;
}
function getHTTPObject()
{
    var xmlhttp;

    if(window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

        if (!xmlhttp)
        {
            xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
        }

    }
    return xmlhttp;
}

function reset_frm(){
    document.srchfrm.con_name.value='';
    document.srchfrm.emp_type.value='-1';
    document.srchfrm.status_con.value='';
    document.srchfrm.submit();
}
            
function ajaxRequest(){
    var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
    if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
        for (var i=0; i<activexmodes.length; i++){
            try{
                return new ActiveXObject(activexmodes[i]);
            }
            catch(e){
            //suppress error
            }
        }
    }
    else if (window.XMLHttpRequest) // if Mozilla, Safari etc
        return new XMLHttpRequest();
    else
        return false
}
        
         /*
               
                */
           
