function round(number, decimals) {
	return Math.round(number * Math.pow(10, decimals)) / Math.pow(10, decimals)
}

function timestamp(datetime, format) {
	format = (format? format: "short")
	date = new Date(datetime)
	year = date.getFullYear()
	months = ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"]
	month = months[date.getMonth()]
	weekdays = ["domingo", "lunes", "martes", "miecoles", "jueves", "viernes", "sabado"]
	weekday = weekdays[date.getDay()]
	day = date.getDate()
	hour = date.getHours()
	meridian = (hour >= 12? "pm": "am")
	hour = hour % 12
	hour = (hour == 0? 12: hour)
	minute = date.getMinutes()
	minute = (minute < 10? "0" + minute: minute)
	switch(format) {
		case "long":	text = day + "-" + month.toLowerCase() + "-" + year + " " + hour + ":" + minute + " " + meridian
						break
		default:
		case "short":	text = day + "-" + month.toLowerCase()
						break
	}
	return text
}

function split(text) {
	words = text.split(' ')
	line1 = ''
	line2 = ''
	for(i = 0, i1=0, i2=0; i < words.length; i++) {
		if(line1.length <= line2.length) {
			line1 = line1 + (line1.length == 0? '': ' ') + words[i1]
			i1++
		} else {
			line2 = words[words.length - 1 - i2] + (line2.length == 0? '': ' ') + line2
			i2++
		}
	}
	return line1 + '<BR>' + line2
}

function cut(title, len) {
	if(title.length <= len) {
		return title
	} else {
		words = title.split(" ")
		short_title = ""
		for(i = 0; (i < words.length) && (short_title.length + words[i].length + 1 <= len); i++) {
			short_title += (" " + words[i])
		}
		return short_title + ""
	}
}

function portfolio_thumbnail(portfolio, linked) {
	return (linked? (portfolio.url? "<A HREF='" + portfolio.url + "' STYLE='text-decoration:none'>": "<A HREF='portfolio.html?" + portfolio.id + "' STYLE='text-decoration:none'>"): "") + "<TABLE WIDTH=704 HEIGHT=288 BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=" + portfolio.background_color + "><TR><TD><IMG SRC='../img/corner_top_left_" + portfolio.background_color + ".gif' WIDTH=20 HEIGHT=20 VSPACE=0 HSPACE=0 BORDER=0><IMG SRC='../img/dot_" + portfolio.background_color + ".gif' WIDTH=664 HEIGHT=20 VSPACE=0 HSPACE=0 BORDER=0><IMG SRC='../img/corner_top_right_" + portfolio.background_color + ".gif' WIDTH=20 HEIGHT=20 VSPACE=0 HSPACE=0 BORDER=0><BR></TD></TR><TR><TD WIDTH=704 HEIGHT=244 ALIGN='center' VALIGN='top'><IMG SRC='../img/corner_top_left_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=644 HEIGHT=10 BORDER=0><IMG SRC='../img/corner_top_right_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><BR><TABLE WIDTH=664 BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN='center' VALIGN='middle' BGCOLOR='" +  portfolio.thumbnail_background_color + "' STYLE='border:0px'><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR='" + portfolio.text_color + "'><TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN='center' VALIGN='middle'>" + (linked? (portfolio.url? "<A HREF='" + portfolio.url + "' STYLE='text-decoration:none'>": "<A HREF='portfolio.html?" + portfolio.id + "' STYLE='text-decoration:none'>"): "") + "<IMG SRC='../pictures/" + (portfolio.filename? portfolio.filename: portfolio.id + ".jpg") + "' BORDER=0 VSPACE=0 HSPACE=0 WIDTH=640 HEIGHT=215>" + (linked? "</A>": "") + "<BR></TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE><IMG SRC='../img/corner_bottom_left_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=644 HEIGHT=10 BORDER=0><IMG SRC='../img/corner_bottom_right_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0></TD></TR><TR><TD><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN='left' VALIGN='bottom'><IMG SRC='../img/corner_bottom_left_" + portfolio.background_color + ".gif' WIDTH=20 HEIGHT=20 VSPACE=0 HSPACE=0 BORDER=0></TD><TD WIDTH=664 HEIGHT=20 VALIGN='center'><DIV STYLE='color:" + portfolio.thumbnail_text_color + "; text-align:center; font-size:15px; font-family:arial,sans-serif; font-weight:bold; line-height:20px; font-style:regular; padding:0px 0px 4px 0px'>" + (linked? (portfolio.url? "<A HREF='" + portfolio.url + "' STYLE='text-decoration:none; color:" + portfolio.thumbnail_text_color + "'>": "<A HREF='portfolio.html?" + portfolio.id + "' STYLE='text-decoration:none; color:" + portfolio.thumbnail_text_color + "'>"): "") + (portfolio.title? portfolio.title: "") + (linked? "</A>": "") + "</DIV></TD><TD ALIGN='right' VALIGN='bottom'><IMG SRC='../img/corner_bottom_right_" + portfolio.background_color + ".gif' WIDTH=20 HEIGHT=20 VSPACE=0 HSPACE=0 BORDER=0></TD></TR></TABLE></TD></TR></TABLE>" + (linked? "</A>": "")
}

