﻿
function setOnloadEvent(func) {

    if (document.all) {
        window.attachEvent('onload', func);
    }
    else {
        window.addEventListener('load', func, false);
    }
}

function onLoadEvent() {
    isBrowserFavorrites();
    //jsPreRender();
}

$(document).ready(function() {

    //left nav title style
    var navTitle = $("table[id$=leftNav] a:not([href])").text();
    $("table[id$=leftNav] a:not([href])").parent("td").parent().parent().parent().parent().html("")
    if (navTitle.length > 0)
        $("table[id$=leftNav]").parent().prepend("<div class='leftNavTitle'><h2 class='colorTitle LineTitle'>" + navTitle + "</h2></div>")
    //    $("td.breadCrumbContent span[id$=siteMapPath] span:lt(2)").remove()

    // add top nav selected style when visting a descendtantsite.
    var breadCrumParentSite = $("td.breadCrumbContent span:gt(2) a:first").text();
    if (breadCrumParentSite.length > 0) {
        $("table.topNav1Item").each(
                    function() {
                        if ($(this).text().indexOf(breadCrumParentSite) > -1) {
                            $(this).addClass('topNav1Selected');
                        }
                    });
    }
    //For ABC Dictionary
    if ($("span.ABCBtnAllContainerClass").length > 0) {

        var p = $("span.ABCBtnAllContainerClass").parent();
        var he = $('<div>').attr("class", "hebLetters");
        var en = $('<div>').attr("class", "engLetters");

        $("[class*=letter]:gt(21)").remove().appendTo(en);
        $("[class*=letter]:lt(22)").remove().appendTo(he);
        $("span.ABCBtnAllContainerClass").remove().appendTo(he);
        //$("input.ABCBtnClass").remove().appendTo(he);

        p.prepend(en);
        p.prepend(he);

    }


    if ($("table[id$=MainMasterTable]").height() <= "600") {
        $("table[id$=MainMasterTable]").css("height", "600px");
    }
    else {
        $("table[id$=MainMasterTable]").css("height", "100%");
    }
    $("td[id$=_invisibleIfEmpty]").each(
                    function() {
                        ($(this).html().trim().length || $(this).removeClass("WebPartZoneSpace"));
                    });

    $("table.zz1_topNav1_0").css("background-color", "inherit");

    $("table.topNav1Item").each(
                    function() {
                        var navItemId = $(this).parent("td").attr("id");
                        var dynamicNavItem = navItemId + "Items";
                        if ($("#" + dynamicNavItem).length > 0) {
                            $(this).parent("td")[0].onmouseover = null;
                            $(this).parent("td").mouseover(function(e) {
                                //                                var right = $(this)[0].scrollWidth;
                                //                                var left = $(this)[0].offsetLeft;
                                //                                var width = $("#" + dynamicNavItem)[0].scrollWidth;
                                //                                //alert($("#" + dynamicNavItem)[0].scrollWidth);
                                //                                //left = right + Number(left) - width;
                                //                                $("#" + dynamicNavItem).css("right", left);
                                $("#" + dynamicNavItem).slideDown("slow");
                                Menu_HoverStatic(document.getElementById(navItemId));
                                //$("#" + dynamicNavItem).css("display", "none");


                            });

                        }
                    });


    //Get All A Tags With Title And Clear The First And Last Quot in The Title
    $("a[title]").each(
              function() {
                  var $ItemA = $(this);
                  $ItemA.attr({
                      title: ClearFirstLastQuotFromString($ItemA.attr("title"), "link")
                  });
              });
    $("img[title]").each(
              function() {
                  var $ItemA = $(this);
                  $ItemA.attr({
                      title: ClearFirstLastQuotFromString($ItemA.attr("title"), "image")
                  });
              });

    $("map area[href^='http']").attr("target", "_blank")
    $("img[alt='מפריד']").attr("alt", "")
    $("img[alt='דלג על קישורי ניווט']").attr("alt", "")

    //Dorit Test
    if ($("#ResultsContainer").length > 0) {
        $("img").each(
            function() {
                var $ItemIMG = $(this);
                if ($ItemIMG.attr("src").indexOf("brown_arrow.gif") > -1) {
                    $ItemIMG.remove();
                }
                else {
                    $ItemIMG.attr({
                        src: CheckAndChangeImgSrc($ItemIMG.attr("src"))
                    });
                }

            });
    }
    //Dorit Test ENd


});

