function stripBorder_%POLL-ID%(object) {
	object.each(function() {
			if( parseInt(jQuery(this).width() ) > 0) {
				jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css("border-left-width")) - parseInt(jQuery(this).css("border-right-width")) );
			}
			else {
				jQuery(this).css("border-left-width", '0px');
				jQuery(this).css("border-right-width", '0px');
			}
	});
}
function stripPadding_%POLL-ID%(object) {
	object.each(function() { 
			jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css("padding-left")) - parseInt(jQuery(this).css("padding-left")) );
	});
}

function strip_results_%POLL-ID%() {
        stripPadding_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%") );   
	stripBorder_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%"));
}

jQuery(document).ready(function(e) {
                if(typeof window.strip_results_%POLL-ID% == 'function') 
			strip_results_%POLL-ID%();
    
		if(typeof window.tabulate_answers_%POLL-ID% == 'function') 
			tabulate_answers_%POLL-ID%();
		
		if(typeof window.tabulate_results_%POLL-ID% == 'function') 
			tabulate_results_%POLL-ID%();
		
});

function equalWidth_%POLL-ID%(obj, cols, findWidest ) {
 findWidest  = typeof findWidest  !== 'undefined' ? findWidest  : false;
	if ( findWidest ) {
		obj.each(function() {
				var thisWidth = jQuery(this).width();
				width = parseInt(thisWidth / cols); 
				jQuery(this).width(width);	
				jQuery(this).css('float', 'left');	
		});
	}
	else {
		var widest = 0;
		obj.each(function() {
				var thisWidth = jQuery(this).width();
				if(thisWidth > widest) {
					widest = thisWidth; 
				}	
		});
		width = parseInt( widest / cols); 
		obj.width(width);	
		obj.css('float', 'left');	
	}	
}

function tabulate_answers_%POLL-ID%() {
	equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%"), %ANSWERS-TABULATED-COLS% );
        //equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %ANSWERS-TABULATED-COLS%, true );
}

function tabulate_results_%POLL-ID%() {
	equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%"), %RESULTS-TABULATED-COLS% );
        //equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %RESULTS-TABULATED-COLS%, true );
}
			jQuery(document).ready(function(){
				runOnPollStateChange_%POLL-ID%();
				});

			function runOnPollStateChange_%POLL-ID%() {};