function collection_thumbnail(portfolio, collection, linked) {
	total = (collection.galleries? collection.galleries.length: 0)
	title = collection.title
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return (linked? "<A HREF='" + (total > 1? (collection.url? collection.url: "collection.html?" + portfolio.id + "," + collection.id): (collection.url? collection.url: "gallery.html?" + portfolio.id + "," + collection.id + "," + collection.galleries[0].id)) + "' STYLE='text-decoration:none; color:" + text_color + "'>": "") + "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0'><TR><TD WIDTH=345 HEIGHT=288 ALIGN='center' VALIGN='middle'><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=325 HEIGHT=10 BORDER=0><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><BR><TABLE WIDTH=345 HEIGHT=268 BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN='center' VALIGN='middle' BGCOLOR='" +  background_color + "' STYLE='border:0px'><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN='center' VALIGN='top'><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR='" + text_color + "'><TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN='center' VALIGN='middle'>" + (linked? "<A HREF='" + (total > 1? (collection.url? collection.url: "collection.html?" + portfolio.id + "," + collection.id): (collection.url? collection.url: "gallery.html?" + portfolio.id + "," + collection.id + "," + collection.galleries[0].id)) + "' STYLE='text-decoration:none; color:" + text_color + "'>": "") + "<IMG SRC='../pictures/" + (collection.filename? collection.filename: collection.id + ".jpg") + "' BORDER=0 VSPACE=0 HSPACE=0 WIDTH=321 HEIGHT=225>" + (linked? "</A>": "") + "</TD></TR></TABLE></TD></TR></TABLE><DIV STYLE='color:" + text_color + "; text-align:center; font-size:13px; font-family:arial,sans-serif; font-weight:regular; font-style:regular; padding-top:10px; line-height:14px'><B>" + (linked? "<A HREF='" + (total > 1? (collection.url? collection.url: "collection.html?" + portfolio.id + "," + collection.id): (collection.url? collection.url: "gallery.html?" + portfolio.id + "," + collection.id + "," + collection.galleries[0].id)) + "' STYLE='text-decoration:none; color:" + text_color + "'>": "") + (collection.title? collection.title: "") + "</B><BR><DIV STYLE='font-size:11px'>" + (collection.type? collection.type: total + " " + (total != 1? "fotograf&iacute;as": "fotograf&iacute;a")) + (collection.period? " (" + collection.period + ")": '') + "</DIV>" + (linked? "</A>": "") + "</DIV></TD></TR></TABLE></TD></TR></TABLE><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=325 HEIGHT=10 BORDER=0><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><BR></TD></TR></TABLE>" + (linked? "</A>": "")
}

function collection_void_thumbnail(portfolio) {
	return "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0'><TR><TD WIDTH=345><IMG SRC='../img/corner_top_left_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=325 HEIGHT=10><IMG SRC='../img/corner_top_right_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10></TD></TR><TR><TD WIDTH=345 HEIGHT=268 BGCOLOR='" + portfolio.thumbnail_background_color + "'></TD></TR><TR><TD WIDTH=345><IMG SRC='../img/corner_bottom_left_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=325 HEIGHT=10><IMG SRC='../img/corner_bottom_right_" + portfolio.thumbnail_corner_color + ".gif' WIDTH=10 HEIGHT=10></TD></TR></TABLE>"
}

function collection_title(portfolio, collection) {
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0'><TR><TD WIDTH=66 HEIGHT=66 ALIGN='center' VALIGN='middle'><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=46 HEIGHT=10><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR><TABLE WIDTH=66 HEIGHT=46 BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN='center' VALIGN='middle' BGCOLOR='" +  background_color + "' STYLE='border:0px'>" + (collection.logo? "<IMG SRC='../pictures/" + collection.folder + "/" + collection.logo + "' HEIGHT=46 WIDTH=46>": "<DIV STYLE='color:" + text_color + "; text-align:center; font-size:11px; font-family:arial,sans-serif; font-weight:bold; font-style:regular'>" + (collection.title_short? collection.title_short: (collection.title? collection.title: "")) + "</DIV>") + "</TD></TR></TABLE><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=46 HEIGHT=10><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR></TD></TR></TABLE>"
}

