
var application_webpath = '/suporte/';
var strJanAbbr = 'Jan';
var strFebAbbr = 'Fev';
var strMarAbbr = 'Mar';
var strAprAbbr = 'Abr';
var strMayAbbr = 'Mai';
var strJunAbbr = 'Jun';
var strJulAbbr = 'Jul';
var strAugAbbr = 'Ago';
var strSepAbbr = 'Set';
var strOctAbbr = 'Out';
var strNovAbbr = 'Nov';
var strDecAbbr = 'Dez';

var strMondayAbbr = 'Mo';
var strTuesdayAbbr = 'Tu';
var strWednesdayAbbr = 'We';
var strThursdayAbbr = 'Th';
var strFridayAbbr = 'Fr';
var strSaturdayAbbr = 'Sa';
var strSundayAbbr = 'Su';

var strAreYouSureUpdateLastBilled = "Are you sure you wish to update the last billed time?";
var strYouMustEnterIncidentTitle = "You must enter an incident title.";
var strKnowledgeBaseArticle = "Artigo de Base de Conhecimento";
var strSelectKBSections = "Select the sections you'd like to include in the article by checking the boxes beside each heading, you can add further sections later.  You don't need to include all sections, just use the ones that are relevant.";
var strFinalUpdate = "Final Update";
var strEnterDetailsAboutIncidentToBeStoredInLog = "Enter some details about the incident to be stored in the incident log for future use.";
var strSummaryOfProblemAndResolution = "You should provide a summary of the problem and information about how it was resolved.";

/* Please don't add functions here, these functions below need moving to webtrack.js
   this file is to make i18n keys available in javascript
*/



/**
  * Display/Hide contents of a password field
  * (converts from a password to text field and back)
  * @author Ivan Lucas
  * @param string elem. The ID of the password input HTML element
**/
function password_reveal(elem)
{
    var elemlink = 'link' + elem;
    if ($(elem).type == 'password')
    {
        $(elem).type = 'text';
        $(elemlink).innerHTML = 'Esconder';
    }
    else
    {
        $(elem).type = 'password';
        $(elemlink).innerHTML = 'Revelar';
    }
}



/**
  * Check the LDAP details entered and display the results
  * @author Paul heaney
  * @param string statusfield element ID of the DIV that will contain the status text
*/
function checkLDAPDetails(statusfield)
{
    $(statusfield).innerHTML = "<strong>Checking Details</strong>";

    var server = $('ldap_host').value;
    var port = $('ldap_port').value;
    var protocol = $('ldap_protocol').options[$('ldap_protocol').selectedIndex].value;
    var security = $('ldap_security').options[$('ldap_security').selectedIndex].value;
    var user = $('ldap_bind_user').value;
    var password = $('cfgldap_bind_pass').value;

    // Auto save
    var xmlhttp=false;

    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
        try
        {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e)
        {
            xmlhttp=false;
        }
    }
    if (!xmlhttp && window.createRequest)
    {
        try
        {
            xmlhttp = window.createRequest();
        }
        catch (e)
        {
            xmlhttp=false;
        }
    }

    var url =  "ajaxdata.php";
    var params = "action=checkldap&ldap_host="+server+"&ldap_port="+port+"&ldap_protocol="+protocol+"&ldap_security="+security+"&ldap_bind_user="+escape(user)+"&ldap_bind_pass="+escape(password);
    xmlhttp.open("POST", url, true)
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");


    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4)
        {
            if (xmlhttp.responseText != '')
            {
                if (xmlhttp.responseText == 1)
                {
                    $(statusfield).innerHTML = "<strong>LDAP Connection Sucessful</strong>";
                }
                else
                {
                    $(statusfield).innerHTML = "<strong>LDAP Connection Failed</strong>";
                }
            }
        }
    }
    xmlhttp.send(params);
}


