if (typeof popkong       == 'undefined') popkong       = function() {}
if (typeof popkong.utils == 'undefined') popkong.utils = new function() {
	/**
	 * returns the parameter passed via a CSS class.  For example, for an element
	 *
	 * <div class="pop-carousel slideWidth350px">
	 * popkong.utils.getCssParam($(".pop-carousel"), "slideWidth") will return "350px"
	 */
	this.getCssParam = function(jqObj, param) {
		var classes = jqObj.attr("class").split(" ");
		for(var i = 0; i < classes.length; i++) {
			if (classes[i].indexOf(param) == 0) {
				return classes[i].substring(param.length, classes[i].length);
			}
		}
	};

	/**
	 * given a pixel value (e.g. 100px), strips the 'px' returning '100'
	 * 
	 */
	this.stripPixels = function(s) {
		return s.substring(0, s.length - 2);
	};
	
	this.determinePageWidth = function() {
		if (typeof popkong.theme == 'undefined' || typeof popkong.theme.pageWidth == 'undefined') {
			// not using PopKong theme.  return 100% of the window width.
			return jQuery(window).width();
		} else if (popkong.theme.pageWidth.indexOf("px") > 0) {
			return popkong.utils.stripPixels(popkong.theme.pageWidth);
		} else if (popkong.theme.pageWidth.indexOf("%") > 0) {
			var percentAsDecimal = popkong.theme.pageWidth.substring(0, popkong.theme.pageWidth.length - 1) / 100;
			return jQuery(window).width() * percentAsDecimal;
		} else {
			// this should never happen
			return "980";
		}
	};
};


