function toogleCollapsable(theDiv,currentDomain) {
    var theCollapsedDiv = document.getElementById(theDiv);
    var theControllerImage = document.getElementById('expandcontrollerimage');
    if (theCollapsedDiv != null) {

        if (theCollapsedDiv.style.display != 'block') {
            theCollapsedDiv.style.display = 'block';

            if (theControllerImage != null) {
                theControllerImage.src = currentDomain + '/webpac_content/global/images/minus_box.jpg';
            }
        }
        else {
            theCollapsedDiv.style.display = 'none';

            if (theControllerImage != null) {
                theControllerImage.src = currentDomain + '/webpac_content/global/images/plus_box.jpg';
            }
        }
    }
}

function captureEnter(e,searchMode) {
   var ENTER_KEY = 13;
            var code = "";
      
            if (window.event) // IE
            {
                code = e.keyCode;
            }
            else if (e.which) // Netscape/Firefox/Opera
            {
                code = e.which;
            }

            if (code == ENTER_KEY) {

                if (searchMode != null) {
                    if (searchMode == 'internal') {
                        ajaxInternalSearch();
                    }
                    else {
                        ajaxPublicSearch();
                    }
                }
                else
                    ajaxPublicSearch();
                return false;
            }

    }

    function switchTab(tabID,hideTabID) {

        var theShowTab = document.getElementById(tabID);
        var theHideTab = document.getElementById(hideTabID);
        var theShowTabContent = document.getElementById(tabID + 'Content');
        var theHideTabContent = document.getElementById(hideTabID + 'Content');
        
        if (theShowTab != null) {
            theShowTab.className = 'tab';

        }
        
        if (theHideTab != null) {
                theHideTab.className = 'tab_notselected'
            }
        
        if (theShowTabContent != null) {
                theShowTabContent.style.display = 'block';
            }
            
            if (theHideTabContent != null) {
                theHideTabContent.style.display = 'none';
            }


        }



        function checkEmail(theEmails) {

            var isValid = true;
            var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
            var theAdaptedEmails = theEmails;
            if (theEmails.toString().indexOf(';') != -1) {
                theAdaptedEmails = theEmails.toString().replace(';', ',');
            }

            if (theAdaptedEmails.indexOf(',') != -1) {
                var temp = new Array();
                temp = theAdaptedEmails.split(',');
                if (temp.length > 0) {
                    for (i = 0; i < temp.length; i++) {
                        if (temp[i] != null && temp[i] != '') {
                            if (!filter.test(temp[i])) {
                                return false;
                            }
                        }
                    }
                }

            }
            else {
                if (!filter.test(theEmails)) {
                    return false;
                }
            }






            return isValid;
        }

        function checkQuickSubmitValues() {

            var theForm = document.getElementById('quicksubmitForm');

            var theUserName = document.getElementById('quicksubmit_name');
            var theUserEmail = document.getElementById('quicksubmit_email');
            var theResults = document.getElementById('theResult');

            var userNameOK = false;

            if (theUserName != null && theUserName.value != '')
                userNameOK = true;

            var userEmailOK = false;

            if (theUserEmail != null && theUserEmail.value != '' && checkEmail(theUserEmail.value))
                userEmailOK = true;



            if (theForm != null) {

                if ((userNameOK == true) && (userEmailOK == true))
                    theForm.submit();
                else {

                    if (theResults != null) {

                        theResults.innerHTML = '<span id=\"uploadResultFailed\">';
                        if (userNameOK == false) {
                            theResults.innerHTML += 'Please put your name';
                            theUserName.focus();
                        }
                        if (userEmailOK == false) {
                            theResults.innerHTML += '<br />Please put a valid Email';
                            theUserEmail.focus();
                        }
                        theResults.innerHTML += '</span>'

                    }

                    

                }


            } 
                
            
            
            
            
        }