﻿function SendDepartmentSearchForm(dropDownListCitiesID, dropDownListSubSubjectID)
{
    var dropDownListCities = document.getElementById(dropDownListCitiesID);
    var dropDownListSubSubject = document.getElementById(dropDownListSubSubjectID);
    if(dropDownListCities != null && dropDownListSubSubject != null)
    { 
        var cityID = "";
        if(dropDownListCities.selectedIndex > 0)
        {
            cityID = "CityID=" + dropDownListCities[dropDownListCities.selectedIndex].value + "&";
        }
        
        var subSubjectID = "";
        if(dropDownListSubSubject.selectedIndex > 0)
        {
            subSubjectID = "SubSubjectID=" + dropDownListSubSubject[dropDownListSubSubject.selectedIndex].value;
        }
        
        window.location = "/UsefullInfo/Offices/Pages/DepartmentsSearchResults.aspx?" + cityID + subSubjectID;
    }
}

function closePopUpSearchDepartmentDiv(departmentDivID)
{
    var popUpDiv = document.getElementById(departmentDivID);
        if (popUpDiv != null) {popUpDiv.style.display = "none";}
}

function popSearchDepartmentWindow(departmentDivID) {        
    var allDivs = document.getElementsByTagName("div");

    for(var i=0;i<allDivs.length;i++)
    {
        if(allDivs[i].id.indexOf("identificationServiceDiv") != -1)
        {
            allDivs[i].style.display = "none";
            break;
        }
    }

    var popUpDiv = document.getElementById(departmentDivID);

    if (popUpDiv != null) {
       
       if (popUpDiv.style.display == "none") {
            popUpDiv.style.display = "block";
            popUpDiv.focus();
        }
        else {
            popUpDiv.style.display == "none";
        }
       
           var arrowTop = 0;
            var arrowLeft = 0;

            var oElement = document.getElementById('ItourLishkaSpan');

            while (oElement != null) {
                arrowTop += oElement.offsetTop;
                arrowLeft += oElement.offsetLeft;
                oElement = oElement.offsetParent;
            }
           
            popUpDiv.style.top = (arrowTop + 20).toString() + "px";
            popUpDiv.style.left = arrowLeft.toString() + "px";
    }

    window.event.cancelBubble = true;        
}

function SendServicesSearch(subjectsDDLID,DropDownListSubSubjectID)
{
    var subjectsDDL = document.getElementById(subjectsDDLID);
    var dropDownListSubSubject = document.getElementById(DropDownListSubSubjectID);
    if(subjectsDDL != null && dropDownListSubSubject != null)
    {
        var subjectID = "";
        if(subjectsDDL.selectedIndex > 0)
        {
            subjectID = "SubjectID=" + subjectsDDL[subjectsDDL.selectedIndex].value + "&";
        }
        
        var subSubjectID = "";
        if(dropDownListSubSubject.selectedIndex > 0)
        {
            subSubjectID = "SubSubjectID=" + dropDownListSubSubject[dropDownListSubSubject.selectedIndex].value;
        }
        
        window.location = "/Subject/Pages/SearchResultsServices.aspx?" + subjectID + subSubjectID;
    }
}
 function closePopUpDiv(identificationServiceDivID) {       
    var popUpDiv = document.getElementById(identificationServiceDivID);
    if (popUpDiv != null) {
        popUpDiv.style.display = "none";
    }
}

function popIdentificationServiceWindow(identificationServiceDivID) {        
    var allDivs = document.getElementsByTagName("div");
    
    for(var i=0;i<allDivs.length;i++)
    {
        if(allDivs[i].id.indexOf("DepartmentDiv") != -1)
        {
            allDivs[i].style.display = "none";
            break;
        }
    }
    
    var popUpDiv = document.getElementById(identificationServiceDivID);
    if (popUpDiv != null) {
        if (popUpDiv.style.display == "none") {
            popUpDiv.style.display = "block";
            popUpDiv.focus();
        }
        else {
            popUpDiv.style.display == "none";
        }
        
        var arrowTop = 0;
            var arrowLeft = 0;

            var oElement = document.getElementById('ItourSheroutSpan');

            while (oElement != null) {
                arrowTop += oElement.offsetTop;
                arrowLeft += oElement.offsetLeft;
                oElement = oElement.offsetParent;
            }
            
            popUpDiv.style.top = (arrowTop + 20).toString() + "px";
            popUpDiv.style.left = arrowLeft.toString() + "px";
    }
    window.event.cancelBubble = true;        
}

 function openPopUp(RegUrl) {       
    var url = RegUrl;                
    var windowFeatures = "menubar=no,scrollbars=1,location=no,favorites=no,resizable=no,status=no,toolbar=no,directories=no";
    var width = 450;
    var height = 440;

    // Center the popup window to middle of screen.
    var winLeft = (screen.width - width) / 2;
    var winTop = (screen.height - (height + 110)) / 2;
    var winName = "";

    window.open(url, winName, "width=" + width + ",height=" + height + ",left=" + winLeft + ",top=" + winTop + "," + windowFeatures);
}
    
function openUrl(RegUrl) {
    window.location = RegUrl;
}
function OpenCloseQuestions(sender) {
        if(navigator.appName == 'Microsoft Internet Explorer')
        {

           if (sender.parentNode.lastChild.style.display == "inline") {
               sender.parentNode.lastChild.style.display = "none";
               sender.className = "QuestionsTitleAClose";
           }
           else {
               sender.parentNode.lastChild.style.display = "inline";
               sender.className = "QuestionsTitleAOpen";
           }
        }
        else{

           if (sender.parentNode.lastElementChild.style.display == "inline") {
               sender.parentNode.lastElementChild.style.display = "none";
               sender.className = "QuestionsTitleAClose";
           }
           else {
               sender.parentNode.lastElementChild.style.display = "inline";
               sender.className = "QuestionsTitleAOpen";
           }
         }
    }
