function replaceChar(str) {
	var m_strOut = new String(str);       
        m_strOut = m_strOut.replace(/[^0-9]|/g, ''); 
        return m_strOut;

}
function returnNumber(pass_str) {
	str = pass_str.replace(/\s/g, ""); 
        var parts = new Array();
		if(str.indexOf('$') == 0) {
                        parts = str.split('\.',2);
		}
		else{
			parts = str.split(',');
		}
		return parseFloat(replaceChar(parts[0]) + '.' + replaceChar(parts[1]));

}       
function hideRadios() {
        var radios = jQuery('.radio-button-js');
        radios.each(function(index) {
                var div_id = jQuery(this).attr('id');
                var prodId = jQuery('#product_addtocart_form .no-display [name|="product"]').val();
                var priceSelector = '#product-price-'+prodId+'_clone';
                var priceBefore = jQuery(priceSelector).text();
                var price_prod = returnNumber(priceBefore);
                var price_ranges = div_id.split(':');
                var price_start = price_ranges[1];
                var price_end = price_ranges[2];
                if(price_prod < price_start || price_prod > price_end){
                        jQuery(this).hide();
			jQuery(this).find(':input').attr('checked', false);
		}
                else{
                        jQuery(this).show();
		}
        });
}
jQuery(document).ready(function() {
        hideRadios();
});

