//inherit td width into cell children
//non-scrolling tables
 var cellWidth = {
	"cal-film-release":[97, 250, 140, 60, 190, 195],
	
	"all-notes":[698],
		
	"p-awardslist":[80, 206, 202, 178],
	"p-bio-mile":[80, 594],
	"p-bio-family":[100, 150, 150, 196],		
	"p-creditlist":[290, 150, 120, 120],
	"unavailable":[290, 376],
	"p-fin-bolist":[74, 132, 126, 126, 100, 100],
	"p-fin-salary":[74, 132, 132, 132, 88, 100],
	"p-t-cast":[240, 120],
	"p-t-contact":[300, 370],
	"p-t-indev":[230, 110, 90],
	"p-t-proj":[270, 170],

	"proj-credit-all-cat":[245, 430],//2011.4.4
	"proj-fin-bo-weekly":[174, 136, 100, 126, 126],
	"proj-fin-bo-summary":[232, 132, 132, 100, 100],
	"proj-tv-credit-all-cat":[246, 430],//2011.4.4
	"proj-t-proj":[150, 140, 140, 80, 80, 80],
	"proj-t-leads":[110, 100, 230, 230],
	"proj-t-leads":[160, 160, 180, 170],

	"org-creditlist":[317, 202, 152],
	"org-fin-bolist":[80, 132, 123, 124, 100, 100],
	"org-emp":[276, 399],
	"org-t-contact":[685],
	"org-t-proj":[225, 120, 180, 160],
	"org-t-proj-tv":[305, 110, 110, 160],
	
	"tool-production":[100, 120, 310, 200, 105],
	"tool-crew-producer":[445, 200, 190],
	"list-crew-producer":[320, 125],
	"tool-crew-actor":[165, 260, 260, 150],
	"list-crew-cast":[150, 210, 210, 110],
	
	"tool-crew-reps":[270, 150, 275, 150],
	"list-crew-rep":[200, 100, 210, 170],	
	"list-production":[245, 200, 200, 190]		
 };
	
function applyCellWidths(tableName)
{
    if(tableName == null || tableName == "")
    {
		//tbody
	   $.each(cellWidth, function(key, val) {
	     for (var i=0, cl=val.length; i<cl; i++) {
	       $('.' + key + ' tbody td:nth-child(' + (i+1) + ')').width(val[i])
	         .children().css({overflow: 'hidden'}).width(val[i]-9);
	     };
	   });

    }
    else
    {
        applyWidth(tableName, cellWidth[tableName]);
    }
}

function applyWidth(key, value)
{
    for (var i=0, cl=value.length; i<cl; i++) {
        $('.' + key + ' thead th:nth-child(' + (i+1) + ')').width(value[i]);
        $('.' + key + ' tbody td:nth-child(' + (i+1) + ')').width(value[i])
            .children().not("td:last-child").css({overflow: 'hidden'}).width(value[i]-9);
     };
    $("td:last-child").children().css({overflow:'visible'}).width("auto");
}
