    function checkXMLHTTP(xmlhttp) {
        xmlhttp = false;
        try {
            return xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                return xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
        if (!xmlhttp && typeof XMLHttpRequest !== 'undefined') {
            return xmlhttp = new XMLHttpRequest();
        }
    }
function documentID(el) {
    return document.getElementById(el); //Get the element with the specified ID
}
/*
 -----------@@@Tania@ Start forbidden Part----------------------------------
 */
/*
 * @Function            : selectForbiddenType 
 * @Used IN             : admin_forbidden_view   line 77
 * @Description         : what type of forbidden selected and show what(url/name/organization) will be typed in input field
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
function selectForbiddenType(forbiddenType) {
        var forbiddenName = document.getElementById("forbidden_name");
        if (forbiddenType === '0') {         //forbiddenType === '0' means forbidden type is not selected or default
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[requiredForbidden]]');
            forbiddenName.setAttribute('readonly', '');
            forbiddenName.placeholder = "Please type Forbidden Name....";
            forbiddenName.value = '';
            documentID('forbidden_exists').value = '';
        } else if (forbiddenType === '1') {             //forbiddenType === '1' means forbidden type is url
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[urlSpecialCaracter], custom[forbiddenURLExists], custom[spaceFunction], custom[noCapital], custom[checkUrlHypen], custom[checkUrlHypenLast]]');
            forbiddenName.removeAttribute('readonly');
            forbiddenName.placeholder = "Please type Url....";
            forbiddenName.value = '';
            documentID('forbidden_exists').value = '';            
        } else if (forbiddenType === '2') {               //forbiddenType === '2' means forbidden type is name
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenNameValid],custom[forbiddenNameExists], custom[lastNameLength]]');
            forbiddenName.removeAttribute('readonly');
            forbiddenName.placeholder = "Please type Name....";
            forbiddenName.value = '';
            documentID('forbidden_exists').value = '';            
        } else if (forbiddenType === '3') {               //forbiddenType === '3' means forbidden type is org
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenNameValid], custom[forbiddenOrganizationExists],custom[lastNameLength]]');
            forbiddenName.removeAttribute('readonly');
            forbiddenName.value = '';
            forbiddenName.placeholder = "Please type Organization....";
            documentID('forbidden_exists').value = '';            
        } else if (forbiddenType === '4') {               //forbiddenType === '4' means forbidden type is email
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenEmailExists], custom[email]]');
            forbiddenName.removeAttribute('readonly');
            forbiddenName.value = '';
            forbiddenName.placeholder = "Please type Email....";
            documentID('forbidden_exists').value = '';            
        }
    }
/*
 * @Function            : checkForbiddenExist 
 * @Used IN             : admin/forbidden/admin_forbidden    line 91
 * @Description         : The following function demonstrates how a browser create XMLHttpRequest and create a response and send data back to the brower by ajax  
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */    
    function checkForbiddenExist(forbiddenName, forbiddenType, url) {
        var xmlhttp;
        xmlhttp = checkXMLHTTP(xmlhttp);
        var formdata = new FormData();
        formdata.append("forbiddenName", forbiddenName);
        formdata.append("forbiddenType", forbiddenType);
        xmlhttp.addEventListener("load", function () {
            if (xmlhttp.responseText === '1') {    
                documentID('forbidden_exists').value = '1';                
            } else if (xmlhttp.responseText === '2') {
                documentID('forbidden_exists').value = '';                
            }
        }, false);
        xmlhttp.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp.open("POST", url);
        xmlhttp.send(formdata);
    }
/*
 * @Function            : editForbidden 
 * @Used IN             : admin/forbidden/admin_forbidden_view   line----164
 * @Description         : to edit forbidden info
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function editForbidden(url, url1, forbidden_id)
    {
        var xmlhttp1;
        xmlhttp1 = checkXMLHTTP(xmlhttp1);
        var formdata = new FormData();
        formdata.append("forbidden_id", forbidden_id);

        xmlhttp1.addEventListener("load", function () {
            document.getElementById("EditForbiddenForm").innerHTML = xmlhttp1.responseText;
            //document.getElementById("manageForbiddenForm").innerHTML = xmlhttp1.responseText;
            document.getElementById("fordibben_type").value = document.getElementById("hidden_forbidden_type").value;
            var forbiddenType = document.getElementById("fordibben_type").value;
            var forbiddenName = document.getElementById("forbidden_name1");

            if (forbiddenType === '1') //forbiddenType === '1' means forbidden type is url
            {
                forbiddenName.setAttribute('class', 'form-control validate[required, custom[urlSpecialCaracter], custom[updateForbiddenURLExists], custom[spaceFunction], custom[noCapital], custom[checkUrlHypen], custom[checkUrlHypenLast]]');
            }
            else if (forbiddenType === '2') //forbiddenType === '2' means forbidden type is name
            {
                forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenNameValid],custom[updateForbiddenNameExists], custom[lastNameLength]]');
            }
            else if (forbiddenType === '3') { //forbiddenType === '3' means forbidden type is organization
                forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenNameValid], custom[updateForbiddenOrganizationExists],custom[lastNameLength]]');
            }
             else if (forbiddenType === '4') { //forbiddenType === '4' means forbidden type is email
                forbiddenName.setAttribute('class', 'form-control validate[required, custom[updateForbiddenEmailExists],custom[email]]');
            }            
           
            manageForbiddenEditView(forbidden_id, url1);
       
        }, false);
        xmlhttp1.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp1.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp1.open("POST", url);
        xmlhttp1.send(formdata);
    }
    /*
 * @Function            : manageForbiddenEditView 
 * @Used IN             : @function['editForbidden'] @js[forbidden.js]        line -129
 * @Description         : 
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function manageForbiddenEditView(forbiddenId, url){
     //alert(forbiddenId);   
         var xmlhttp6;
         xmlhttp6 = checkXMLHTTP(xmlhttp6);
        var formdata = new FormData();
        formdata.append("forbiddenId", forbiddenId);       
        xmlhttp6.addEventListener("load", function () {            
//           alert(xmlhttp6.responseText);
           document.getElementById("manageForbiddenForm").innerHTML = xmlhttp6.responseText;
        }, false);
        xmlhttp6.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp6.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp6.open("POST", url);
        xmlhttp6.send(formdata);
    }
/*
 * @Function            : updateForbiddenType 
 * @Used IN             : admin_forbidden_update_view line -19
 * @Description         : this function is used to what type of forbidden selected for update
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function updateForbiddenType(forbiddenType) {
        var forbiddenName = document.getElementById("forbidden_name1");
        if (forbiddenType === '1') {  //forbiddenType === '1' means forbidden type is url
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[urlSpecialCaracter], custom[updateForbiddenURLExists], custom[spaceFunction], custom[noCapital], custom[checkUrlHypen], custom[checkUrlHypenLast]]');
            forbiddenName.placeholder = "Please type Url....";
            forbiddenName.value = '';            
        }
        else if (forbiddenType === '2') {   //forbiddenType === '2' means forbidden type is name
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenNameValid],custom[updateForbiddenNameExists], custom[lastNameLength]]');
            forbiddenName.placeholder = "Please type Name....";
            forbiddenName.value = '';            
        }
        else if (forbiddenType === '3') {       //forbiddenType === '3' means forbidden type is organization
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[forbiddenNameValid], custom[updateForbiddenOrganizationExists],custom[lastNameLength]]');
            forbiddenName.placeholder = "Please type Organization....";
            forbiddenName.value = '';            
        }
        else if (forbiddenType === '4') {       //forbiddenType === '4' means forbidden type is email
            forbiddenName.setAttribute('class', 'form-control validate[required, custom[updateForbiddenEmailExists],custom[email]]');
            forbiddenName.placeholder = "Please type Organization....";
            forbiddenName.value = '';            
        }
    }
/*
 * @Function            : updateForbiddenExist 
 * @Used IN             : admin_forbidden_update_view line -34
 * @Description         : is used to check update forbidden are exist in database
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function updateForbiddenExist(forbiddenName, forbiddenType, url) {

        var xmlhttp;
        xmlhttp = checkXMLHTTP(xmlhttp);
        var formdata = new FormData();
        formdata.append("forbiddenName", forbiddenName);
        formdata.append("forbiddenType", forbiddenType);

        xmlhttp.addEventListener("load", function () {
            if (xmlhttp.responseText === '1') { //super admin typed in input field to update url/name/organization if that are already exists in database then it will be  1;
                documentID('forbidden_exists_update').value = '1';                
            } else if (xmlhttp.responseText === '2') { //super admin typed in input field to update url/name/organization if that are not exists in database then it will be 2;
                documentID('forbidden_exists_update').value = '';                
            }
        }, false);
        xmlhttp.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp.open("POST", url);
        xmlhttp.send(formdata);
    }
/*
 * @Function            : deleteForbidden 
 * @Used IN             : admin/forbidden/admin_forbidden_view   line--246
 * @Description         : used to delete forbidden
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function deleteForbidden(url, url1, forbiddenId) {
          var xmlhttp3;
        xmlhttp3 = checkXMLHTTP(xmlhttp3);
        var formdata = new FormData();
        formdata.append("forbiddenId", forbiddenId);
        xmlhttp3.addEventListener("load", function () {
         //   location.reload();
             window.location.href = url1;
        }, false);
        xmlhttp3.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp3.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp3.open("POST", url);
        xmlhttp3.send(formdata);
    }
/*
 * @Function            : cancelUpdateForbiddenForm 
 * @Used IN             : admin/forbidden/admin_forbidden_view
 * @Description         : used to cancel update form
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */    
    function cancelUpdateForbiddenForm() {
        document.getElementById("EditForbiddenForm").innerHTML = "";
    }
/*
 * @Function            : getforbiddenSearchValue 
 * @Used IN             : admin/forbidden/admin_forbidden_view   line 31
 * @Description         : used to get search value what is typed by admin/super admin
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function getforbiddenSearchValue(searchForbidden, url) {
        var xmlhttp4;
        xmlhttp4 = checkXMLHTTP(xmlhttp4);
        var formdata = new FormData();              //here, FormData() is constructor .it creates a new FormData object. By this we can easily construct a set of pairs(fields and their values), which can then be easily sent using the XMLHttpRequest post method
        formdata.append("searchForbidden", searchForbidden);
        xmlhttp4.addEventListener("load", function () {
            document.getElementById("manageForbiddenForm").innerHTML = xmlhttp4.responseText; //.innerHTML allows JavaScript to change the content of manageForbiddenForm element.
        }, false);
        xmlhttp4.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp4.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp4.open("POST", url);
        xmlhttp4.send(formdata);
    }
    /*
 * @Function            : getSearchforbiddenType 
 * @Used IN             : admin/forbidden/admin_forbidden_view   line 43
 * @Description         : used to get search type what is selected by admin/super admin
 * @Developed By        : Tania Akter
 * @Start DateTime      : 23-04-2016 10:32 AM
 * @Status              : available      
 */
    function getSearchforbiddenType(searchForbiddenType, url) {
        var xmlhttp5;
        xmlhttp5 = checkXMLHTTP(xmlhttp5);
        var formdata = new FormData();
        formdata.append("searchForbiddenType", searchForbiddenType);
        xmlhttp5.addEventListener("load", function () {      //addEventListener() method attaches an event handler to the xmlhttp5.
            document.getElementById("manageForbiddenForm").innerHTML = xmlhttp5.responseText; //.innerHTML allows JavaScript to change the content of manageForbiddenForm element.
        }, false);
        xmlhttp5.addEventListener("error", function () {
            alert("not working");
        }, false);
        xmlhttp5.addEventListener("abort", function () {
            alert("Aborted");
        }, false);
        xmlhttp5.open("POST", url);
        xmlhttp5.send(formdata);
    }
    
    
    
    
   $(document).ready(function () //ready() is used to make a function available after the document is loaded
    {
        $("#addForbidden").click(function ()
        {
            $("#addForbiddenForm").slideDown('slow'); //slideDown() used to hidden elements
            return false;
        });
    });
    $(document).ready(function ()
    {
        $("#CancelForbiddenForm").click(function ()
        {
            $("#addForbiddenForm").slideUp('slow'); //slideUp() method slides-up (hides) the selected elements.
            return false;
        });
    });


