﻿function roundCorner(className) {
	for (var i = 0; i < document.getElementsByTagName("div").length; i++) {
		if (document.getElementsByTagName("div")[i].className == className) {
			var divObj = document.getElementsByTagName("div")[i];
			lw = 14;
			rw = 18;
			var lefWidth = " width: " + lw.toString() + "px; ";
			var rightWidth = " width: " + rw.toString() + "px; ";
			var midWidth = "";
			if (divObj.style["width"] != "") {
				if (divObj.style["width"].indexOf("%") != -1) {
					// ampiezza in percentuale...
					midWidth = " width:" + (parseInt(divObj.style["width"]) - 2).toString() + "%;";
					lefWidth = " width: 1%; ";
					rightWidth = lefWidth;
				}
				else {
					midWidth = " width:" + (parseInt(divObj.style["width"]) - lw - rw).toString() + "px;";
				}
			}
			divObj.innerHTML = ""
    			+ "\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\"><div><img src=\"./images/top_left_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"left\"><div><img src=\"./images/top_left_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"right\"><div><img src=\"./images/top_right_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\"><div><img src=\"./images/top_right_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\" valign=\"top\"><div><img src=\"./images/top_left_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + midWidth + "\" colspan=\"2\" rowspan=\"2\"><div>" + divObj.innerHTML + "</div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\" valign=\"top\"><div><img src=\"./images/top_right_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\" valign=\"bottom\"><div><img src=\"./images/bottom_left_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\" valign=\"bottom\"><div><img src=\"./images/bottom_right_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\"><div><img src=\"./images/bottom_left_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"left\"><div><img src=\"./images/bottom_left_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"right\"><div><img src=\"./images/bottom_right_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\"><div><img src=\"./images/bottom_right_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "</table>"
    			+ "";
		}
	}
}

function smallRoundCorner(className) {
	for (var i = 0; i < document.getElementsByTagName("div").length; i++) {
		if (document.getElementsByTagName("div")[i].className == className) {
			var divObj = document.getElementsByTagName("div")[i];
			lw = 12;
			rw = 16;
			var lefWidth = " width: " + lw.toString() + "px; ";
			var rightWidth = " width: " + rw.toString() + "px; ";
			var midWidth = "";
			if (divObj.style["width"] != "") {
				if (divObj.style["width"].indexOf("%") != -1) {
					// ampiezza in percentuale...
					midWidth = " width:" + (parseInt(divObj.style["width"]) - 2).toString() + "%;";
					lefWidth = " width: 1%; ";
					rightWidth = lefWidth;
				}
				else {
					midWidth = " width:" + (parseInt(divObj.style["width"]) - lw - rw).toString() + "px;";
				}
			}
			divObj.innerHTML = ""
    			+ "\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\"><div><img src=\"./images/top_small_left_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"left\"><div><img src=\"./images/top_small_left_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"right\"><div><img src=\"./images/top_small_right_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\"><div><img src=\"./images/top_small_right_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\" valign=\"top\"><div><img src=\"./images/top_small_left_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + midWidth + "\" colspan=\"2\" rowspan=\"2\"><div>" + divObj.innerHTML + "</div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\" valign=\"top\"><div><img src=\"./images/top_small_right_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\" valign=\"bottom\"><div><img src=\"./images/bottom_small_left_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\" valign=\"bottom\"><div><img src=\"./images/bottom_small_right_corn_03.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "\n	<tr>"
    			+ "\n		<td style=\"" + lefWidth + "\"><div><img src=\"./images/bottom_small_left_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"left\"><div><img src=\"./images/bottom_small_left_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td align=\"right\"><div><img src=\"./images/bottom_small_right_corn_02.gif\" alt=\"\" /></div></td>"
    			+ "\n		<td style=\"" + rightWidth + "\"><div><img src=\"./images/bottom_small_right_corn_01.gif\" alt=\"\" /></div></td>"
    			+ "\n	</tr>"
    			+ "</table>"
    			+ "";
		}
	}
}

function over(img) { img.src = img.src.replace('.gif', '_on.gif'); }
function out(img) { img.src = img.src.replace('_on.gif', '.gif'); }