function CheckAndChangeImgSrc(ElementAttrValue) {
    var vOriginalValue = ElementAttrValue.toString().split("/")[ElementAttrValue.toString().split("/").length - 1]
    var vReturnedValue;
    switch (vOriginalValue) {
        case "two_arrows_previous.gif":

            {
                vReturnedValue = "/WebResources/Images/General/2arrow_blue_right.gif";
                break;
            }
        case "arrow_previous.gif":
            {
                vReturnedValue = "/WebResources/Images/General/1arrow_blue_right.gif";
                break;
            }
        case "numbers_seperator.gif":
            {
                vReturnedValue = "/WebResources/Images/General/white_divider.gif";
                break;
            }
        case "arrow_next.gif":
            {
                vReturnedValue = "/WebResources/Images/General/1arrow_blue_left.gif";
                break;
            }
        case "two_arrows_next.gif":
            {
                vReturnedValue = "/WebResources/Images/General/2arrow_blue_left.gif";
                break;
            }
        default:
            {
                vReturnedValue = ElementAttrValue;
                break;
            }
    }
    return vReturnedValue;
}

//Get Value And Clean The Start And End Of String From qout
function ClearFirstLastQuotFromString(valueToClear, obj) {
    var CleanValue;

    if (valueToClear.toString().indexOf("\"") == 0) {
        if (obj == "link") {
            CleanValue = valueToClear.substring(1, valueToClear.length - 1)
        }
        else {
            CleanValue = valueToClear.substring(1, valueToClear.length - 2)
        }
    }
    else {
        CleanValue
    }
    return CleanValue;
}

function isBrowserFavorrites() {
    var IE_NUM = 5;
    var MOZ_NUM = 2;
    if (navigator.userAgent.indexOf('MSIE') > -1) {
        IE_NUM = parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf('MSIE') + 5, navigator.userAgent.indexOf('MSIE') + 6));
    }
    else if (navigator.userAgent.indexOf('Firefox/') > -1) {
        MOZ_NUM = parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Firefox/') + 8, navigator.userAgent.indexOf('Firefox/') + 11));
    }

    if (!readCookie('isBrowserFavorrites') == '1') {
        if (!(MOZ_NUM > 3.4 || IE_NUM > 6)) {
            var text = 'האתר מומלץ לצפייה ברזולוציית מסך של\n';
            text += '1024 X 768\n';
            text += 'ובדפדפן מסוג\n';
            text += 'Internet explorer\n';
            text += 'גירסה 8 ומעלה או\n';
            text += 'Mozilla Firefox\n';
            text += 'גרסה 3.5 ומעלה\n';
            alert(text);
            createCookie('isBrowserFavorrites', '1', 1)
        }
    }
}

function AdddirectionToHtmlTag(lang) {
    if (lang == "heIL") {
        $("html").attr("dir", "rtl")
        $("html").attr("_expr-val-dir", "rtl")
    }
    if (lang == "enUS") {
        $("html").attr("dir", "ltr")
        $("html").attr("_expr-val-dir", "ltr")
    }

}

function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name, "", -1);
}


function FixRadControlSlideDiv(e, s) {
    //alert(e);
    // var combo = document.getElementById(objID);//$find(objID);
    // combo.add_dropDownOpened(onOpen);
    return true;
}


//else
function onRadDropDownOpen(s, e) {

    var curLeft = $(s.get_dropDownElement()).parent().offset().left;
    var buttonWidth = $(s.get_imageDomElement()).width();
    // $(s.get_dropDownElement()).parent().css("left", (curLeft - buttonWidth)+ "px");

    var buttonLeft = $(s.get_imageDomElement()).offset().left;
    $(s.get_dropDownElement()).parent().css("left", buttonLeft - 2 * $(window).scrollLeft() + "px");
};



function checkSelectedEmergencyZone(zoneDDL) {
    var ddSelected = document.getElementById(zoneDDL);
    if (ddSelected.value == "") {
        alert('אנא בחר אזור חירום');
    }
    else {
        var combo = $find(zoneDDL);
        var text = ddSelected.value;
        var item = combo.findItemByText(text);
        if (item != null && item != "") {
            item = item._control._value;
            window.location.href = item.split(',')[0];
        }
    }

}

