/* Creates a DOM <table> object
 *
 * border = border size of the table
 * cellspacing - number of pixels in cellspacing attribute
 * cellpadding - number of pixels in cellpadding attribute
 * width - number of pixels in width attribute (either percentage or exact number)
 * style - any legal style text can be passed in here
*/

function createTable(border, cellspacing, cellpadding, width, style, id) {
	var table = document.createElement("table");
	if (border) {
		table.setAttribute("border",border);
	}
	if (cellspacing) {
		table.setAttribute("cellspacing",cellspacing);
	}
	if (cellpadding) {
		table.setAttribute("cellpadding",cellpadding);
	}
	if (width) {
		table.setAttribute("width",width);
	}
	if (style) {
		table.setAttribute("style",style);
	}
	if (id) {
		table.setAttribute("id",id);
	}
	return table;
}

function createTextNode(theText) {
	return document.createTextNode(theText);
}

function createTableBody() {
	return document.createElement("tbody");
}

/* Creates a DOM <tr> object
 *
 * cellDataArray - an array of nodes to add. If the array is made up of strings, then textNodes are created and put into table cells.
*/

function createTableRow(cellDataArray) {
	if (cellDataArray == null) {
		return document.createElement("tr");
	} else {
		var row = document.createElement("tr");
		for (var i = 0; i < cellDataArray.length; i++) {
			var cell = document.createElement("td");
			if (typeof cellDataArray[i] == "string") {
				cell.appendChild(document.createTextNode(cellDataArray[i]));
				row.appendChild(cell);
			} else {
				row.appendChild(cell);
			}
		}
		return row;
	}
}

/* Creates a DOM <td> object
 * width - number of pixels in width attribute (either percentage or exact number)
 * align - horizontal alignment attribute
 * valign - vertical alignment attribute
 * style - any legal style text can be passed in here
 * height - the height in pixels of the table cell
*/
function createTableCell(width, align, valign, colspan, rowspan, style, height, cssClass) {
	var cell = document.createElement("td");
	if (width) {
		cell.setAttribute("width",width);
	}
	if (align) {
		cell.setAttribute("align",align);
	}
	if (valign) {
		cell.setAttribute("valign",valign);
	}
	if (colspan) {
		cell.setAttribute("colspan",colspan);
	}
	if (rowspan) {
		cell.setAttribute("rowspan",rowspan);
	}
	if (style) {
		cell.setAttribute("style",style);
	}
	if (height) {
		cell.setAttribute("height",height);
	}
	if (cssClass) {
		cell.setAttribute("class",cssClass);
	}
	return cell;
}

/* Creates a DOM text form field 
 *
 *
*/
function createTextBox(name, value, size, id, style, cssClass) {
	var input = document.createElement("input");
	input.setAttribute("type", "text");
	input.setAttribute("name",name);
	input.setAttribute("value",value);
	input.setAttribute("size",size);
	if (id) {
		input.setAttribute("id",id);
	}
	if (style) {
		input.setAttribute("style",style);
	}
	if (cssClass) {
		input.setAttribute("class",cssClass);
	}
	return input;
}

function createCheckBox(name, value, id, style, cssClass) {
	//alert(name + "\r" + value + "\r" + id);
	var input = document.createElement("input");
	input.setAttribute("type", "checkbox");
	input.setAttribute("name",name);
	input.setAttribute("value",value);
	if (id) {
		input.setAttribute("id",id);
	}
	if (style) {
		input.setAttribute("style",style);
	}
	if (cssClass) {
		input.setAttribute("class",cssClass);
	}
	return input;
}

function getSecurityDemo() {
	var popupURL = "/shop/securitycodes.jpg";
	var popup = window.open(popupURL,'greek101','toolbar=0,location=0,directories=0,titlebar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=600,height=350,screenX=50,screenY=50,left=50,top=50');
   if( navigator.appName.substring(0,8) == "Netscape" )
        {
            popup.location = popupURL;
            popup.opener = self;
        }
}