function contentButton(title, link, width) {

	var tableWidth = '';
	var cellWidth = '';

	if( (width != null) && (width != '') ) {
		tableWidth = 'width="' + width + '"';

		//if(width.search('%')) {
		//	cellWidth =  'width="' + width + '"';
		//} else {
			cellWidth =  'width="' + (width-16)  + '"';
		//}
	} 

	if( (link != null) && (link != '') ) {
		title = '<a href="' + link + '">' + title + '</a>';
	} else {
		title = '<span class="linkTitleInactive">' + title + '</span>';
	}

	var aText = '<table border="0" cellspacing="0" cellpadding="0" ' + tableWidth + '>';
	aText += '<tr>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_sx_alto.gif" width="8" height="8"></td>';
	aText += '<td height="2" bgcolor="#0066CC" ' + cellWidth + '><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_dx_alto.gif" width="8" height="8"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td ' + cellWidth + ' height="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td width="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td ' + cellWidth + ' align="center">&nbsp;' + title + '&nbsp;</td>';
	aText += '<td width="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_sx_basso.gif" width="8" height="8"></td>';
	aText += '<td ' + cellWidth + ' height="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_dx_basso.gif" width="8" height="8"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td ' + cellWidth + ' height="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr>';
	aText += '</table>';
	// alert(aText);
	return aText;
}

function contentTitle(title, width) {

	var tableWidth = '';

	if( (width != null) && (width != '') ) {
		tableWidth = 'width="' + width + '"';
	} 

	var aText = '<table border="0" cellspacing="0" cellpadding="0" ' + tableWidth + '>';
	aText += '<tr>';
	aText += '<td valign="middle">';
	aText += '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
	aText += '<tr><td height="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr></table>';
	aText += '</td>';
	aText += '<td align="center" class="linkTitle" width="10%" nowrap>&nbsp;' + title + '&nbsp;</td>';
	aText += '<td valign="middle">';
	aText += '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
	aText += '<tr><td height="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr></table></td>';
	aText += '</tr>';
	aText += '</table>';
	return aText;
}

function writeButton(title, link, width) {
	document.writeln(contentButton(title, link, width));
}

function writeTitle(title, width) {
	document.writeln(contentTitle(title, width));
}


function contentButton4request(title, link, width, request) {

	var tableWidth = '';
	var cellWidth = '';

	if( (width != null) && (width != '') ) {
		tableWidth = 'width="' + width + '"';

		//if(width.search('%')) {
		//	cellWidth =  'width="' + width + '"';
		//} else {
			cellWidth =  'width="' + (width-16)  + '"';
		//}
	} 

	if( (link != null) && (link != '') ) {
		title = '<a href="javascript:put2request(\'' + request + '\',\'' + link + '\');">' + title + '</a>';
	} else {
		title = '<span class="linkTitleInactive">' + title + '</span>';
	}

	var aText = '<table border="0" cellspacing="0" cellpadding="0" ' + tableWidth + '>';
	aText += '<tr>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_sx_alto.gif" width="8" height="8"></td>';
	aText += '<td height="2" bgcolor="#0066CC" ' + cellWidth + '><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_dx_alto.gif" width="8" height="8"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td ' + cellWidth + ' height="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td width="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td ' + cellWidth + ' align="center">&nbsp;' + title + '&nbsp;</td>';
	aText += '<td width="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_sx_basso.gif" width="8" height="8"></td>';
	aText += '<td ' + cellWidth + ' height="6"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '<td width="8" height="8" colspan="2" rowspan="2"><img src="../../images/comuni/raccordo_dx_basso.gif" width="8" height="8"></td>';
	aText += '</tr>';
	aText += '<tr>';
	aText += '<td ' + cellWidth + ' height="2" bgcolor="#0066CC"><img src="../../images/comuni/null.gif" width="1" height="1"></td>';
	aText += '</tr>';
	aText += '</table>';
	// alert(aText);
	return aText;
}




function writeButton4request(title, link, width, request) {
	document.writeln(contentButton4request(title, link, width, request));
}
