function html2text(html) {
	html = html.replace(/<br>/gi,'\n');
	
	return(html);
}

jQuery(document).ready(
	function() {
	    $.get("/cart.php", { s: "ajaxtopcartmsg" }, function(data){
	        //alert("Data Loaded: " + data);
	        $(function() { $('#cart_topbar').html(data); });
	    });
	    
    	$( ".StBtn" ).button();
    	
		$('.attr_selector').change(function() {
			var QueryString = '';
			$('.attr_selector').each(function(index) {
				var attr_id = $(this).find(":selected").val();
				if ( attr_id != 'ALL' ) {
					//alert(attr_id);
					if ( QueryString.length ) { QueryString += '.'; }
					QueryString += attr_id;
				}
			});
			var new_location = getPathFromUrl(location.href) + '?attr='+QueryString;
			location.href = new_location;
			//alert(new_location);
		});

	}
);

function getPathFromUrl(url) {
  return url.split("?")[0];
}


