    function blogAddImage(){
        var t = document.getElementById('blogImagesTable');
        t.style.display = 'block';
        //add new row
        t.insertRow(t.rows.length);
        //check/add global rows number (so i don't have to reindex images)
        if (t.getAttribute('i')){
            t.setAttribute('i', parseInt(t.getAttribute('i'))+1);
        }else{
            t.setAttribute('i', 1);
        }
        //less typing
        var lastRow = t.rows[t.rows.length-1];
        
        var inp = document.createElement('input');
            inp.type="button";
            inp.value = '[img:'+t.getAttribute('i')+']';
            //set global index to button also - speed up
            inp.setAttribute('i', t.getAttribute('i'));
            inp.onclick = function (){
                //this = button
                tag_img(this.getAttribute('i'));
            }
        //add cell and inssert input to cell
        lastRow.insertCell(lastRow.cells.length);
        lastRow.lastChild.appendChild(inp);

        //create file input
        var name = 'Image'+t.getAttribute('i');
        if (events == 'ie'){
            var inp = document.createElement('<input NAME="'+name+'">');
        }else{
            var inp = document.createElement('input');
            inp.name = name;    
        }
        inp.type="file";

        //add cell and inssert input to cell                        
        lastRow.insertCell(lastRow.cells.length);
        lastRow.lastChild.appendChild(inp);

        //add remove button
        var inp = document.createElement('input');
            inp.type = "button";
            inp.value = translate('Delete');
            inp.onclick = function (){
                this.parentNode.parentNode.parentNode.parentNode.deleteRow(this.parentNode.parentNode.rowIndex);
            }
        //add cell and inssert input to cell
        lastRow.insertCell(lastRow.cells.length);
        lastRow.lastChild.appendChild(inp);
    }
    
    
    function blogPost(){
        var f = document.getElementById('CommentForm');
        var status = true;

        if (f.title.value == ''){
            f.title.focus();
            alert(translate('BlogPostTitle'));
            status = false;
            return false;
        }
        
        if (f.Body.value == ''){
            f.Body.focus();
            alert(translate('BlogPostCannotBeEmpty'));
            status = false;
            return false;
        }

        if (status == true){
            f.submit();
        }
    }
    function blogPreview(edit){
        var f = document.getElementById('CommentForm');
        if (edit == true){
            f.ACT.value = 'previewS';                    
        }else{
            f.ACT.value = 'preview';
        }
        f.submit();
    }

	function blogSettingFormSubmit(){
		var f = document.getElementById('blogSettingForm');
		var status = true;
		
		if (f.title.value == ''){
			status = false;
			alert(translate('BlogTitleCannotBeEmpty'));
			return false;
		}

		if (f.description.value == ''){
			if (!confirm(translate('BlogQDescriptionEmpty'))){
				status = false;
				return false;
			}
		}

		if (f.style.disabled != true && f.style.value.toLowerCase().slice(f.style.value.length-4) != '.css'){
			status = false;
			alert(translate('BlogAcceptedExtension'));
			return false;
		}

		if (status == true){
			f.submit();
		}
	}
	
	function BlogInsertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action) {
	    var win = window.open('popup.php?ACT=blogImage', 'blogImage', 'left=100, top=100, width=400, height=200');			
	}

	function blogNewBlogFormSubmit(){
		var f = document.getElementById('blogNewBlogForm');
		var s = true;
	
		if (f.title.value == ''){
			alert(translate('BlogEnterBlogName'));
			s = false;
			return false;
		}
	
		if (f.description.value == ''){
			if (!confirm(translate('BlogQDescriptionEmpty'))){
				s = false;
				return false;
			}
		}
		
		for (var i = 1; i < f.CatID.length; i++){
			if (f.CatID.item(i).selected == true){
				s = true;
				break;
			} else {
				s = false;
			}
		}
		if (s == false){
			alert(translate('Wybierz kategorię.'));
		}

		if (s == true){
			f.submit();
		}
	}
	
	
	function BlogRenameCat(id){
		var newName = prompt(translate('BlogEnterNewCatName'));
		var f = document.getElementById('catsForm');
		
		if (newName != false && newName != null && newName != ''){
			f.ACT.value = 'cat_ren';
			f.NewName.value = newName;
			f.CatID.value = id;
			f.submit();
		}
	}
	
	function BlogChangeParent(select, id){
		var f = document.getElementById('catsForm');
		f.ACT.value = 'changeParent';
		f.NewName.value = select[select.selectedIndex].value;
		f.CatID.value = id;
		f.submit();
	}
	
	function BlogDeleteCat(item, id){
		if (confirm(translate('BlogQDeleteCat'))){
			var f = document.getElementById('catsForm');
			f.ACT.value = 'cat_del';
			f.CatID.value = id;
			f.submit();
		}
	}		
