CreateComments={
    maxWidthUnit : 400,
    objJson : new Array(),//los comentarios
    arrAtributes:new Array(),//atributos de los comentarios
    divComments : '',
    allComments : '',
    divParentClone : '',
    divChildClone : '',
    contentAllComments : '',
    numTotal:0,//cantidad de comentarios que tiene el json
    numJsonArrayIniPos:0,//posision desde la que se esta leyendo el json
    numJsonArrayEndPos:0,//posision hasta la que se lee el json
    intRequestLength:0,//sirve para saber si hay paginacion
    numPages:1,
    numActualPage:1,
    numAdded:0,
    blnIsMember:true,
    numError:0,
    numPageId:0,
    blnIsModerator:0,
    init:function (){
        this.divComments = document.getElementById("commentsArea");
        if(this.divComments){
            this.objJson=eval(this.objJson);
            this.arrAtributes=eval(this.arrAtributes);
            if(this.arrAtributes.blnIsMember || this.arrAtributes.blnIsMember==false){
                this.blnIsMember=this.arrAtributes.blnIsMember;
            }

            if (this.arrAtributes.numPageId){
                this.numPageId=this.arrAtributes.numPageId;
            }
            if (this.arrAtributes.blnIsModerator){
                this.blnIsModerator=this.arrAtributes.blnIsModerator;
            }

            this.intOwner=this.arrAtributes.Ownerid;
            this.ItemName=this.arrAtributes.ItemName;
            this.CreateCommentsBox();

            this.divComments.style.display='block';

            this.intRequestLength=this.objJson.length;
            this.contentAllComments=document.getElementById('contentAllComments');
            this.allComments=document.getElementById("allComments");

            var childcomment=document.getElementById('childcomment');
            this.divChildClone=childcomment.cloneNode(true);

            //comment.removeChild(childcomment);
            var childComment=document.getElementById('childComments');
            childComment.removeChild(childcomment);

            var comment=document.getElementById('comment');
            this.divParentClone=comment.cloneNode(true);

            var topPrevPag=document.getElementById('topPrevPag');
            var topNextPag=document.getElementById('topNextPag');
            this.CreatePaginationButtons(topPrevPag, topNextPag);

            var bottomPrevPag=document.getElementById('bottomPrevPag');
            var bottomNextPag=document.getElementById('bottomNextPag');
            this.CreatePaginationButtons(bottomPrevPag, bottomNextPag);

            this.numTotal=this.objJson.length;
            if(this.numTotal==0){
                document.getElementById('topPagination').style.display='none';
                document.getElementById('bottomPagination').style.display='none';
            }

            if(this.numTotal>this.arrAtributes.numParentComments){
                this.showHideNextButton('block');
            }
            else{
                this.showHideNextButton('none');
            }

            this.showHidePreviousButton('none');

            this.numJsonArrayIniPos=0;
            this.numJsonArrayEndPos=this.arrAtributes.numParentComments;

            this.ShowComments(this.numJsonArrayIniPos, this.numJsonArrayEndPos);
        }
    },

    CreatePaginationButtons:function (aPrevious, aNext){
        aPrevious.onclick=function PreviuosComments(){
            if(CreateComments.numError!=0){
                CreateComments.hideError(CreateComments.numError);
            }
            CreateComments.showHideNextButton('none');
            CreateComments.showHidePreviousButton('none');
            CreateComments.RemoveComments('allComments');
            CreateComments.ShowLoading();

            _commentPrevious = function() {
                if(document.getElementById('allComments')){
                    CreateComments.RemoveComments('allComments');
                }
                --CreateComments.numActualPage;
                CreateComments.numJsonArrayIniPos-=CreateComments.arrAtributes.numParentComments;
                CreateComments.numJsonArrayEndPos-=CreateComments.arrAtributes.numParentComments;

                CreateComments.allComments = document.createElement("div");
                CreateComments.allComments.id='allComments';
                CreateComments.contentAllComments.appendChild(CreateComments.allComments);

                CreateComments.ShowComments(CreateComments.numJsonArrayIniPos,CreateComments.numJsonArrayEndPos);

                if(CreateComments.numJsonArrayIniPos==0){
                    CreateComments.showHidePreviousButton('none');
                }
                else{
                    CreateComments.showHidePreviousButton('block');
                }

                if(aNext.style.display=='none'){
                    CreateComments.showHideNextButton('block');
                }
            }
            setTimeout("_commentPrevious()", 500);
            var rand = Math.random()*100;
            rand = Math.round(rand);
            CreateComments.track(CreateComments.arrAtributes.intCommentType,rand,CreateComments.arrAtributes.ItemId);
        };

        aNext.onclick=function NextComments(){
            if(CreateComments.numError!=0){
                CreateComments.hideError(CreateComments.numError);
            }
            CreateComments.showHidePreviousButton('none');
            CreateComments.showHideNextButton('none');
            CreateComments.RemoveComments('allComments');
            CreateComments.ShowLoading();

            _commentNext = function() {
                if(CreateComments.intRequestLength>CreateComments.arrAtributes.numParentComments && CreateComments.numActualPage==CreateComments.numPages){
                    CreateComments.CreateNextPage();
                    if(aPrevious.style.display=='none' && CreateComments.intRequestLength!=0){
                        CreateComments.showHidePreviousButton('block');
                    }
                }
                else{//se agrega a la pagina el div que esta en el array
                    if(document.getElementById('allComments')){
                        CreateComments.RemoveComments('allComments');
                    }
                    ++CreateComments.numActualPage;
                    CreateComments.numJsonArrayIniPos+=CreateComments.arrAtributes.numParentComments;
                    CreateComments.numJsonArrayEndPos+=CreateComments.arrAtributes.numParentComments;

                    CreateComments.allComments = document.createElement("div");
                    CreateComments.allComments.id='allComments';
                    CreateComments.contentAllComments.appendChild(CreateComments.allComments);

                    CreateComments.ShowComments(CreateComments.numJsonArrayIniPos,CreateComments.numJsonArrayEndPos);

                    if(CreateComments.intRequestLength<(CreateComments.arrAtributes.numParentComments+1) &&
                    CreateComments.numActualPage==CreateComments.numPages){
                        CreateComments.showHideNextButton('none');
                    }
                    else{
                        CreateComments.showHideNextButton('block');
                    }
                    CreateComments.showHidePreviousButton('block');
                }
            }
            setTimeout("_commentNext()", 500);
            var rand = Math.random()*100;
            rand = Math.round(rand);
            CreateComments.track(CreateComments.arrAtributes.intCommentType,rand,CreateComments.arrAtributes.ItemId);
        };
    },

    ShowLoading : function() {
        var oDivLoading = document.createElement("DIV");
        oDivLoading.className = "divloading";

        CreateComments.allComments = document.createElement("div");
        CreateComments.allComments.id='allComments';
        CreateComments.contentAllComments.appendChild(CreateComments.allComments);
        document.getElementById('allComments').appendChild(oDivLoading);
    },

    CreateNextPage:function(){
        this.showHideNextButton('none');
        if(document.getElementById('allComments')){
            this.RemoveComments('allComments');
        }
        //se piden los siguientes 5 comentarios

        this.numJsonArrayIniPos+=this.arrAtributes.numParentComments;
        this.numJsonArrayEndPos+=this.arrAtributes.numParentComments;

        this.showNext(this.numJsonArrayIniPos,this.arrAtributes.numParentComments);

        if(this.intRequestLength==0){
            this.numJsonArrayIniPos-=this.arrAtributes.numParentComments;
            this.numJsonArrayEndPos-=this.arrAtributes.numParentComments;
        }
        else{
            ++this.numActualPage;
        }

        this.allComments = document.createElement("div");
        this.allComments.id='allComments';
        this.contentAllComments.appendChild(this.allComments);

        this.numTotal=this.objJson.length;

        this.ShowComments(this.numJsonArrayIniPos, this.numJsonArrayEndPos);
        if(this.intRequestLength<=this.arrAtributes.numParentComments){
            this.showHideNextButton('none');
        }
        else{
            this.showHideNextButton('block');
        }
    },

    showNext:function(iniPos,endPos){
        if(this.numAdded>0){
            iniPos+=this.numAdded;
            endPos-=this.numAdded;
            this.numAdded=0;
        }
        var strParams  = "offset=" + iniPos +
        "&limit=" + endPos +
        "&order=" + this.arrAtributes.strCommentsOrder +
        "&type=" + this.arrAtributes.intCommentType +
        "&owner=" + 0 +
        "&item=" + this.arrAtributes.ItemId;
        var oRequest = this._getHttpRequest();
        with(oRequest){
            open("POST","/comments/actions/shownextcomment.php",false);
            setRequestHeader("Content-type","application/x-www-form-urlencoded");
            setRequestHeader("Content-length",strParams.length);
            send(strParams);
        }
        var result = eval(oRequest.responseText);
        //si el request anterior tenia 6 comentarios, se borra el ultimo
        if(this.intRequestLength>this.arrAtributes.numParentComments){
            this.objJson.pop();
        }
        if(result){
            if(result.length>endPos){
                this.intRequestLength=this.arrAtributes.numParentComments+1;
            }
            else {
                this.intRequestLength=result.length;
                if(result.length>this.arrAtributes.numParentComments){
                    this.intRequestLength=this.arrAtributes.numParentComments;
                }
            }

            //se introducen los valores al json
            for(i=0;i<result.length;++i){
                this.objJson.push(result[i]);
            }
            ++this.numPages;
        }
        else{
            this.intRequestLength=0;
        }
        this.numTotal=this.objJson.length;
    },

    RemoveComments:function  (strIdElement){
        var oElement = document.getElementById(strIdElement);
        this.contentAllComments.removeChild(oElement);
    },
    CreateCommentsBox:function(){
        if(this.blnIsMember){
            //se crea el textarea y el boton para agregar comentarios
            var taCommentText=document.getElementById('commentText');
            if(taCommentText){
                var aCommentSubmit=document.getElementById('cmdCommentSubmit');
                aCommentSubmit.onclick=function (){
                    CreateComments.addComment(0, 'commentText', 'cmdCommentSubmit');
                };
            }
            var aAddFriend=document.getElementById('addFriend');
            if(aAddFriend){
                aAddFriend.href="javascript:void(0);";
                aAddFriend.onclick=function(){
                    var sURL='/user/actions/addFriend.php?iduser=';
                    if (CreateComments.intOwner > 0){
                        var oRequest = CreateComments._getHttpRequest();
                        sURL=sURL+CreateComments.intOwner;
                        oRequest.open("GET",sURL,false);
                        oRequest.send(null);
                    }
                    document.getElementById('commentError-2').style.display='none';
                    document.getElementById('cmdCommentSubmit').style.display='block';
                };
            }
        }
        else{
            document.getElementById('comments_CommentsDiv').style.display='none';
        }
    },
    ShowComments:function (from, to){

        if(this.numTotal==0){
            var comment=document.getElementById('comment');
            if(comment){
                this.allComments.removeChild(comment);
                this.showHidePreviousButton('none');
                this.showHideNextButton('none');
            }
            return;
        }

        var intTotalChildren;
        //elementos del padre
        var divParentChildren, divParentDisplayComments, aParentUserProfile, imgParentUserPhoto, sParentpanDate, divChildComments;
        var pParentName, divParentMessage, aParentBlockUser, divReplyArea, taReply, btnReply, divParent;

        //elementos de los hijos
        var divChildrenReplyDel, divChildrenDisplayComments, aChildrenUserProfile, imgChildrenUserPhoto;
        var divChildrenName, sChildrenDate, divChildrenMessage, aChildrenBlockUser;

        for(i=from;i<to && i<this.numTotal;++i){

            divParentChildren=document.getElementById('comment');
            if(!divParentChildren){
                this.allComments.appendChild(this.divParentClone);
                divParentChildren=document.getElementById('comment');
                this.divParentClone=divParentChildren.cloneNode(true);
            }
            //se despliega el padre

            var hiddenI=document.getElementById('hiddenI');
            hiddenI.id='hiddenI-'+this.objJson[i].id;
            hiddenI.value=i;

            //se da id al ocultar o mostrar hijos

            var showChildren=document.getElementById('showChildren');
            if(showChildren){
                showChildren.id='showChildren-'+this.objJson[i].id;
            }

            //se le da nombre al div que contiene todos los elementos del comentario
            divParentChildren.id='comment-'+this.objJson[i].id;

            divParent=document.getElementById("parentComment");
            divParent.id='parentComment-'+this.objJson[i].id;

            //div que contiene la imagen
            var divParentUserPicture=document.getElementById("imgcomment");
            divParentUserPicture.id='imgcomment-'+this.objJson[i].id;

            //anchor de la imagen que lleva al perfil del usuario
            aParentUserProfile=document.getElementById("imgUserProfile");
            aParentUserProfile.id='imgUserProfile-'+this.objJson[i].id;
            aParentUserProfile.href=this.objJson[i].url;

            //imagen precargada
            imgParentUserPhoto=document.getElementById("UserImage");
            if(typeof this.objJson[i].image == 'string'){
                imgParentUserPhoto.src=this.objJson[i].image;
                imgParentUserPhoto.id='UserImage-'+this.objJson[i].id;
                this.objJson[i].image=imgParentUserPhoto;
            }
            else{
                aParentUserProfile.removeChild(imgParentUserPhoto);
                aParentUserProfile.appendChild(this.objJson[i].image);
            }

            //div que contiene el nombre, fecha y mensaje
            divParentDisplayComments=document.getElementById("containercomment");
            divParentDisplayComments.id='containercomment-'+this.objJson[i].id;

            //anchor del perfil del dueño del comentario
            var aParentName=document.getElementById("commentuserlink");
            aParentName.id='commentuserlink-'+this.objJson[i].id;
            aParentName.href=this.objJson[i].url;
            aParentName.innerHTML=this.objJson[i].displayName;

            //fecha del comentario
            sParentpanDate=document.getElementById("commentdate");
            sParentpanDate.id='commentdate-'+this.objJson[i].id;
            sParentpanDate.innerHTML=this.objJson[i].postDate;

            //mensaje del comentario
            divParentMessage=document.getElementById("_commenttext");
            //se procesa el texto del comentario para ie6 y los objects
            var pattern = /MSIE 6/;
            var strParentComment =this.objJson[i].body;
            if (pattern.test(navigator.appVersion)) {
                if (strParentComment.indexOf("<object") > -1 && strParentComment.indexOf("</object>") > -1) {
                    arrEmbed = strParentComment.split("<object");
                    strParentComment = arrEmbed.join(' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
                }
            }
            divParentMessage.innerHTML=strParentComment;
            divParentMessage.id='_commenttext-'+this.objJson[i].id;
            //si el comentario tiene una imagen, se manda a que se cambien sus medidas
            this._resizeImage(divParentMessage.id);

            //textbox de la respuesta
            divReplyArea=document.getElementById("replyArea");
            divReplyArea.id='replyArea-'+this.objJson[i].id;

            btnReply=document.getElementById("btnReply");
            btnReply.id='btnReply-'+this.objJson[i].id;

            //anchor para las respuestas
            var divParentReplyDel=document.getElementById("divParentReplyDel");
            divParentReplyDel.id='divParentReplyDel-'+this.objJson[i].id;
            var aParentReply=document.getElementById("aParentReply");
            aParentReply.id='aParentReply-'+this.objJson[i].id;

            var divChildReply=document.getElementById("divChildReply");
            divChildReply.id='divChildReply-'+this.objJson[i].id;

            var aChildReply=document.getElementById("aChildReply");
            aChildReply.id='aChildReply-'+this.objJson[i].id;

            if(this.objJson[i].totalChildrens==0){
                aParentReply.style.display='block';
                aParentReply.href="javascript:CreateComments.replyComment("+this.objJson[i].id+",'"+i+"')";
            }
            else{
                divChildReply.style.display='block';
                aChildReply.style.display='block';

                aChildReply.href="javascript:CreateComments.replyComment("+this.objJson[i].id+",'"+i+"')";
            }

            taReply=document.getElementById("taReply");
            taReply.id='taReply-'+this.objJson[i].id;
            taReply.onfocus=function(){
                var commentId=this.id.split('-')[1];
                var aReply=document.getElementById("aParentReply-"+commentId);
                aReply.onmousedown=function(){return false;};
            };
            taReply.onblur=function(){
                var blnWhiteSpaces=false;
                var commentId=this.id.split('-')[1];
                var hiddenIndex=document.getElementById('hiddenI-'+commentId);
                for ( i = 0; i < this.value.length; i++ ) {
                    if ( this.value.charAt(i) != " " ) {
                        blnWhiteSpaces=true;
                        break;
                    }
                }
                if(this.value.length==0 || !blnWhiteSpaces){
                    this.parentNode.style.display='none';
                }
                var aReply=document.getElementById("aParentReply-"+commentId);
                aReply.onmousedown=function(){return true;};
            };

            //anchor para borrar el comentario padre
            var aParentDelete=document.getElementById("aParentDelete");
            aParentDelete.id='aParentDelete-'+this.objJson[i].id;
            if((this.intOwner==this.arrAtributes.userId) || (this.arrAtributes.userId==this.objJson[i].ownerId) ){
                aParentDelete.style.display='block';
                aParentDelete.href=aParentDelete.href+"CreateComments.deleteCommentAllComPag("+this.objJson[i].id+","+this.arrAtributes.userId+",0,"+i+"):void(0)";
            }

            //div de ocultar o mostrar hijos
            var contentChilds=document.getElementById("contentChilds");
            contentChilds.id='contentChilds-'+this.objJson[i].id;

            //div de los hijos
            var divChildComments=document.getElementById("childComments");
            divChildComments.id='childComments-'+this.objJson[i].id;

            //form para ver todos los hijos
            var allChildrenForm=document.getElementById("allChildrenForm");
            if(allChildrenForm){
                allChildrenForm.id='allChildrenForm-'+this.objJson[i].id;
                if(this.arrAtributes.numCommunityId){
                    allChildrenForm.action=this.arrAtributes.strMoreChildUrl+'?type='+this.arrAtributes.intCommentType+'&item='+this.arrAtributes.ItemId+'&id='+this.objJson[i].id+'&commId='+this.arrAtributes.numCommunityId;
                }
                else {
                    allChildrenForm.action=this.arrAtributes.strMoreChildUrl+'?type='+this.arrAtributes.intCommentType+'&item='+this.arrAtributes.ItemId+'&id='+this.objJson[i].id;
                }
                //inputs hidden del form
                var commentObject=document.getElementById("hiddenCommentObject");
                commentObject.id='hiddenCommentObject-'+this.objJson[i].id;

                var hiddenOwnerId=document.getElementById("hiddenOwnerId");
                hiddenOwnerId.id='hiddenOwnerId-'+this.objJson[i].id;

                //anchor para mostrar todos los hijos
                var aAllChilds=document.getElementById("aAllChilds");
                aAllChilds.id='aAllChilds-'+this.objJson[i].id;

                //div para indicar la cantidad de comentarios
                var sMore=document.getElementById("sMore");
                sMore.id='sMore-'+this.objJson[i].id;

                //span con la cantidad de comentarios que faltan por mostrar
                var remainReplys=document.getElementById("remainReplys");
                remainReplys.id='remainReplys-'+this.objJson[i].id;
            }

            //se despliegan los hijos
            if(this.objJson[i].totalChildrens>0){

                //esto sirve para mostrar los comentarios desde el ultimo comentario cuando el orden es acendente
                if(this.objJson[i].totalChildrens>this.arrAtributes.numChildComments
                && this.arrAtributes.numChildComments>-1){
                    j=this.objJson[i].totalChildrens-this.arrAtributes.numChildComments;
                }
                else{
                    j=0;
                }

                //se muestra el link de mostrar todos cuando los comentarios son mas de 3
                if(allChildrenForm){
                    if(this.objJson[i].totalChildrens > this.arrAtributes.numChildComments){
                        showChildren.style.display='block';
                        aAllChilds.style.display='inline';
                        sMore.style.display='inline';
                        aAllChilds.href="javascript:CreateComments.showAllChildrens("+this.objJson[i].id+",'"+i+"','"+0+"',"+this.objJson[i].totalChildrens+")";
                        remainReplys.innerHTML=this.objJson[i].totalChildrens-this.arrAtributes.numChildComments;
                    }
                }
                var limit=0;
                if(this.arrAtributes.numChildComments==-1){
                    limit=this.objJson[i].totalChildrens;
                }
                else{
                    limit=this.arrAtributes.numChildComments+j;
                }
                //se despliegan los hijos
                for(j;j<this.objJson[i].totalChildrens && j<limit;++j){
                    divChildComments.appendChild(this.divChildClone);
                    divChildrenDisplayComments=document.getElementById('childcomment');
                    this.divChildClone=divChildrenDisplayComments.cloneNode(true);
                    //div contenedor del comentario hijo
                    divChildrenDisplayComments.id='childcomment-'+this.objJson[i].childrens[j].id;
                    divChildrenDisplayComments.style.display='block';

                    //div de la imagen del comentario hijo
                    var divChildrenUserPicture=document.getElementById("childimgcomment");
                    divChildrenUserPicture.id="childimgcomment-"+this.objJson[i].childrens[j].id;

                    //anchor de la imagen del comentario hijo
                    var divChildrenUserProfile=document.getElementById("childimgUserProfile");
                    divChildrenUserProfile.id="childimgUserProfile-"+this.objJson[i].childrens[j].id;
                    divChildrenUserProfile.href=this.objJson[i].childrens[j].url;

                    //imagen del comentario hijo
                    imgChildrenUserPhoto=document.getElementById("childUserImage");
                    if(typeof this.objJson[i].childrens[j].image == 'string'){
                        imgChildrenUserPhoto.src=this.objJson[i].childrens[j].image;
                        imgChildrenUserPhoto.id='UserImage-'+this.objJson[i].childrens[j].id;
                        this.objJson[i].childrens[j].image=imgChildrenUserPhoto;
                    }
                    else{
                        divChildrenUserProfile.removeChild(imgChildrenUserPhoto);
                        divChildrenUserProfile.appendChild(this.objJson[i].childrens[j].image);
                    }

                    //div contenedor del mensaje, nombre y fecha del hijo
                    var childcontainercomment=document.getElementById("childcontainercomment");
                    childcontainercomment.id='childcontainercomment-'+this.objJson[i].childrens[j].id;

                    //anchor del nombre de usuario
                    var childcommentuserlink=document.getElementById("childcommentuserlink");
                    childcommentuserlink.id='childcommentuserlink-'+this.objJson[i].childrens[j].id;
                    childcommentuserlink.href=this.objJson[i].childrens[j].url;
                    childcommentuserlink.innerHTML=this.objJson[i].childrens[j].displayName;

                    //fecha del comentario hijo
                    sChildrenDate=document.getElementById("childcommentdate");
                    sChildrenDate.id='childcommentdate-'+this.objJson[i].childrens[j].id;
                    sChildrenDate.innerHTML=this.objJson[i].childrens[j].postDate;

                    //mensaje del comentario hijo
                    divChildrenMessage=document.getElementById("_childcommenttext");
                    //se procesa el texto del comentario para ie6 y los objects
                    pattern = /MSIE 6/;
                    var strChildComment =this.objJson[i].childrens[j].body;
                    if (pattern.test(navigator.appVersion)) {
                        if (strChildComment.indexOf("<object") > -1 && strChildComment.indexOf("</object>") > -1) {
                            arrEmbed = strChildComment.split("<object");
                            strChildComment = arrEmbed.join('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
                        }
                    }
                    divChildrenMessage.innerHTML=strChildComment;
                    divChildrenMessage.id='_childcommenttext-'+this.objJson[i].childrens[j].id;
                    //si el comentario tiene una imagen, se manda a que se cambien sus medidas
                    this._resizeImage(divChildrenMessage.id);

                    //div del anchor para borrar el comentario
                    divChildrenMessage=document.getElementById("divChildDel");
                    divChildrenMessage.id='divChildDel-'+this.objJson[i].childrens[j].id;

                    //anchor borrar
                    var aChildrenDelete=document.getElementById("aChildrenDelete");
                    aChildrenDelete.id='aChildrenDelete-'+this.objJson[i].childrens[j].id;
                    if((this.intOwner==this.arrAtributes.userId) || (this.arrAtributes.userId==this.objJson[i].childrens[j].ownerId)){
                        aChildrenDelete.style.display='block';
                        aChildrenDelete.href=aChildrenDelete.href+"CreateComments.deleteCommentAllComPag("+this.objJson[i].childrens[j].id+","+this.arrAtributes.userId+","+this.objJson[i].childrens[j].id+","+i+"):void(0)";
                    }
                }
            }
        }
    },

    deleteCommentAllComPag:function (comemntid,UserView,parentId,jsonIndex){
        CreateComments.RemoveComments('allComments');
        this.showHideNextButton('none');
        this.showHidePreviousButton('none');
        CreateComments.ShowLoading();
        _deleteComments = function() {
            if(CreateComments.numError!=0){
                CreateComments.hideError(CreateComments.numError);
            }
            var strParams  = "commid=" + comemntid +
            "&type=" + CreateComments.arrAtributes.intCommentType+
            "&user=" + UserView +
            "&commparentid=" + parentId;
            var oRequest = CreateComments._getHttpRequest();
            with(oRequest){
                open("POST","/comments/actions/delcomments.php",false);
                setRequestHeader("Content-type","application/x-www-form-urlencoded");
                setRequestHeader("Content-length",strParams.length);
                send(strParams);
            }
            var result = eval('('+oRequest.responseText+')');

            if(document.getElementById('allComments')){
                CreateComments.RemoveComments('allComments');
            }

            CreateComments.allComments = document.createElement("div");
            CreateComments.allComments.id='allComments';
            CreateComments.contentAllComments.appendChild(CreateComments.allComments);

            if(result.resp==-1){

                if(parentId==0){
                    CreateComments.objJson.splice(jsonIndex,1);
                }
                else {
                    for(i=0;i<CreateComments.objJson[jsonIndex].totalChildrens;++i){
                        if(CreateComments.objJson[jsonIndex].childrens[i].id==comemntid){
                            CreateComments.objJson[jsonIndex].childrens.splice(i,1);
                            --CreateComments.objJson[jsonIndex].totalChildrens;
                            break;
                        }
                    }
                }

                CreateComments.numTotal=CreateComments.objJson.length;

                if(CreateComments.intRequestLength==(CreateComments.arrAtributes.numParentComments+1)){
                    var iniPos=CreateComments.arrAtributes.numParentComments * CreateComments.numPages-1;
                    CreateComments.showNext(iniPos, CreateComments.arrAtributes.numParentComments+1);
                }

                if(CreateComments.numJsonArrayEndPos>=CreateComments.numTotal){
                    CreateComments.showHideNextButton('none');
                }
                else{
                    CreateComments.showHideNextButton('block');
                }

                //se saca la cantidad de comentarios que puede haber hasta la ultima pagina
                //si tenemos 3 paginas, puede haber hasta 15 comentarios
                var numLastPageCapacity=CreateComments.arrAtributes.numParentComments*CreateComments.numPages;
                //se toma numLastPageCapacity y se le resta la cantidad de comentarios padres que se pueden mostrar
                //para saber cuantos comentarios mas puede tener la ultima pagina, si el valor es -1 significa que
                //aun no se han cargado todos los comentarios, si el valor es 4 significa que la ultima pagina tiene un
                //solo comentario y si el valor es 5 significa que la ultima pagina esta vacia
                var numLasPageComments=numLastPageCapacity-CreateComments.numTotal;
                //si el inRequestLength es menor o igual al numero de comentarios padres permitidos,
                //significa que ya se cargaron todos los comentarios
                //si numLasPageComments es mayor de 0 significa que la ultima pagina
                //aun tiene comentarios y no puede ser eliminada, y si numPages es mayor a cero, hay mas de 1 pagina.
                if(CreateComments.intRequestLength<=CreateComments.arrAtributes.numParentComments &&
                numLasPageComments==5 && CreateComments.numPages>1){
                    --CreateComments.numPages;
                    //ya que se reduce la cantidad de paginas, si nos encontrabamos en la ultima pagina de comentarios
                    //hay que reducir los indices que mandamos al showcomments para que no nos muestre la ultima pagina
                    //sin comentarios
                    if(CreateComments.numActualPage == (CreateComments.numPages+1) && CreateComments.numJsonArrayIniPos>0){
                        --CreateComments.numActualPage;
                        CreateComments.numJsonArrayIniPos-=CreateComments.arrAtributes.numParentComments;
                        CreateComments.numJsonArrayEndPos-=CreateComments.arrAtributes.numParentComments;
                    }
                }
                //si la posicion inicial es 0, significa que estamos en la pagina 1
                if(CreateComments.numJsonArrayIniPos==0){
                    CreateComments.showHidePreviousButton('none');
                }
                else{
                    CreateComments.showHidePreviousButton('block');
                }
                if(CreateComments.numTotal==0){
                    var topPagination=document.getElementById('topPagination');
                    var bottomPagination=document.getElementById('bottomPagination');
                    topPagination.style.display='none';
                    bottomPagination.style.display='none';
                    //si el array de atributos tiene el parametro strGoBackUrl, significa que nos encontramos
                    //en la pagina de childcomments donde vemos al comentario padre con todos sus hijos
                    //si se borra el comentario padre, nos regresa a la pagina anterior
                    if(CreateComments.arrAtributes.strGoBackUrl){
                        location.href=CreateComments.arrAtributes.strGoBackUrl;
                        return;
                    }
                }
                CreateComments.ShowComments(CreateComments.numJsonArrayIniPos, CreateComments.numJsonArrayEndPos);
            }
            else{
                CreateComments.showError(result.resp);
                CreateComments.ShowComments(CreateComments.numJsonArrayIniPos, CreateComments.numJsonArrayEndPos);
                //se mostrara el boton next si  no se han mostrado todos los comentarios
                //o si no estamos en la ultima pagina
                if(CreateComments.intRequestLength > CreateComments.arrAtributes.numParentComments ||
                CreateComments.numActualPage < CreateComments.numPages){
                    CreateComments.showHideNextButton('block');
                }

                //se mostrara el boton previous si no estamos en la primer pagina
                if(CreateComments.numActualPage > 1){
                    CreateComments.showHidePreviousButton('block');
                }
            }
        }
        setTimeout("_deleteComments()", 300);
    },

    replyComment:function (commentId, jsonIndex){
        if(this.numError!=0){
            this.hideError(this.numError);
        }
        var divReplyArea=document.getElementById('replyArea-'+commentId);
        var taReply=document.getElementById('taReply-'+commentId);
        var btnReply=document.getElementById('btnReply-'+commentId)
        if(divReplyArea.style.display=='block' && taReply.value.length==0){
            divReplyArea.style.display='none';
            taReply.value='';
        }
        else if(taReply.value.length!=0){
            var blnWhiteSpaces=false;
            for ( i = 0; i < taReply.value.length; i++ ) {
                if ( taReply.value.charAt(i) != " " ) {
                    blnWhiteSpaces=true;
                    break;
                }
            }
            if(!blnWhiteSpaces){
                divReplyArea.style.display='none';
                taReply.value='';
            }
        }
        else{
            divReplyArea.style.display='block';
        }

        btnReply.onmousedown=function(){
            CreateComments.addComment(commentId, 'taReply-'+commentId, 'btnReply-'+commentId, jsonIndex);
            divReplyArea.style.display='none';
            taReply.value='';
        };
        taReply.focus();
    },

    addComment : function (intParentId, textAreaName, btnName, jsonIndex) {
        if(this.numError!=0){
            this.hideError(this.numError);
        }
        var blnValid = true;
        var btnSubmit = document.getElementById(btnName);
        var prevCursor = btnSubmit.style.cursor;

        btnSubmit.disabled = true;
        btnSubmit.style.display="none";
        btnSubmit.style.cursor = "wait";

        var commentTxT = "";
        commentTxT = document.getElementById(textAreaName).value;

        if (commentTxT.length > this.arrAtributes.numCommentLimitChars){
            this.showError(-5);
            blnValid = false;
        }



        var cleantext = commentTxT.replace(/^\s+|\s+$/g,"" );

        if (cleantext=="" && commentTxT != ""){
            this.showError(-6);
            blnValid = false;
        }

        if (commentTxT.length < 1){
            this.showError(-4);
            blnValid = false;
        }

        _sendRequest = function(){


            var strParams  = "type=" + CreateComments.arrAtributes.intCommentType +
            "&item=" + CreateComments.arrAtributes.ItemId +
            "&parentId=" + intParentId +
            "&getMD5=true" +
            "&txt=" + encodeURIComponent(commentTxT);
            var oRequest = CreateComments._getHttpRequest();
            with(oRequest){
                open("POST","/comments/actions/addcomment.php",false);
                setRequestHeader("Content-type","application/x-www-form-urlencoded");
                setRequestHeader("Content-length",strParams.length);
                send(strParams);
            }

            var blnAddToJson=false;
            jsonResp=eval('('+oRequest.responseText+')');
            switch (jsonResp.resp){
                case '-32':
                blnAddToJson=true;
                break;

                default:
                if(jsonResp.resp<0){//si la respuesta es un numero negativo, es un error
                    CreateComments.showError(jsonResp.resp);
                    blnAddToJson=false;
                }
                else{
                    blnAddToJson=true;
                }
            }

            if(blnAddToJson){
                if(CreateComments.intRequestLength > CreateComments.arrAtributes.numParentComments && intParentId==0){
                    if(CreateComments.numAdded==5){
                        CreateComments.numAdded=0;
                    }
                    else{
                        ++CreateComments.numAdded;
                    }
                }
                var topPagination=document.getElementById('topPagination');
                var bottomPagination=document.getElementById('bottomPagination');

                if(topPagination.style.display='none'){
                    topPagination.style.display='block';
                    bottomPagination.style.display='block';
                }

                var arrNewComment=new Object();
                var objDate=new Date();

                commentTxT = commentTxT.replace(/\n+/g, '<br/>');

                arrNewComment.displayName = CreateComments.arrAtributes.userName;
                arrNewComment.body = commentTxT;
                arrNewComment.id =jsonResp.resp;
                arrNewComment.parentId = intParentId;
                arrNewComment.postDate = objDate.getFullYear()+'-'+objDate.getMonth()+'-'+objDate.getDate()+' '+
                objDate.getHours()+':'+objDate.getMinutes()+':'+objDate.getSeconds();
                arrNewComment.ownerId = CreateComments.arrAtributes.userId;
                arrNewComment.singBlock = jsonResp.singBlock;
                arrNewComment.image = CreateComments.arrAtributes.userImage;
                arrNewComment.url = CreateComments.arrAtributes.userUrl;
                arrNewComment.totalChildrens = 0;
                arrNewComment.childrens = new Array();

                if(intParentId!=0){
                    CreateComments.objJson[jsonIndex].childrens.push(arrNewComment);

                    ++CreateComments.objJson[jsonIndex].totalChildrens;

                    if(document.getElementById('allComments')){
                        CreateComments.RemoveComments('allComments');
                    }

                    CreateComments.allComments = document.createElement("div");
                    CreateComments.allComments.id='allComments';
                    CreateComments.contentAllComments.appendChild(CreateComments.allComments);
                    CreateComments.ShowComments(CreateComments.numJsonArrayIniPos, CreateComments.numJsonArrayEndPos);
                }
                else {
                    if(CreateComments.arrAtributes.strCommentsOrder=='DESC'){
                        CreateComments.objJson.unshift(arrNewComment);

                        if(document.getElementById('allComments')){
                            CreateComments.RemoveComments('allComments');
                        }
                        CreateComments.numJsonArrayIniPos=0;
                        CreateComments.numJsonArrayEndPos=CreateComments.arrAtributes.numParentComments;
                        CreateComments.numTotal=CreateComments.objJson.length;
                        if(CreateComments.numTotal>CreateComments.arrAtributes.numParentComments){
                            CreateComments.showHideNextButton('block');
                        }
                        CreateComments.numActualPage=1;
                        CreateComments.allComments = document.createElement("div");
                        CreateComments.allComments.id='allComments';
                        CreateComments.contentAllComments.appendChild(CreateComments.allComments);
                        CreateComments.showHidePreviousButton('none');
                        CreateComments.ShowComments(CreateComments.numJsonArrayIniPos, CreateComments.numJsonArrayEndPos);
                    }
                    else if(CreateComments.arrAtributes.strCommentsOrder=='ASC'){
                        //si el usuario ya dio clic en todos los next, se agregara el comentario
                        //al json
                        if (CreateComments.intRequestLength!=(CreateComments.arrAtributes.numParentComments+1)){
                            CreateComments.objJson.push(arrNewComment);
                            CreateComments.numTotal=CreateComments.objJson.length;
                            ++CreateComments.intRequestLength;
                            if(CreateComments.intRequestLength==(CreateComments.arrAtributes.numParentComments+1)){
                                CreateComments.intRequestLength=1;
                                CreateComments.showHideNextButton('block');
                            }
                            else if(CreateComments.numJsonArrayEndPos>=CreateComments.numTotal){
                                if(document.getElementById('allComments')){
                                    CreateComments.RemoveComments('allComments');
                                }
                                CreateComments.allComments = document.createElement("div");
                                CreateComments.allComments.id='allComments';
                                CreateComments.contentAllComments.appendChild(CreateComments.allComments);
                                CreateComments.ShowComments(CreateComments.numJsonArrayIniPos, CreateComments.numJsonArrayEndPos);
                            }
                        }
                    }
                    //se aumenta el numero de paginas si es necesario
                    var numLastPageCapacity=CreateComments.arrAtributes.numParentComments*CreateComments.numPages;

                    if(CreateComments.intRequestLength<=CreateComments.arrAtributes.numParentComments &&
                    numLastPageCapacity<CreateComments.numTotal){
                        ++CreateComments.numPages;
                    }
                }
            }
            else{
                if(document.getElementById('allComments')){
                    CreateComments.RemoveComments('allComments');
                }
                CreateComments.allComments = document.createElement("div");
                CreateComments.allComments.id='allComments';
                CreateComments.contentAllComments.appendChild(CreateComments.allComments);
                CreateComments.ShowComments(CreateComments.numJsonArrayIniPos, CreateComments.numJsonArrayEndPos);
            }

            //se mostrara el boton next si  no se han mostrado todos los comentarios
            //o si no estamos en la ultima pagina
            if(CreateComments.intRequestLength > CreateComments.arrAtributes.numParentComments ||
            CreateComments.numActualPage < CreateComments.numPages){
                CreateComments.showHideNextButton('block');
            }

            //se mostrara el boton previous si no estamos en la primer pagina
            if(CreateComments.numActualPage > 1){
                CreateComments.showHidePreviousButton('block');
            }
        }
        if(blnValid){
            CreateComments.showHideNextButton('none');
            CreateComments.showHidePreviousButton('none');
            CreateComments.RemoveComments("allComments");
            CreateComments.ShowLoading();
            setTimeout("_sendRequest()", 300);
        }
        btnSubmit.disabled = false;
        btnSubmit.style.cursor = prevCursor;
        btnSubmit.style.display="block";
        if (document.getElementById(textAreaName)) {
            document.getElementById(textAreaName).value='';
        }
    },

    showBlinks : function () {
        window.open("/blinks/","blinks", "width=670px,height=450px");
    },
    addFriendAlt : function(numUserId){
        var sURL='/user/actions/addFriend.php?iduser=';
        if (numUserId > 0){
            var oRequest = this._getHttpRequest();
            sURL=sURL+numUserId;
            oRequest.open("GET",sURL,false);
            oRequest.send(null);
        }
    },
    showError : function(error) {
        var divError=document.getElementById('commentError' + error);
        if(divError){
            this.numError=error;
            divError.style.display='block';
        }
    },
    hideError : function(error) {
        var error=document.getElementById('commentError'+error);
        if(error){
            this.numError=0;
            error.style.display="none";
        }
    },
    _getHttpRequest:function() {
        var oRequest=null;
        if(window.XMLHttpRequest){
            oRequest = new XMLHttpRequest();
        }else{
            if(window.ActiveXObject)
            var xmlVersions = new Array('MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.5.0',
            'MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP');
            for(var i=0;i<xmlVersions.length;i++){
                try{
                    oRequest = new ActiveXObject(xmlVersions[i]);
                }catch(e){}
            }
        }
        return oRequest;
    },
    showHideNextButton:function(action){
        hideDiv=document.getElementById('topNextPag');
        hideDiv.style.display=action;

        hideDiv=document.getElementById('bottomNextPag');
        hideDiv.style.display=action;
    },
    showHidePreviousButton:function(action){
        var hideDiv=document.getElementById('topPrevPag');
        hideDiv.style.display=action;

        hideDiv=document.getElementById('bottomPrevPag');
        hideDiv.style.display=action;
    },
    blockUser:function(idProfileOwner, idToBlock, sign, user) {
        if(this.numError!=0){
            this.hideError(this.numError);
        }
        msg = (blockMsgs[0]).replace(/@USUARIO/g, user);
        blnConfirm = confirm(msg);
        if (blnConfirm) {
            response = $.ajax({
                type: "POST",
                url: "/user/actions/blockUser.php",
                data: "id=" + idProfileOwner +
                "&blocked=" + idToBlock +
                "&sign=" + sign,
                async: false
            }).responseText;
            result = eval('(' + response + ')');
        }
    },
    showAllChildrens:function ( numParentId, numJsonIndex, offset, numLimit )
    {
        var aAllChilds=document.getElementById('aAllChilds-'+numParentId);
        /*  var aHideChilds=document.getElementById('aHideChilds-'+numParentId);
        var aNextChildren=document.getElementById('aNextChildren-'+numParentId);
        var allChildrenForm=document.getElementById('allChildrenForm-'+numParentId);
        if(numLimit>10 && aHideChilds.style.display=='none'){
        numLimit=10;
        aAllChilds.style.display='none';
        aHideChilds.style.display='block';
        aNextChildren.style.display='block';
        allChildrenForm.style.display='block';*/
        //se hace un merge en un objeto vacio para hacer una copia del objeto del comentario padre con
        //sus hijos
        var objParentChildren=$.extend(true,{}, this.objJson[numJsonIndex]);
        if(objParentChildren.image){
            if(typeof objParentChildren.image != 'string'){
                objParentChildren.image=objParentChildren.image.src;
            }
            if(objParentChildren.totalChildrens>0){

                var i=0;
                for(i;i<objParentChildren.totalChildrens;++i){
                    if(typeof objParentChildren.childrens[i].image != 'string'){
                        objParentChildren.childrens[i].image=objParentChildren.childrens[i].image.src;
                    }
                }
            }
        }

        var hidArr=document.getElementById('hiddenCommentObject-'+numParentId);
        //por el momento no se manda el comentario por el js porque al momento de borrar un comentario
        //en la pagina donde se ven todos los comentarios hijos, si se da refresh se vuelve a mostrar
        //el comentario ya borrado

        hidArr.value='[{}]';//JSON.stringify(objParentChildren);

        var hidOwner=document.getElementById('hiddenOwnerId-'+numParentId);
        hidOwner.value=this.intOwner;

        aAllChilds.onclick=function(){
            document.getElementById('allChildrenForm-'+numParentId).submit(); return false;
        };
        aAllChilds.onclick();
        /*  }
        else{
        if(aAllChilds.style.display=='block'){
        aAllChilds.style.display='none';
        aHideChilds.style.display='block';
        }
        else{
        aAllChilds.style.display='block';
        aHideChilds.style.display='none';
        aNextChildren.style.display='none';
        allChildrenForm.style.display='none';
        }
        }
        var divChildComments=document.getElementById('childComments-'+numParentId);
        var contentChilds=document.getElementById('contentChilds-'+numParentId);
        if(divChildComments){
        contentChilds.removeChild(divChildComments);
        divChildComments=document.createElement('div');
        divChildComments.id='childComments-'+numParentId;
        contentChilds.appendChild(divChildComments);
        }
        var j=offset;
        for(j; j<numLimit && j<this.objJson[numJsonIndex].totalChildrens; ++j){
        divChildComments.appendChild(this.divChildClone);
        divChildrenDisplayComments=document.getElementById('childcomment');
        this.divChildClone=divChildrenDisplayComments.cloneNode(true);
        //div contenedor del comentario hijo
        divChildrenDisplayComments.id='childcomment-'+this.objJson[numJsonIndex].childrens[j].id;
        divChildrenDisplayComments.style.display='block';

        //div de la imagen del comentario hijo
        var divChildrenUserPicture=document.getElementById("childimgcomment");
        divChildrenUserPicture.id="childimgcomment-"+this.objJson[numJsonIndex].childrens[j].id;

        //anchor de la imagen del comentario hijo
        var divChildrenUserProfile=document.getElementById("childimgUserProfile");
        divChildrenUserProfile.id="childimgUserProfile-"+this.objJson[numJsonIndex].childrens[j].id;
        divChildrenUserProfile.href=this.objJson[numJsonIndex].childrens[j].url;

        //imagen del comentario hijo
        imgChildrenUserPhoto=document.getElementById("childUserImage");
        if(typeof this.objJson[numJsonIndex].childrens[j].image == 'string'){
        imgChildrenUserPhoto.src=this.objJson[numJsonIndex].childrens[j].image;
        imgChildrenUserPhoto.id='UserImage-'+this.objJson[numJsonIndex].childrens[j].id;
        this.objJson[numJsonIndex].childrens[j].image=imgChildrenUserPhoto;
        }
        else{
        divChildrenUserProfile.removeChild(imgChildrenUserPhoto);
        divChildrenUserProfile.appendChild(this.objJson[numJsonIndex].childrens[j].image);
        }

        //div contenedor del mensaje, nombre y fecha del hijo
        var childcontainercomment=document.getElementById("childcontainercomment");
        childcontainercomment.id='childcontainercomment-'+this.objJson[numJsonIndex].childrens[j].id;

        //anchor del nombre de usuario
        var childcommentuserlink=document.getElementById("childcommentuserlink");
        childcommentuserlink.id='childcommentuserlink-'+this.objJson[numJsonIndex].childrens[j].id;
        childcommentuserlink.href=this.objJson[numJsonIndex].childrens[j].url;
        childcommentuserlink.innerHTML=this.objJson[numJsonIndex].childrens[j].displayName;

        //fecha del comentario hijo
        sChildrenDate=document.getElementById("childcommentdate");
        sChildrenDate.id='childcommentdate-'+this.objJson[numJsonIndex].childrens[j].id;
        sChildrenDate.innerHTML=this.objJson[numJsonIndex].childrens[j].postDate;

        //mensaje del comentario hijo
        divChildrenMessage=document.getElementById("_childcommenttext");
        pattern = /MSIE 6/;
        var strChildComment =this.objJson[numJsonIndex].childrens[j].body;
        if (pattern.test(navigator.appVersion)) {
        if (strChildComment.indexOf("<object") > -1 && strChildComment.indexOf("</object>") > -1) {
        arrEmbed = strChildComment.split("<object");
        strChildComment = arrEmbed.join(' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
        }
        }
        divChildrenMessage.innerHTML=strChildComment;
        divChildrenMessage.id='_childcommenttext-'+this.objJson[numJsonIndex].childrens[j].id;
        //si el comentario tiene una imagen, se manda a que se cambien sus medidas
        this._resizeImage(divChildrenMessage.id);

        //div del anchor para borrar el comentario
        divChildrenMessage=document.getElementById("divChildDel");
        divChildrenMessage.id='divChildDel-'+this.objJson[numJsonIndex].childrens[j].id;

        //anchor borrar
        var aChildrenDelete=document.getElementById("aChildrenDelete");
        aChildrenDelete.id='aChildrenDelete-'+this.objJson[numJsonIndex].childrens[j].id;
        if((this.intOwner==this.arrAtributes.userId) || (this.arrAtributes.userId==this.objJson[numJsonIndex].childrens[j].ownerId)){
        aChildrenDelete.style.display='block';
        aChildrenDelete.href=aChildrenDelete.href+"CreateComments.deleteCommentAllComPag("+this.objJson[numJsonIndex].childrens[j].id+","+this.arrAtributes.userId+","+this.objJson[numJsonIndex].childrens[j].id+","+numJsonIndex+"):void(0)";
        }
        }*/
    },
    _resizeImage :function(contentCommentId) {
        var itableComment = document.getElementById(contentCommentId);
        if( itableComment ){
            var ifr = itableComment.getElementsByTagName("img");
            for (var x = 0; x < ifr.length ;x++ ){
                try{
                    var im = ifr[x];
                    im.style.display='none';
                    im.onload=function (){
                        imgWidth=this.width;
                        heightWidth=this.height;
                        if(imgWidth==0){
                            var img=document.createElement('img');
                            img.src=this.src;
                            if(img.width>0){
                                imgWidth=img.width;
                                heightWidth=img.height;
                            }
                        }
                        if( imgWidth > CreateComments.maxWidthUnit ){
                            this.height=heightWidth-(((imgWidth-CreateComments.maxWidthUnit)/imgWidth)*heightWidth);
                            this.width = CreateComments.maxWidthUnit;
                        }
                        this.style.display='block';
                    }
                }catch(e){}
            }
        }
    },
    jsonToString: function(jSonobject){
        var strJson='[{';
    },
    track : function (type, page, item) {
        trackAjax(this.numPageId,'/comments/' + type + '/' + item + 'p' + page + '.html');
    }
};
