		function dynamicComments(id,type,send,page,ow) {
            showLoading(id);
            dynamicDivId = 'dynamicComments' + id;
            superid = id;
            hiddenParent = '';
            var varname = 'req' + id;
            if (window.XMLHttpRequest) {
                 window[varname] = new XMLHttpRequest();
            } else if (window.ActiveXObject) {
                window[varname] = new ActiveXObject("Microsoft.XMLHTTP");
            }
            if (window[varname] != undefined) {
                window[varname].onreadystatechange = function() {done(id);};
                if(send) {
                    hiddenParent = document.getElementById('parentId' + id).value;
                    window[varname].open("GET", "/showComments.php?id=" + escape(id) + "&type=" + escape(type) +"&body=" + escape(encodeURI(document.getElementById('commentFormTextarea' + id).value))  +"&parentId=" + escape(encodeURI(document.getElementById('parentId' + id).value))+"&comments=add" + id + "&pageCom=" + page + "&ow=" + ow, true);
                }
                else
                    window[varname].open("GET", "/showComments.php?id=" + escape(id) + "&type=" + escape(type) + "&pageCom=" + page + "&ow=" + ow, true);
                window[varname].send("");
            }
		}
        function done(id) {
            var varname = 'req' + id;
            if (window[varname].readyState == 4) { // only if window[varname] is "loaded"
                if (window[varname].status == 200) { // only if "OK"
                    document.getElementById('dynamicComments' + id).innerHTML = window[varname].responseText;
                    document.getElementById('showLoadingCom' + id).style.display = 'none'; 
                } else {
                    document.getElementById(target).innerHTML="Error:\n"+ window[varname].status + "\n" +window[varname].statusText;
                }
                window[varname]='';
//                alert(window[varname]);
            }
        } 
        function showLoading(id) {
           if(document.getElementById('showLoadingCom' + id)) 
    		   document.getElementById('showLoadingCom' + id).style.display = 'block';
        }
        function answerComment(id,id2) {
		   document.getElementById('parentId' + id2).value = id;
           document.getElementById('commentFormTextarea' + id2).focus();
		   document.getElementById('parentInfo' + id2).innerHTML = '<table cellspacing=0 cellpadding=0><tr><td class="warinfLeft" style="width:20px;"><a href="javascript:delAnswerComments(' + id2 +');"><img style="margin-left:10px;padding-right:15px;" src="/templates/images/cross.png" border="0"></a></td> <td><b>Odpowiadasz na komentarz:</b> <br>"<i>' + document.getElementById('text' + id).innerHTML + '</i>" </td> </tr></table><!-- warinf -->';
//		   document.getElementById('commentFormTextarea').value = document.getElementById('text' + id).innerHTML;
            
        }
        function changeOpinionNote(type) {
            divToChange = dynamicDivId + type;
            value = document.getElementById(divToChange).innerHTML;
            value = parseInt(value);
            newValue = value + 1;
            document.getElementById(divToChange).innerHTML = newValue;
        }    
    function delAnswerComments(id) {
        document.getElementById('parentId' + id).value = '';
        document.getElementById('parentInfo' + id).innerHTML = '';
    }
    function showHideCom(id){
        if(document.getElementById(id).style.display=="none"){
            document.getElementById(id).style.display="block";
        }else{
            document.getElementById(id).style.display="none";
        }
    }
    function showCom(id) {
        if(document.getElementById(id).style.display=="none")
            document.getElementById(id).style.display="block";

    }    
    function dcom(id,t) {
        var xhReq;
        if (window.XMLHttpRequest) {
            xhReq = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            xhReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xhReq.open("GET", "/dcom.php?id=" + escape(id) + "&t=" + escape(t));
        xhReq.send(null);
        
        document.getElementById('comd' + id).innerHTML = '<div class="warinf wi1"><div class="text">Komentarz został usunięty!</div></div>';
        document.getElementById('text' + id).innerHTML = '<i>Komentarz usunięty.</i>';
        document.getElementById('comdl' + id).style.display="none";
    }
