﻿var openCommentsFlag = 0;

function openComment(item) {

    var item1 = "commentText" + item;

    if (document.getElementById(item1).style.display != "block") {
        document.getElementById(item1).style.display = "block";

    }
    else
        document.getElementById(item1).style.display = "none";
}

function openAllComments(count) {

    if (openCommentsFlag == 0) {
        for (i = 1; i <= count; i++) {

            item1 = "commentText" + i;


            document.getElementById(item1).style.display = "block";


        }
        document.getElementById("openAllComments").innerHTML = "סגירת כל התגובות"
        openCommentsFlag = 1;
    }
    else {
        for (i = 1; i <= count; i++) {
            item1 = "commentText" + i;



            document.getElementById(item1).style.display = "none";

        }
        document.getElementById("openAllComments").innerHTML = "פתיחת כל התגובות"
        openCommentsFlag = 0;

    }
}


function openCenterWindow(url, width, height, isScrollable) {
    if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
        var xMax = window.outerWidth, yMax = window.outerHeight;
    else
        var xMax = 640, yMax = 480;

    var xOffset = (xMax - width) / 2, yOffset = (yMax - height) / 2;

    var name = 'myNewWindow';
    var mywin = window.open(url, name, 'width=' + width + ',height=' + height + ',screenX=' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + isScrollable + ',resizable=1');
    if (mywin) {
        mywin.name = name;
        mywin.focus();
        if (mywin.opener == null) mywin.opener = self;
    } else { // if popup blocker, load in current page
        window.document.location = url;
    }
}