function gallery_thumbnail(portfolio, collection, gallery, width, height, linked) {
	width = (width? width: 704)
	height = (height? height: 188)
	url = "./gallery.html?" + portfolio.id + ',' + collection.id + "," + gallery.id
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return (linked? "<A HREF='" + url + "' STYLE='text-decoration:none; color:" + text_color + "'>": "") + "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=" + width + " HEIGHT=" + height + "><TR><TD HEIGHT=10><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=" + (width - 20) + " HEIGHT=10 BORDER=0><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0></TD></TR><TR><TD ALIGN='center' VALIGN='middle' HEIGHT=168 BGCOLOR='" + background_color + "'><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=" + (width - 20) + "><TR><TD ALIGN='middle' VALIGN='center'><TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 BGCOLOR='" + text_color + "'><TR><TD ALIGN='center' VALIGN='middle'>" + (linked? "<A HREF='" + url + "' STYLE='text-decoration:none; color:" + text_color + "'>": "") + "<IMG SRC='../pictures/" + collection.id + "/" + gallery.id + "/thumbnail.jpg' HEIGHT=121 BORDER=0 VSPACE=0 HSPACE=0>" + (linked? "</A>": "") + "</TD></TR></TABLE></TD></TR></TABLE>" + (linked? "<A HREF='" + url + "' STYLE='text-decoration:none; color:" + text_color + "'>": "") + "<DIV STYLE='color:" + text_color + "; text-align:center; font-size:13px; font-family:arial,sans-serif; font-weight:regular; font-style:regular; padding-top:10px'><B>" + (gallery.title? gallery.title: "Sin título") + "</B><BR>" + (gallery.text? "<DIV STYLE='font-size:11px'>" + gallery.text + "</DIV>": "") + (linked? "</A>": "") + "</DIV></TD></TR><TR><TD HEIGHT=10><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=" + (width - 20) + " HEIGHT=10 BORDER=0><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0></TD></TR></TABLE>" + (linked? "</A>": "")
}

function gallery_void_thumbnail(portfolio, collection, width, height) {
	width = (width? width: 704)
	height = (height? height: 188)
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD WIDTH=" + width + " HEIGHT=10><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=" + (width - 20) + " HEIGHT=10><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10></TD></TR><TR><TD WIDTH=" + width + " HEIGHT=" + (height - 20) + " BGCOLOR='" + background_color + "'></TD></TR><TR><TD WIDTH=" + width + " HEIGHT=10><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=" + (width - 20) + " HEIGHT=10><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR></TD></TR></TABLE>"
}

function gallery_title(portfolio, collection, gallery) {
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0'><TR><TD WIDTH=66 HEIGHT=66 ALIGN='center' VALIGN='middle'><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=46 HEIGHT=10><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR><TABLE WIDTH=66 HEIGHT=46 BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN='center' VALIGN='middle' BGCOLOR='" +  background_color + "' STYLE='border:0px'><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH='100%'><TR><TD ALIGN='center' VALIGN='middle'>" + (gallery.logo? "":(gallery.title? "<DIV STYLE='color:" + text_color + "; text-align:center; font-size:9px; font-family:arial,sans-serif; font-weight:bold; font-style:regular; padding:0px 0px 0px 0px'>" + gallery.title + "</DIV>":"") + (gallery.headline? "<DIV STYLE='color:" + text_color + "; text-align:center; font-size:10px; font-family:arial,sans-serif; font-weight:regular; font-style:regular; padding:0px 0px 0px 0px'>" + gallery.headline + "</DIV>": "")) + "</TD></TR></TABLE></TD></TR></TABLE><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=46 HEIGHT=10><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR></TD></TR></TABLE>"
}

