/*
 * PROJECT:			Insight Builder
 * VERSION:			2.0
 *
 * Copyright (c) IMS Polar Design, 2000-2006. All rights reserved.
 * Do not distribute without the express permission of Polar Design.
 *
 * PACKAGE:			Client Software \ xHTML Library
 * AUTHOR:			Victor S. Popov
 * DATE:			28.11.2001
 *
 * IB2HTML.JS		Implementation File
 *
 */

// ----------------------------------------------------------------------------

// Single attribute, name="value"
function a (name, value) {
	return " " + name + "=\"" + value + "\"";
}

// Single tag, < ... />
function s (name, attributes) {
	return "<" + name + attributes + "/>";
}	

// Double tag, < ... ></ ... >
function d (name, attributes, body) {
	return "<" + name + attributes + ">" + body + "</" + name + ">";
}

// Comment
function c (body) {
	return "<!-- " + body + " -->";
}

// ----------------------------------------------------------------------------

// bgcolor=" ... "
function bgc (color) {
	return a ("bgcolor", color);
}

// background=" ... "
function bgi (href) {
	return a ("background", href);
}

// align=" ... "
function align (type) {
	return a ("align", type);
}

// valign=" ... "
function valign (type) {
	return a ("valign", type);
}

// width=" ... "
function width (value) {
	return a ("width", value);
}

// height=" ... "
function height (value) {
	return a ("height", value);
}

// id=" ... "
function id (name) {
	return a ("id", name);
}

// name=" ... "
function name (id) {
	return a ("name", id);
}

// href=" ... "
function href (href) {
	return a ("href", href);
}

// href=" ... "
function src (src) {
	return a ("src", src);
}

// alt=" ... "
function alt (value) {
	return a ("alt", value);
}

// onmouseover=" ... "
function mouseover (action) {
	return a ("onmouseover", action);
}

// onmouseout=" ... "
function mouseout (action) {
	return a ("onmouseout", action);
}

// onmclick=" ... "
function click (action) {
	return a ("onclick", action);
}

// class=" ... "
function tc (id) {
	return a ("class", id);
}

// style=" ... "
function style (value) {
	return a ("style", value);
}

// left: ... px; top: ... px; 
function spos (x, y) {
	return "left: " + x + "px; top: " + y + "px; ";
}

// javascript: ...
function jsa (action) {
	//return "javascript: " + action;
	return " " + action;
}

// ----------------------------------------------------------------------------

// <html> ... </html>
function html (head, body) {
	return d ("html", "", head + body);
}

// <head> ... </head>
function head (value) {
	return d ("head", "", value);
}

// <title> ... </title>
function title (value) {
	return d ("title", "", value);
}

// <link rel="stylesheet" type="text/css" href=" ... "/>
function css (href) {
	return s ("link", a ("rel", "stylesheet") + a ("type", "text/css") + a ("href", href));
}

// <script language=" ... "> ... </script>
function iscript (language, source) {
	return d ("script", a ("language", language), source);
}

// <script language=" ... " src=" ... "></script>
function escript (language, source, body) {
	return d ("script", a ("language", language) + src (source), body);
}

// <body ... > ... </body>
function body (attributes, inner) {
	return d ("body", attributes, inner);
}

// <img src=" ... " border="0"/>
function img (image) {
	return s ("img", a ("border", 0) + src (image));
}

// <img ... />
function image (attributes) {
	return s ("img", attributes);
}

// <div id=" ... " ... > ... </div>
function div (name, attributes, body) {
	return d ("div", id (name) + attributes, body);
}

// <table ... > ... </table>
function table (attributes, body) {
	return d ("table", attributes, body);
}

// <tr ... > ... </tr>
function tr (attributes, body) {
	return d ("tr", attributes, body);
}

// <td ... > ... </td>
function td (attributes, body) {
	return d ("td", attributes, body);
}

// <a ... > ... </a>
function link (attributes, body) {
	return d ("a", attributes, body);
}

// ----------------------------------------------------------------------------

var nospacing = a ("cellspacing", 0);
var nopadding = a ("cellpadding", 0);
var nomargins = a ("topmargin", 0) + a ("bottommargin", 0) + a ("leftmargin", 0) + a ("rightmargin", 0);
var none = "";

// ----------------------------------------------------------------------------


