function callLightbox(obj) {
	$(obj).each(function(i){
		var thisImage = $(this).children();
		var mtop = convertToNumber(thisImage.css('marginTop'));
		var mright = convertToNumber(thisImage.css('marginRight')) + 3;
		/*
		var imgHeight =  convertToNumber(thisImage[0].height) - 19;
		if (mtop > 0) {
			imgHeight =  imgHeight - mtop;
		};
		*/
		thisImage.after('<div style="position:absolute; bottom:4px; right:' + mright + 'px; cursor:pointer; cursor:hand;"><img src="/common/images/icon-lightbox.gif" width="16" height="16" alt="" border="0"></div>');
	});
	$(obj).lightBox();
}

function convertToNumber(numIn) {
	var result = 0;
	if (numIn.toString().indexOf('p') > -1) {
		result = parseInt(numIn.substring(0,numIn.indexOf('px')));
	} else {
		result = parseInt(numIn)
	}
	if (isNaN(result)) {
		return 0;
	}
	return result;
}

$(function() {

	// Round Corners
	$("div.roundedCorners").corner("round 6px");

	// Lightbox initiated and icon applied
	callLightbox('a.lightbox');
});