function pictures(portfolio, collection, picture, width, height, border, color) {
	if(!width) {
		dimension = picture.resolution.split('x')
		defaultwidth = dimension[0] 
	}
	if(!height) {
		dimension = picture.resolution.split('x')
		defaultheight = dimension[1]
	}
	width = (width != null? width: defaultwidth)
	height = (height != null? height: defaultheight)
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=520 HEIGHT=520><TR><TD ALIGN='middle' VALIGN='center' BGCOLOR='" +  background_color + "' STYLE='border:0px'><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=500 HEIGHT=10><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=520 HEIGHT=500><TR><TD ALIGN='middle' VALIGN='center'>" + (border != 0? "<TABLE BORDER=0 CELLSPACING=" + (border || border == 0? border: 2) + " CELLPADDING=0 BGCOLOR='" + (color? color: text_color) + "'><TR><TD ALIGN='middle' VALIGN='center'>": "") + "<DIV STYLE='zoom:1; overflow:auto" + (width > 480? "; width:480": "") + (height> 480? "; height:480": "") + "' ALIGN='center'><IMG SRC='../pictures/"+ (collection.folder? collection.folder + "/": "") + (picture.filename? picture.filename: picture.id + ".jpg") + "' BORDER=0 VSPACE=0 HSPACE=0 WIDTH=" + width + " HEIGHT=" + height + "></DIV>" + (border != 0? "</TD></TR></TABLE>" : "") + "</TD></TR></TABLE><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=500 HEIGHT=10><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10><BR></TD></TR></TABLE>"
}

function object(portfolio, collection, object, width, height, border, color) {
	text_color = (collection.thumbnail_text_color? collection.thumbnail_text_color: portfolio.thumbnail_text_color)
	background_color = (collection.thumbnail_background_color? collection.thumbnail_background_color: portfolio.thumbnail_background_color)
	corner_color = (collection.thumbnail_corner_color? collection.thumbnail_corner_color: portfolio.thumbnail_corner_color)
	return "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=" + width + " HEIGHT=" + height + "><TR><TD ALIGN='middle' VALIGN='center' BGCOLOR='" +  background_color + "' STYLE='border:0px'><IMG SRC='../img/corner_top_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=" + (width - 20) + " HEIGHT=10 BORDER=0><IMG SRC='../img/corner_top_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><BR><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=" + (width - 20) + " HEIGHT=" + (height - 20) + "><TR><TD ALIGN='middle' VALIGN='center'>" + (border != 0? "<TABLE BORDER=0 CELLSPACING=" + (border || border == 0? border: 2) + " CELLPADDING=0 BGCOLOR='" + (color? color: text_color) + "'><TR><TD ALIGN='middle' VALIGN='center'>": "") + object + (border != 0? "</TD></TR></TABLE>" : "") + "</TD></TR></TABLE><IMG SRC='../img/corner_bottom_left_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><IMG SRC='../img/dot_" + corner_color + ".gif' WIDTH=" + (width - 20) + " HEIGHT=10 BORDER=0><IMG SRC='../img/corner_bottom_right_" + corner_color + ".gif' WIDTH=10 HEIGHT=10 BORDER=0><BR></TD></TR></TABLE>"
}

function key(label, url, text_color, background_color, corner_color, width, target, open_left, open_right) {
	return (url? '<A HREF="' + url +'" STYLE="text-decoration:none"' + (target? ' TARGET="_new"': '') + '>': '') + '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=' + (width? width: 66) + ' HEIGHT=16 BGCOLOR="' + background_color + '"><TR>' + (open_left? '<TD></TD>': '<TD WIDTH=8 HEIGHT=16 ALIGN="right" VALIGN="middle"><IMG SRC="../img/corner_top_left_' + corner_color + '.gif" WIDTH=8 HEIGHT=8 HSPACE=0 VSPACE=0 BORDER=0><BR><IMG SRC="../img/corner_bottom_left_' + corner_color + '.gif" WIDTH=8 HEIGHT=8 HSPACE=0 VSPACE=0 BORDER=0><BR></TD>') + '<TD WIDTH=' + (width? width - 8 * (open_left? 1: 0) - 8 * (open_right? 1: 0): 50 + 8 * (open_left? 1: 0) + 8 * (open_right? 1: 0)) + ' HEIGHT=16 ALIGN="middle" VALIGN="middle" BGCOLOR="' + background_color + '">' + (url? '<A HREF="' + url +'" STYLE="text-decoration:none"' + (target? ' TARGET="_new"': '') + '>': '') + '<DIV STYLE="color:' + text_color + '; text-align:middle; font-size:9px; line-height:12px; font-family:arial,sans-serif; font-style:plain; font-weight:bold; padding-top:0px">' + label + '</DIV>' + (url? '</A>': '') + '</TD>' + (open_right? '<TD></TD>': '<TD WIDTH=8 HEIGHT=16 ALIGN="left" VALIGN="middle"><IMG SRC="../img/corner_top_right_' + corner_color + '.gif" WIDTH=8 HEIGHT=8 HSPACE=0 VSPACE=0 BORDER=0><BR><IMG SRC="../img/corner_bottom_right_' + corner_color + '.gif" WIDTH=8 HEIGHT=8 HSPACE=0 VSPACE=0 BORDER=0><BR></TD>') + '</TR></TABLE>' + (url? '</A>': '')
}


