/*******************************************************************************
 * Playlist Editor
 * -----------------------------------------------------------------------------
 * Copyright (C) 2007,2008 FOR INTERNET a.s.
 * $Id$
 *
 *
 */


function node(name, children, attributes, properties)
{
        var node = document.createElement(name);
        if(children) for(var i = 0; i < children.length; i++)
                node.appendChild(typeof children[i] == "string" ? document.createTextNode(children[i]) : children[i]);
        if(attributes) for(var i in attributes) node.setAttribute(i, attributes[i]);
        if(properties) for(var i in properties) node[i] = properties[i];
        return node;
}


function div(children, attributes, properties)
{
        return node('div', children, attributes, properties);
}


function table(children, attributes, properties)
{
        return node('table', children, attributes, properties);
}


function tbody(children, attributes, properties)
{
        return node('tbody', children, attributes, properties);
}


function tr(children, attributes, properties)
{
        return node('tr', children, attributes, properties);
}


function td(children, attributes, properties)
{
        return node('td', children, attributes, properties);
}


function th(children, attributes, properties)
{
        return node('th', children, attributes, properties);
}


function img(attributes, properties)
{
        return node('img', [], attributes, properties);
}


function a(children, attributes, properties)
{
        return node('a', children, attributes, properties);
}


function strong(children, attributes, properties)
{
        return node('strong', children, attributes, properties);
}


