//
// corners.js
//var pageRoot = "/pc/";
var pageRoot = "/";
var width = 20;
var height= 20;

function topCorners(img) {
	// Write the top left and right corners
	corners(img, "TL,TR");
}

function bottomCorners(img) {
	// Write the bottom left and right corners
	corners(img, "BL,BR");
}

function corners(img, corners) {
	// Create rounded corners as specified
	var border = parseInt(img.substring(0,3));
	img = pageRoot + "img/corners/" + img.replace(' ', '_');
	
	// IE is weird with the positioning sometimes...
	var ie = (navigator.appVersion.indexOf('MSIE') > -1);
	if(!border || isNaN(border)) border = 1;
	var fudgel = 3;
	var fudger = border * 3 + (border - 1);

	// Position each corner
	var r = "";
	if(corners.indexOf("TL") > -1) {
		var style = "float: left; ";
		if(ie) style += "position: relative; left: -" + fudgel + "px; ";
  		r += '<img src="' + img + '_tl.gif" height="' + height + '" width="'+ width + '" style="' + style + '" />';
	}
	if(corners.indexOf("TR") > -1) {
		var style = "float: right; ";
		if(ie) style += "position: relative; left: " + fudger + "px; ";
  		r += '<img src="' + img + '_tr.gif" height="' + height + '" width="'+ width + '" style="' + style + '" />';
	}	
	if(corners.indexOf("BL") > -1) {
		var style = "float: left; position: relative; top: -" + height + "px; ";
		if(ie) style += "left: -" + fudgel + "px; ";
		r += '<img src="' + img + '_bl.gif" height="' + height + '" width="'+ width + '" style="' + style + '" />';
	}
	if(corners.indexOf("BR") > -1) {
		var style = "float: right; position: relative; top: -" + height + "px; ";
		if(ie) style += "left: " + fudger + "px; ";
		r += '<img src="' + img + '_br.gif" height="' + height + '" width="'+ width + '" style="' + style + '" />';
	}
	
	document.write(r);
}