function ClearControlsValue(ContainerID) {
    var Container = document.getElementById(ContainerID);
    var Inputs = Container.getElementsByTagName("input");
    var TextEreas = Container.getElementsByTagName("textarea");
    var DropDowns = Container.getElementsByTagName("select");
    var spans = Container.getElementsByTagName("span");

    for (i = 0; i < Inputs.length; i++) {
        if (Inputs[i].type == "text") {
            Inputs[i].value = "";
        }
    }

    for (i = 0; i < TextEreas.length; i++) {
        TextEreas[i].value = "";
    }

    for (i = 0; i < DropDowns.length; i++) {
        DropDowns[i].selectedIndex = 0;
    }
    //Make Focus On Other Control
    for (i = 0; i < Inputs.length || i < TextEreas.length || i < DropDowns.length; i++) {
        if (Inputs.length != 0) {
            if (Inputs[i].type == "text") {
                Inputs[i].focus();
                break;
            }
            else {
                if (i != Inputs.length)
                    continue;
            }
        }

        if (TextEreas.length != 0) {
            TextEreas[0].focus();
            break;
        }
        if (DropDowns.length != 0) {
            DropDowns[0].focus();
            break;
        }
    }

    for (i = 0; i < spans.length; i++) {
        if (spans[i].id.indexOf('Validator') > -1) {
            spans[i].style.display = 'none';
        }
    }
}

function ClearControlsValueWithoutFocus(ContainerID) {
    var Container = document.getElementById(ContainerID);
    var Inputs = Container.getElementsByTagName("input");
    var TextEreas = Container.getElementsByTagName("textarea");
    var DropDowns = Container.getElementsByTagName("select");
    var spans = Container.getElementsByTagName("span");

    for (i = 0; i < Inputs.length; i++) {
        if (Inputs[i].type == "text") {
            Inputs[i].value = "";
        }
    }

    for (i = 0; i < TextEreas.length; i++) {
        TextEreas[i].value = "";
    }

    for (i = 0; i < DropDowns.length; i++) {
        DropDowns[i].selectedIndex = 0;
    }

    for (i = 0; i < spans.length; i++) {
        if (spans[i].id.indexOf('Validator') > -1) {
            spans[i].style.display = 'none';
        }
    }
}

function DisplayLayerMessage(show, popupId) {
   
    var popup = document.getElementById(popupId);
    var opacityDiv = document.getElementById("DivopacityMask");

    if (show == "true") {
        var width = $("div [id=" + popupId + "]").width()
        var top = $(document).height() / 2 - ($("div [id=" + popupId + "]").height() / 2);

        opacityDiv.style.opacity = '0.4';
        opacityDiv.style.filter = 'alpha(opacity=70)';
        opacityDiv.style.width = document.body.scrollWidth + "px";
        opacityDiv.style.height = document.body.scrollHeight + "px";
        popup.style.left = (document.body.scrollWidth / 2 - width / 2) + "px";
        popup.style.top = top + "px";
        popup.style.display = 'block';
        popup.focus();
        window.scrollTo(width, top);
    }
    else {
        ClearControlsValue(popupId);
        opacityDiv.style.width = '0px';
        opacityDiv.style.height = '0px';
        popup.style.display = 'none';
        ClearControlsValueWithoutFocus(popupId);
    }

    if (show == "false" && popupId.substring(popupId.length - 6, popupId.length) == "Succes") {

        document.location.href = document.location.href.split('?')[0];

    }


}


function CheckInnerHtml() {
    $("td[id$=_invisibleIfEmpty]");
}
function ShowVideo(Title, PublishDate, Film, Summary, CurrentLinkID) {
    document.getElementById("VideoPlay").innerHTML = "<iframe width='420' title='' height='370' src='http://switch5.castup.net/Customers/Castup/v_gray_400x300/Design.asp?as=0&clipurl=" + Film + "&ak=null' frameBorder='0' scrolling='no'>";
    document.getElementById("VideoTitle").innerHTML = Title;
    document.getElementById("VideoDate").innerHTML = PublishDate;
    document.getElementById("VideoSummary").innerHTML = Summary;

    $("div.VideoCollector a[id$=FilmLink]").removeClass("BoldFont Color3");
    $("div.VideoCollector a[id$=FilmLink]").addClass("NormalFont Color2");
    $("div.VideoCollector a[id$=" + CurrentLinkID + "_FilmLink]").removeClass("NormalFont Color2");
    $("div.VideoCollector a[id$=" + CurrentLinkID + "_FilmLink]").addClass("BoldFont Color3");

}

