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 document_id(el) {
    return document.getElementById(el); //Get the element with the specified ID
}

/*
 -----------@@@Tania@ Start support Part----------------------------------
 */
/*
 * @Function            : activeknowledgebase 
 * @Used IN             : manage_knowledgebase line--74
 * @Description         : used to active knowledge
 * @Developed By        : Tania Akter
 * @Start DateTime      : 28-04-2016 10:32 AM
 * @Status              : available      
 */
function activeknowledgebase(url, support_id) {
    var xmlhttp2;
    xmlhttp2 = checkxmlhttp(xmlhttp2);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp2.addEventListener("load", function () {
        location.reload();
        //window.location.href = url1;
    }, false);
    xmlhttp2.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp2.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp2.open("POST", url);
    xmlhttp2.send(formdata);
}

/*
 * @Function            : deleteknowledgebase 
 * @Used IN             :  manage_knowledgebase line-- 57
 * @Description         :  used to delete knowledgebase
 * @Developed By        : Tania Akter
 * parameter            :url, url1, support_id
 * @Start DateTime      : 27-04-2016 10:32 AM
 * @Status              : available      
 */
function deleteknowledgebase(url, url1, support_id) {
    var xmlhttp1;
    xmlhttp1 = checkxmlhttp(xmlhttp1);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp1.addEventListener("load", function () {
        // location.reload();
        window.location.href = 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            : inactiveknowledgebases 
 * @Used IN             : manage_knowledgebase line--92
 * @Description         : used to inactive knowledge 
 * parameter            :url, support_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 28-04-2016 10:32 AM
 * @Status              : available      
 */
function inactiveknowledgebase(url, support_id) {
    var xmlhttp3;
    xmlhttp3 = checkxmlhttp(xmlhttp3);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    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            : more_view_knowledgebase 
 * @Used IN             : front_end/tt_support/support_knowledgebase_answer  line---55
 * @Description         : used to view more related knowledgebase 
 * parameter            : url, counter
 * @Developed By        : Tania Akter
 * @Start DateTime      : 30-04-2016 10:32 AM
 * @Status              : available      
 */
function more_view_knowledgebase(url, counter) {
    // alert(counter);
    var xmlhttp4;
    xmlhttp4 = checkxmlhttp(xmlhttp4);
    var formdata = new FormData();
    formdata.append("counter", counter);
    xmlhttp4.addEventListener("load", function () {
        document.getElementById("more_knowledgebase").innerHTML = xmlhttp4.responseText;
    }, false);
    xmlhttp4.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp4.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp4.open("POST", url);
    xmlhttp4.send(formdata);
}

/*
 * @Function            : getIdeafile 
 * @Used IN             : front_end/tt_support/idea_share   line---78
 * @Description         : used to get file like(pdf, txt, docx)
 * parameter            : url, counter
 * @Developed By        : Tania Akter
 * @Start DateTime      : 02-05-2016 10:32 AM
 * @Status              : available      
 */

function getIdeafile(inputFile) {
    var allowedFileType = "zip docx doc jpg gif png ";
    var file = inputFile.files[0];
    var fileName = file.name;
    var fileExtention = fileName.split('.').pop().toLowerCase();
    var n = allowedFileType.search(fileExtention);
    if (n > -1) {
        if (file.size === 0) {
            document_id('src_file').setAttribute('src', '');
            document_id('idea_file').value = '';
            document_id('upload_file').innerHTML = '<span style="color:red">File is empty. Please select again</span>';
        }
        else {
            if (fileExtention === 'docx' || fileExtention === 'doc' || fileExtention === 'zip') {
                if (file.size < 5242880) {
                    document_id('upload_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('idea_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">File size must less then 5 Mb</span>';
                }
            }
            else if (fileExtention === 'jpg' || fileExtention === 'png' || fileExtention === 'gif') {
                if (file.size < 2097152) {
                    document_id('upload_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('idea_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">Image size must less then 2 Mb</span>';
                }
            }
        }
    }
    else {
        document_id('src_file').setAttribute('src', '');
        document_id('idea_file').value = '';
        document_id('upload_file').innerHTML = '<span style="color:red">Please select file type: docx doc jpg png gif zip </span>';
    }
}


/*
 * @Function            : more_view_idea 
 * @Used IN             : front_end/tt_support/support_idea_answer   line---176
 * @Description         : used to view more related idea
 * parameter            : url, counter
 * @Developed By        : Tania Akter
 * @Start DateTime      : 02-05-2016 10:32 AM
 * @Status              : available      
 */
function more_view_idea(url, counter) {
    var xmlhttp7;
    xmlhttp7 = checkxmlhttp(xmlhttp7);
    var formdata = new FormData();
    formdata.append("counter", counter);
    xmlhttp7.addEventListener("load", function () {
        document.getElementById("more_idea").innerHTML = xmlhttp7.responseText;

    }, false);
    xmlhttp7.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp7.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp7.open("POST", url);
    xmlhttp7.send(formdata);
}

/*
 * @Function            : getIdeareplyfile 
 * @Used IN             : front_end/tt_support/idea_share   line---78
 * @Description         : used to get file like(pdf, txt, docx)
 * parameter            : inputFile
 * @Developed By        : Tania Akter
 * @Start DateTime      : 02-05-2016 10:32 AM
 * @Status              : available      
 */

function getIdeareplyfile(inputFile) {
    var allowedFileType = "zip docx doc jpg gif png ";
    var file = inputFile.files[0];
    var fileName = file.name;
    var fileExtention = fileName.split('.').pop().toLowerCase();
    var n = allowedFileType.search(fileExtention);
    if (n > -1) {
        if (file.size === 0) {
            document_id('src_file').setAttribute('src', '');
            document_id('idea_reply_file').value = '';
            document_id('upload_reply_file').innerHTML = '<span style="color:red">File is empty. Please select again</span>';
        }
        else {
            if (fileExtention === 'docx' || fileExtention === 'doc' || fileExtention === 'zip') {
                if (file.size < 5242880) {
                    document_id('upload_reply_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('idea_reply_file').value = '';
                    document_id('upload_reply_file').innerHTML = '<span style="color:red">File size must less then 5 Mb</span>';
                }
            }
            else if (fileExtention === 'jpg' || fileExtention === 'png' || fileExtention === 'gif') {
                if (file.size < 2097152) {
                    document_id('upload_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('idea_reply_file').value = '';
                    document_id('upload_reply_file').innerHTML = '<span style="color:red">Image size must less then 2 Mb</span>';
                }
            }
        }
    }
    else {
        document_id('src_file').setAttribute('src', '');
        document_id('idea_reply_file').value = '';
        document_id('upload_reply_file').innerHTML = '<span style="color:red">Please select file type: docx doc jpg png gif zip </span>';
    }
}

/*
 * @Function            : downloadIdeaAssignment 
 * @Used IN             : front_end/tt_support/support_idea_answer  line---44,55, 64, 75, 86, 95
 * @Description         : used to download idea file
 * parameter            : url, support_attachment_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 05-05-2016 10:32 AM
 * @Status              : available      
 */
function downloadIdeaAssignment(url, support_attachment_id) {
    //alert(postID);   
    window.location.href = url + '/' + support_attachment_id;
}
/*
 * @Function            : downloadIdeaReplyAssignment 
 * @Used IN             : front_end/tt_support/support_idea_answer  line---144,155, 164, 175, 186, 195
 * @Description         : used to download idea reply file
 * parameter            : url, support_attachment_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 05-05-2016 10:32 AM
 * @Status              : available      
 */
function downloadIdeaReplyAssignment(url, support_attachment_id) {
    //alert(postID);

    window.location.href = url + '/' + support_attachment_id;
}

/*
 * @Function            : displayReplyMessage 
 * @Used IN             : front_end/tt_support/support_idea_answer  line----222
 * @Description         : used to disply message
 * parameter            : none
 * @Developed By        : Tania Akter
 * @Start DateTime      : 05-05-2016 10:32 AM
 * @Status              : available      
 */
function displayReplyMessage() {
    // document.getElementById("show_message").innerHTML = "Please login to reply";    
    document.getElementById("clickhere").innerHTML = '<span style="color:red">Please login to reply</span>';
}


/*
 * @Function            : activeidea
 * @Used IN             : admin/support/manage_ideas   line-- 50
 * @Description         : used to active idea
 * @Developed By        : Tania Akter
 * @Start DateTime      : 08-05-2016 10:32 AM
 * @Status              : available      
 */
function activeidea(url, support_id) {
    var xmlhttp8;
    xmlhttp8 = checkxmlhttp(xmlhttp8);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp8.addEventListener("load", function () {
        location.reload();
        //window.location.href = url1;
    }, false);
    xmlhttp8.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp8.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp8.open("POST", url);
    xmlhttp8.send(formdata);
}

/*
 * @Function            : inactiveidea
 * @Used IN             : admin/support/manage_ideas   line--66
 * @Description         : used to inactive idea
 * @Developed By        : Tania Akter
 * @Start DateTime      : 08-05-2016 10:32 AM
 * @Status              : available      
 */
function inactiveidea(url, support_id) {
    var xmlhttp9;
    xmlhttp9 = checkxmlhttp(xmlhttp9);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp9.addEventListener("load", function () {
        location.reload();
        //window.location.href = url1;
    }, false);
    xmlhttp9.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp9.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp9.open("POST", url);
    xmlhttp9.send(formdata);
}
/*
 * @Function            : deleteidea
 * @Used IN             : admin/support/manage_ideas line--85
 * @Description         : used to delete idea
 * @Developed By        : Tania Akter
 * @Start DateTime      : 08-05-2016 10:32 AM
 * @Status              : available      
 */
function deleteidea(url, url1, support_id) {
    var xmlhttp10;
    xmlhttp10 = checkxmlhttp(xmlhttp10);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp10.addEventListener("load", function () {
        window.location.href = url1;
    }, false);
    xmlhttp10.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp10.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp10.open("POST", url);
    xmlhttp10.send(formdata);
}

/*
 * @Function            : getupdateideafile
 * @Used IN             : admin/support/edit_idea line- 51
 * @Description         : used to get update idea attachment
 * @Developed By        : Tania Akter
 * @Start DateTime      : 09-05-2016 10:32 AM
 * @Status              : available      
 */

function getupdateideafile(inputFile) {
    var allowedFileType = "zip docx doc jpg gif png ";
    var file = inputFile.files[0];
    var fileName = file.name;
    var fileExtention = fileName.split('.').pop().toLowerCase();
    var n = allowedFileType.search(fileExtention);
    if (n > -1) {
        if (file.size === 0) {
            document_id('src_file').setAttribute('src', '');
            document_id('update_idea_file').value = '';
            document_id('upload_file').innerHTML = '<span style="color:red">File is empty. Please select again</span>';
        }
        else {
            if (fileExtention === 'docx' || fileExtention === 'doc' || fileExtention === 'zip') {
                if (file.size < 5242880) {
                    document_id('upload_file').innerHTML = '';
                    document_id('view_image').innerHTML = '';
                    document_id('view_file_delete_icon').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('update_idea_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">File size must less then 5 Mb</span>';
                }
            }
            else if (fileExtention === 'jpg' || fileExtention === 'png' || fileExtention === 'gif') {
                if (file.size < 2097152) {
                    document_id('upload_file').innerHTML = '';
                    document_id('view_image').innerHTML = '';
                    document_id('view_file_delete_icon').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('update_idea_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">Image size must less then 2 Mb</span>';
                }
            }
        }
    }
    else {
        document_id('src_file').setAttribute('src', '');
        document_id('update_idea_file').value = '';
        document_id('upload_file').innerHTML = '<span style="color:red">Please select file type: docx doc jpg png gif zip </span>';
    }
}
/*
 * @Function            : deleteideafile
 * @Used IN             :admin/support/edit_idea line-31
 * @Description         : used to delete only idea attachment
 * @Developed By        : Tania Akter
 * @Start DateTime      : 10-05-2016 10:32 AM
 * @Status              : available      
 */
function deleteideafile(url, url1, support_attachment_id) {
    var xmlhttp11;
    xmlhttp11 = checkxmlhttp(xmlhttp11);
    var formdata = new FormData();
    formdata.append("support_attachment_id", support_attachment_id);
    xmlhttp11.addEventListener("load", function () {
        window.location.href = url1;
    }, false);
    xmlhttp11.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp11.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp11.open("POST", url);
    xmlhttp11.send(formdata);
}

/*
 * @Function            : getbugfile
 * @Used IN             : admin/support/report_a_bug
 * @Description         : used to get bug report attachment
 * @parameter           : inputFile (upload file)
 * @Developed By        : Tania Akter
 * @Start DateTime      : 15-05-2016 10:32 AM
 * @Status              : available      
 */

function getbugfile(inputFile) {
    var allowedFileType = "zip docx doc jpg gif png ";
    var file = inputFile.files[0];
    var fileName = file.name;
    var fileExtention = fileName.split('.').pop().toLowerCase();
    var n = allowedFileType.search(fileExtention);
    if (n > -1) {
        if (file.size === 0) {
            document_id('src_file').setAttribute('src', '');
            document_id('bug_file').value = '';
            document_id('upload_file').innerHTML = '<span style="color:red">File is empty. Please select again</span>';
        }
        else {
            if (fileExtention === 'docx' || fileExtention === 'doc' || fileExtention === 'zip') {
                if (file.size < 5242880) {
                    document_id('upload_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('bug_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">File size must less then 5 Mb</span>';
                }
            }
            else if (fileExtention === 'jpg' || fileExtention === 'png' || fileExtention === 'gif') {
                if (file.size < 2097152) {
                    document_id('upload_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('bug_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">Image size must less then 2 Mb</span>';
                }
            }
        }
    }
    else {
        document_id('src_file').setAttribute('src', '');
        document_id('bug_file').value = '';
        document_id('upload_file').innerHTML = '<span style="color:red">Please select file type: docx doc jpg png gif zip </span>';
    }
}

/*
 * @Function            : deletebugreport
 * @Used IN             : admin/support/manage_bug_report
 * @Description         : used to delete bug report
 * @parameter           : url, url1, support_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */
function deletebugreport(url, url1, support_id) {
    var xmlhttp12;
    xmlhttp12 = checkxmlhttp(xmlhttp12);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp12.addEventListener("load", function () {
        window.location.href = url1;
    }, false);
    xmlhttp12.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp12.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp12.open("POST", url);
    xmlhttp12.send(formdata);
}
/*
 * @Function            : activebugreport 
 * @Used IN             : admin/support/manage_bug_report
 * @Description         : to active bug report
 * parameter            : url, support_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */
function activebugreport(url, support_id){
    var xmlhttp13;
    xmlhttp13 = checkxmlhttp(xmlhttp13);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp13.addEventListener("load", function () {
        location.reload();
    }, false);
    xmlhttp13.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp13.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp13.open("POST", url);
    xmlhttp13.send(formdata);
}

/*
 * @Function            :inactivebugreport  
 * @Used IN             : admin/support/manage_bug_report --75
 * @Description         : to inactive bug report
 * parameter            : url, support_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */

function inactivebugreport(url, support_id){
    var xmlhttp14;
    xmlhttp14 = checkxmlhttp(xmlhttp14);
    var formdata = new FormData();
    formdata.append("support_id", support_id);
    xmlhttp14.addEventListener("load", function () {
        location.reload();
    }, false);
    xmlhttp14.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp14.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp14.open("POST", url);
    xmlhttp14.send(formdata);
}
/*
 * @Function            :more_view_bug_report  
 * @Used IN             : front_end/tt_support/support_bug_report_answer
 * @Description         : used to view more bug report
 * parameter            : url, counter 
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */

function more_view_bug_report(url, counter){
     var xmlhttp15;
    xmlhttp15 = checkxmlhttp(xmlhttp15);
    var formdata = new FormData();
    formdata.append("counter", counter);
    xmlhttp15.addEventListener("load", function () {
        document.getElementById("more_bug_report").innerHTML = xmlhttp15.responseText;
    }, false);
    xmlhttp15.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp15.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp15.open("POST", url);
    xmlhttp15.send(formdata);
}


/*
 * @Function            : download_bug_report_attachment
 * @Used IN             : front_end/tt_support/support_bug_report_answer
 * @Description         : used to download bug report attachment
 * parameter            : url, support_attachment_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */
function download_bug_report_attachment(url, support_attachment_id) {
    window.location.href = url + '/' + support_attachment_id;
}
/*
 * @Function            : getbugreplyfile 
 * @Used IN             : front_end/tt_support/support_bug_report_answer
 * @Description         : used to get bug report reply attachment
 * parameter            : inputFile(upload attachment)
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */
function getbugreplyfile(inputFile){
       var allowedFileType = "zip docx doc jpg gif png ";
    var file = inputFile.files[0];
    var fileName = file.name;
    var fileExtention = fileName.split('.').pop().toLowerCase();
    var n = allowedFileType.search(fileExtention);
    if (n > -1) {
        if (file.size === 0) {
            document_id('src_file').setAttribute('src', '');
            document_id('bug_report_reply_file').value = '';
            document_id('upload_reply_file').innerHTML = '<span style="color:red">File is empty. Please select again</span>';
        }
        else {
            if (fileExtention === 'docx' || fileExtention === 'doc' || fileExtention === 'zip') {
                if (file.size < 5242880) {
                    document_id('upload_reply_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('bug_report_reply_file').value = '';
                    document_id('upload_reply_file').innerHTML = '<span style="color:red">File size must less then 5 Mb</span>';
                }
            }
            else if (fileExtention === 'jpg' || fileExtention === 'png' || fileExtention === 'gif') {
                if (file.size < 2097152) {
                    document_id('upload_file').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('bug_report_reply_file').value = '';
                    document_id('upload_reply_file').innerHTML = '<span style="color:red">Image size must less then 2 Mb</span>';
                }
            }
        }
    }
    else {
        document_id('src_file').setAttribute('src', '');
        document_id('bug_report_reply_file').value = '';
        document_id('upload_reply_file').innerHTML = '<span style="color:red">Please select file type: docx doc jpg png gif zip </span>';
    } 
}

/*
 * @Function            : download_bug_report_reply_attachment
 * @Used IN             : front_end/tt_support/support_bug_report_answer
 * @Description         : used to download bug report reply attachment 
 * parameter            : url, support_attachment_id
 * @Developed By        : Tania Akter
 * @Start DateTime      : 16-05-2016 10:32 AM
 * @Status              : available      
 */
function download_bug_report_reply_attachment(url, support_attachment_id) {  
    window.location.href = url + '/' + support_attachment_id;
}
/*
 * @Function            : getupdatebugfile
 * @Used IN             : admin/support/edit_bug_report
 * @Description         : used to get update bug report attachment
 * parameter            : inputFile (upload attachment)
 * @Developed By        : Tania Akter
 * @Start DateTime      : 17-05-2016 10:32 AM
 * @Status              : available      
 */
function getupdatebugfile(inputFile){
     var allowedFileType = "zip docx doc jpg gif png ";
    var file = inputFile.files[0];
    var fileName = file.name;
    var fileExtention = fileName.split('.').pop().toLowerCase();
    var n = allowedFileType.search(fileExtention);
    if (n > -1) {
        if (file.size === 0) {
            document_id('src_file').setAttribute('src', '');
            document_id('update_bug_file').value = '';
            document_id('upload_file').innerHTML = '<span style="color:red">File is empty. Please select again</span>';
        }
        else {
            if (fileExtention === 'docx' || fileExtention === 'doc' || fileExtention === 'zip') {
                if (file.size < 5242880) {
                    document_id('upload_file').innerHTML = '';
                    document_id('view_image').innerHTML = '';
                    document_id('view_file_delete_icon').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('update_bug_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">File size must less then 5 Mb</span>';
                }
            }
            else if (fileExtention === 'jpg' || fileExtention === 'png' || fileExtention === 'gif') {
                if (file.size < 2097152) {
                    document_id('upload_file').innerHTML = '';
                    document_id('view_image').innerHTML = '';
                    document_id('view_file_delete_icon').innerHTML = '';
                }
                else {
                    document_id('src_file').setAttribute('src', '');
                    document_id('update_bug_file').value = '';
                    document_id('upload_file').innerHTML = '<span style="color:red">Image size must less then 2 Mb</span>';
                }
            }
        }
    }
    else {
        document_id('src_file').setAttribute('src', '');
        document_id('update_bug_file').value = '';
        document_id('upload_file').innerHTML = '<span style="color:red">Please select file type: docx doc jpg png gif zip </span>';
    }   
}
/*
 * @Function            : deletebugattachment
 * @Used IN             : admin/support/edit_bug_report    line--112
 * @Description         : used to delete only bug attachment
 * @Developed By        : Tania Akter
 * @Start DateTime      : 17-05-2016 10:32 AM
 * @Status              : available      
 */
function deletebugattachment(url, url1, support_attachment_id) {
    var xmlhttp16;
    xmlhttp16 = checkxmlhttp(xmlhttp16);
    var formdata = new FormData();
    formdata.append("support_attachment_id", support_attachment_id);
    xmlhttp16.addEventListener("load", function () {
        window.location.href = url1;
    }, false);
    xmlhttp16.addEventListener("error", function () {
        alert("not working");
    }, false);
    xmlhttp16.addEventListener("abort", function () {
        alert("Aborted");
    }, false);
    xmlhttp16.open("POST", url);
    xmlhttp16.send(formdata);
}


/*
 * @Function            : check_form
 * @Used IN             : report_a_bug form
 * @Description         : for validating google captcha
 * @parameter           : 
 * @Developed By        : Kazol
 * @Start DateTime      : 14/05/2017
 * @Status              : available   
 */
function check_form(){
   
    var v = grecaptcha.getResponse();
            if(v.length == 0)
        {
            //alert("please complete the captcha");
              swal({
                title: "",
                text: "please complete the captcha",
                type: "warning",
                confirmButtonColor: "#80c12c",
                confirmButtonText: "OK",
                closeOnConfirm: false

              });

            //document.getElementById('captcha').innerHTML="You can't leave Captcha Code empty";
            return false;
        }
        else{
             return true;
           }
    }