/*
 * @description: This script will search for any div with the specified string in its class attribute.
 * 		It will then attempt to resize the div based on the class name, so for example, if the
 * 		class name is "column pixel_100" the script will resize the div to 100px wide. Possible
 * 		values are "pixel" and "percent", though others could be added.
 * 
 * 		Multiple class names are allowed, but the search string and sizing string must be first,
 * 		like this: <div class="column percent_50 header byline"> ... </div>
 * 
 * @author: Ken Dunnington
 * @date: May 31th, 2007
 * @version: 1.2
 * @requires: jQuery
 * @log: 9/13/07: Simplified div class selector
 */

$(function(){
	var classString = "column";
	
	function getSizeFromClass(className) {
		var args,type,value;
		
		args = className.split(" ")[1]; // Grab the unit_value key at position 1
		type = args.split("_")[0];
		value = args.split("_")[1];
		// console.log("Class: "+className+", Type: "+type+", Value: "+value);
		
		if (type == "pixels") {
			value += "px";
		} else {
			value += "%";
		}
		// console.log("New width: "+value);
		return value;
	}
	
	$("div."+classString).each(function(idx) {
		var newWidth = getSizeFromClass(this.className);
		$(this).width(newWidth);
	})
});