function CommonQuestionsPrintAnswer(controlid, printText, closeText) {
    try {
        var disp_setting = "toolbar=yes,directories=yes,menubar=yes,";
        disp_setting += "width=800, height=500,scrollbars=yes,left=100, top=25,resizable=no,location=yes";
        var SiteName = $("head link[href$=General.css]").attr("href").split('/')[3];
        var Breadcrumb = $("#ctl00_PlaceHolderTitleBreadcrumb_siteMapPath").get(0).innerHTML;
        var objwidth = $("#PageContentMain").width();

        var _index = controlid.split('_')[1];
        var _QuestionsTDLink = 'QuestionsTDLink_' + _index;
        var _questiontitle = document.getElementById(_QuestionsTDLink).firstChild.nodeValue;
        _QuestionsTDLink = 'Answer_' + _index;
        closeText = closeText.split('_')[1];
        var _questionbody = document.getElementById(_QuestionsTDLink).childNodes[0].innerText;

        if ((_questionbody != null && _questiontitle != null) && (_questionbody.length > 0 && _questiontitle.length > 0)) {


            var docprint = window.open($("Form").attr("action"), "", disp_setting);
            docprint.document.open();
            docprint.document.write('<html>');
            docprint.document.write('<head  runat="server">');
            docprint.document.write('<meta http-equiv="X-UA-Compatible" content="IE=8"/>');
            docprint.document.write('<style type="text/css">.cbq-layout-main{width:100%;}body{font-family:Arial;text-align:right;}</style>');
            docprint.document.write('<link type="text/css" rel="stylesheet" href="' + $("head link[href$=Universal.css]").attr("href") + '"/>');
            docprint.document.write('<link type="text/css" rel="stylesheet" href="' + $("head link[href$=Colors.css]").attr("href") + '"/>');
            docprint.document.write('<link type="text/css" rel="stylesheet" href="' + $("head link[href$=General.css]").attr("href") + '"/>');
            docprint.document.write('</head>');
            docprint.document.write('<body class="FriendlyPrintBody ' + $("form").attr("class") + '" width=' + objwidth + '>');
            docprint.document.write('<img src="/WebResources/Images/General/Master/' + 'header_right.gif" border="0"/ alt="" title="">');
            docprint.document.write('<br><br><br><br><br>');
            docprint.document.write(_questiontitle);
            docprint.document.write('<br><br><br>');
            docprint.document.write(_questionbody);
            docprint.document.write('<br><br><br>');
            docprint.document.write('<div class="ButtonsLinePrint">');
            docprint.document.write('<div style="float:right">');
            docprint.document.write('<a href="javascript://" Name="WindowClicks" class="SmallFontSize BoldFont Color5" onclick="self.print();" onkeypress="javascript:if (event.keyCode == 13)self.print();"><img alt=' + printText + ' title=' + printText + ' src="/WebResources/Images/HeIL/Green' + '/icon_printer.gif" border="0"/>&nbsp;' + printText + '</a>');
            docprint.document.write('</div>');
            docprint.document.write('<div style="float:right">');
            docprint.document.write('&nbsp;&nbsp;&nbsp;&nbsp;');
            docprint.document.write('</div>');
            docprint.document.write('<div style="float:right;margin-top:10px;">');
            docprint.document.write('<a href="javascript://" Name="WindowClicks" class="SmallFontSize BoldFont Color5" onclick="window.close();" onkeypress="javascript:if (event.keyCode == 13)window.close();"><img alt=' + closeText + ' title=' + closeText + ' src="/WebResources/Images/HeIL/Green' + '/icon_x.gif" border="0"/ >&nbsp;' + closeText + '</a>');
            docprint.document.write('</div>');
            docprint.document.write('</div>');
            docprint.document.write('</body></html>');
            docprint.document.close();
            docprint.focus();
        }
        else {
            window.print();
        }
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}

function FriendlyPrint_onclick(printText, closeText) {
    
    try {
        var objwidth = $("#PageContentMain").width();        
        var ColorCssFile = $("head link[href$=Site.css]").attr("href");
        ColorCssFile = ColorCssFile.split('/')[ColorCssFile.split('/').length - 1];
        ColorCssFile = ColorCssFile.replace(".css", "");

        var disp_setting = "toolbar=yes,directories=yes,menubar=yes,";
        disp_setting += "width="+(objwidth + 100)+", height=500,scrollbars=yes,left=100, top=25,resizable=no,location=yes";
        window.open("/WebResources/Print/FriendlyPrint.aspx?ColorCssFile=" + ColorCssFile, "FriendlyPrint", disp_setting, false);
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}
function GetContentToPrint() {
    var PHMC = opener.document.getElementById("PageContentMain");
    var ContentToPrint = document.getElementById("ContentToPrint");
    var toolBar = opener.document.getElementById("customToolBar");
    var content_value = PHMC.innerHTML.replace(toolBar.innerHTML, "");   
    var breadCrumbToPrint = document.getElementById("breadCrumbToPrint");
    var opener_breadCrumb = opener.document.getElementById("ctl00_PlaceHolderTitleBreadcrumb_siteMapPath");
    var PrintFromElement = document.getElementsByTagName("form");
    var objwidth = opener.document.getElementById("PageContentMain").getAttribute("width");   
    
    objwidth = objwidth.replace("px","");
    
    ContentToPrint.innerHTML = content_value;
    breadCrumbToPrint.innerHTML = opener_breadCrumb.innerHTML;
    PrintFromElement[0].setAttribute("style", "width:" + objwidth + "px");
    $("div[class=mainPagerContainer]").remove();
    $("div[class*=PrintAnswer]").remove();
    $("div[class=ABCDMainSeperator]").remove();
    $("div[class*=GrayDivider]").remove();
    
} 

function MunicipalSitesLink(DllId) {

    var ddSelected = document.getElementById(DllId);
    var ErrorDiv = document.getElementById("MunicipalSitesLinkError");

    if (ddSelected.value != "") {
        ErrorDiv.setAttribute("class", "DisplayNone");

        var combo = $find(DllId);
        var text = ddSelected.value;
        var item = combo.findItemByText(text);
        if (item != null && item != "") {

            item = item._control._value;
            item = item.split('"')[1];

            if (item != undefined) {
                window.open(item);
            }
            else {
                ErrorDiv.setAttribute("class", "MunicipalSitesLinkError");
                combo.clearSelection();
                combo.set_emptyMessage(combo._emptyMessage);

            }

        }
        else {
            ErrorDiv.setAttribute("class", "MunicipalSitesLinkError");
        }
    }
    else {
        ErrorDiv.setAttribute("class", "MunicipalSitesLinkError");
    }
}

//Open Close Common Questions 
function CommonQuestionsOpenClose(id, OpenCloseAlt) {
    //Check If Buttons Clos\OpenAll Click
    if (id == 'open' || id == 'close') {
        var vName = 'PlusMinus_';
        for (var iCounter = 1; document.getElementById(vName + iCounter) != null; iCounter++) {
            CommonQuestionsOpenCloseSingelItem(vName + iCounter, id, OpenCloseAlt);
        }
    }
    else {

        CommonQuestionsOpenCloseSingelItem(id, "", OpenCloseAlt);
    }
}

//OPen Close Common Questions Singel Item
function CommonQuestionsOpenCloseSingelItem(id, OpenCloseAll, OpenCloseAlt) {
    var ItemQuestionNumber = id.split('_')[1];
    var ItemMainQuestions = "Questions_" + ItemQuestionNumber;
    var ItemAnswer = "Answer_" + ItemQuestionNumber;
    var ItemQuestion = "QuestionsTD_" + ItemQuestionNumber;
    var ItemPlusMinus = "PlusMinus_" + ItemQuestionNumber;
    var Item = document.getElementById(ItemPlusMinus);
    var CloseOpenIDForJQ = ItemPlusMinus
    var ItemIndex = id.split('_')[1];

    //Check If OPen Or Close All Question
    if (OpenCloseAll == "") {
        //Check If Need To Open Or Close Question
        if (Item.className == "Plus") {
            ChangeItemClassNames(ItemPlusMinus, "Minus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[1]);
            ChangeItemClassNames(ItemQuestion, "SmallFontSize BoldFont QuestionsTD_on");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv BackGroundColor3");
            ChangeItemClassNames(ItemAnswer, "");
        }
        else {
            ChangeItemClassNames(ItemPlusMinus, "Plus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[0]);
            ChangeItemClassNames(ItemQuestion, "SmallFontSize QuestionsTD_off");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv");
            ChangeItemClassNames(ItemAnswer, "DisplayNone");
        }
    }
    else {
        if (OpenCloseAll == 'open') {
            ChangeItemClassNames(ItemPlusMinus, "Minus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[1]);
            ChangeItemClassNames(ItemQuestion, "QuestionsTD_on SmallFontSize BoldFont");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv BackGroundColor3");
            ChangeItemClassNames(ItemAnswer, "");
        }
        else {
            ChangeItemClassNames(ItemPlusMinus, "Plus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[0]);
            ChangeItemClassNames(ItemQuestion, "SmallFontSize QuestionsTD_off");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv");
            ChangeItemClassNames(ItemAnswer, "DisplayNone");
        }
    }
}

//Change The Item Class Names
function ChangeItemClassNames(ItemId, ClassNames) {
    var Item = document.getElementById(ItemId);
    Item.className = ClassNames;
}

function GetExtendUrl(url, title, itemID) {
    var link = [];
    link.push("<a alt='להרחבה' title='להרחבה' href='");
    link.push(url + "?CL=" + escape(title.substring(0, 1)) + "&PN=1#" + itemID);
    link.push("'>");
    link.push("להרחבה");
    link.push("</a>");
    document.write(link.join(""));
}



/////////////////////////////////////////

//OPen Close Common Questions Singel Item
function ABCDictionaryOpenCloseSingelItem(id, OpenCloseAll, OpenCloseAlt) {
    var ItemQuestionNumber = id.split('_')[1];
    var ItemMainQuestions = "ABCDictionaryTDLink_" + ItemQuestionNumber;
    var ItemAnswer = "ABCDAnswer_" + ItemQuestionNumber;
    var ItemQuestion = "ABCDictionaryTD_" + ItemQuestionNumber;
    var ItemPlusMinus = "DPlusMinus_" + ItemQuestionNumber;
    var Item = document.getElementById(ItemPlusMinus);
    var CloseOpenIDForJQ = ItemPlusMinus
    var ItemIndex = id.split('_')[1];
    var r = document.getElementById(ItemAnswer);
    //Check If OPen Or Close All Question
    if (OpenCloseAll == "") {
        //Check If Need To Open Or Close Question
        if (Item.className == "Plus") {
            ChangeItemClassNames(ItemPlusMinus, "Minus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[1]);
            ChangeItemClassNames(ItemQuestion, "SmallFontSize BoldFont QuestionsTD_on");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv");
            ChangeItemClassNames(ItemAnswer, "");
        }
        else {
            ChangeItemClassNames(ItemPlusMinus, "Plus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[0]);
            ChangeItemClassNames(ItemQuestion, "SmallFontSize QuestionsTD_off");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv");
            ChangeItemClassNames(ItemAnswer, "DisplayNone");
        }
    }
    else {
        if (OpenCloseAll == 'open') {
            ChangeItemClassNames(ItemPlusMinus, "Minus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[1]);
            ChangeItemClassNames(ItemQuestion, "QuestionsTD_on SmallFontSize BoldFont");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv");
            ChangeItemClassNames(ItemAnswer, "");
        }
        else {
            ChangeItemClassNames(ItemPlusMinus, "Plus");
            document.getElementById(CloseOpenIDForJQ).setAttribute("title", OpenCloseAlt.toString().split('_')[0]);
            ChangeItemClassNames(ItemQuestion, "SmallFontSize QuestionsTD_off");
            ChangeItemClassNames(ItemMainQuestions, "MainCommonQuestionsDiv");
            ChangeItemClassNames(ItemAnswer, "DisplayNone");
        }
    }
}



//Open Close Common Questions
function ABCDictionaryOpenClose(id, OpenCloseAlt) {
    //Check If Buttons Clos\OpenAll Click
    if (id == 'open' || id == 'close') {
        var vName = 'DPlusMinus_';
        for (var iCounter = 1; document.getElementById(vName + iCounter) != null; iCounter++) {
            ABCDictionaryOpenCloseSingelItem(vName + iCounter, id, OpenCloseAlt);
        }
    }
    else {

        ABCDictionaryOpenCloseSingelItem(id, "", OpenCloseAlt);
    }
}


//print d
function ABCDictionaryPrintAnswer(controlid, printText, closeText) {
    try {
        var disp_setting = "toolbar=yes,directories=yes,menubar=yes,";
        disp_setting += "width=800, height=500,scrollbars=yes,left=100, top=25,resizable=no,location=yes";
        var SiteName = $("head link[href$=General.css]").attr("href").split('/')[3];
        var Breadcrumb = $("#ctl00_PlaceHolderTitleBreadcrumb_siteMapPath").get(0).innerHTML;
        var objwidth = $("#PageContentMain").width();

        var _index = controlid.split('_')[1];
        var _QuestionsTDLink = 'ABCDictionaryTDLink_' + _index;
        var _questiontitle = document.getElementById(_QuestionsTDLink).firstChild.nodeValue;
        _QuestionsTDLink = 'ABCDAnswer_' + _index;
        closeText = closeText.split('_')[1];
        var _questionbody = document.getElementById(_QuestionsTDLink).childNodes[0].innerText;

        if ((_questionbody != null && _questiontitle != null) && (_questionbody.length > 0 && _questiontitle.length > 0)) {


            var docprint = window.open($("Form").attr("action"), "", disp_setting);
            docprint.document.open();
            docprint.document.write('<html>');
            docprint.document.write('<head  runat="server">');
            docprint.document.write('<meta http-equiv="X-UA-Compatible" content="IE=8"/>');
            docprint.document.write('<style type="text/css">.cbq-layout-main{width:100%;}body{font-family:Arial;text-align:right;}</style>');
            docprint.document.write('<link type="text/css" rel="stylesheet" href="' + $("head link[href$=Universal.css]").attr("href") + '"/>');
            docprint.document.write('<link type="text/css" rel="stylesheet" href="' + $("head link[href$=Colors.css]").attr("href") + '"/>');
            docprint.document.write('<link type="text/css" rel="stylesheet" href="' + $("head link[href$=General.css]").attr("href") + '"/>');
            //docprint.document.write('<script src="/WebResources/Scripts/General.js" type="text/javascript"></script>');
            docprint.document.write('</head>');
            docprint.document.write('<body class="FriendlyPrintBody ' + $("form").attr("class") + '" width=' + objwidth + '>');
            //docprint.document.write('<img src="/WebResources/Images/General/Master/' + 'header_right.gif" border="0"/ alt=' + SiteName + ' title=' + SiteName + '>');

            //docprint.document.write("<div style=\"width:100%;\" class=\"PrintPixel\">");
            docprint.document.write('<img src="/WebResources/Images/HeIL/PrintVer/' + 'header_print_ver.gif" border="0"/ alt="" title="">');
            //docprint.document.write('<img src="/WebResources/Images/General/Master/' + 'header_pixel_up.gif" border="0"/ alt="" title="" style="background-repeat:repeat-x;">');
            //docprint.document.write("</div>");
            
            docprint.document.write('<br><br><br><br><br>');

            docprint.document.write(_questiontitle);
            docprint.document.write('<br><br><br>');
            docprint.document.write(_questionbody);
            docprint.document.write('<br><br><br>');
            docprint.document.write('<div class="ButtonsLinePrint">');
            docprint.document.write('<div style="float:right">');
            docprint.document.write('<a href="javascript://" Name="WindowClicks" class="SmallFontSize BoldFont Color5" onclick="self.print();" onkeypress="javascript:if (event.keyCode == 13)self.print();"><img alt=' + printText + ' title=' + printText + ' src="/WebResources/Images/HeIL/Green' + '/icon_printer.gif" border="0"/>&nbsp;' + printText + '</a>');
            docprint.document.write('</div>');
            docprint.document.write('<div style="float:right">');
            docprint.document.write('&nbsp;&nbsp;&nbsp;&nbsp;');
            docprint.document.write('</div>');
            docprint.document.write('<div style="float:right; margin-top:10px;">');
            docprint.document.write('<a href="javascript://" Name="WindowClicks" class="SmallFontSize BoldFont Color5" onclick="window.close();" onkeypress="javascript:if (event.keyCode == 13)window.close();"><img alt=' + closeText + ' title=' + closeText + ' src="/WebResources/Images/HeIL/Green' + '/icon_x.gif" border="0"/>&nbsp;' + closeText + '</a>');
            docprint.document.write('</div>');
            docprint.document.write('</div>');
            docprint.document.write('</body></html>');
            docprint.document.close();
            docprint.focus();
        }
        else {
            window.print();
        }
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}

