jQuery(document).ready(function(){
	j = jQuery.noConflict();				   

j("div.com-amazon-webstore-SearchNav-2 .miniSearchForm form.searchForm fieldset.minorFieldset.search ol.formFields li.formField.searchFor label").text("Search");
//search
j(".search #center-3 div.com-amazon-webstore-PaginationBottomSearch-2").append(j('div.com-amazon-webstore-PaginationTopSearch-2 p.searchCount'));
j(".search #center-3 div.com-amazon-webstore-PaginationBottomSearch-2").append(j('div.com-amazon-webstore-PaginationTopSearch-2 div.searchOptions div.resultSizeForm'));

j(".browse #center-4 div.com-amazon-webstore-PaginationBottomSearch-2").append(j('div.com-amazon-webstore-PaginationTopBrowse-2 div.searchOptions div.resultSizeForm'));
var thisPage = location.href.substring((location.href.lastIndexOf("/"))+1),
url = window.location.href.split("?")[0],
thisURL = url.split("/"),
thisSubPage = thisURL[3].substring(0,11);

/*if(thisSubPage == "cartPreview")
{
window.location = "/cart";
};
*/

/*if (j(".productDetails h4").length > 0) {
			j(".productDetails h4 a").each(function() {
				truncateText(j(this), 40);
			});
			
		};*/
		
		/* Truncate Text */
		function truncateText (element, length) {
			j(element).each(function() {
				var str = j(this).text();
				var limit = length;
				var bits, i;
				
				bits = str.split('');
				if (bits.length > limit) {
					for (i = bits.length - 1; i > -1; --i) {
					if (i > limit) {
					bits.length = i;
					}
					else if (' ' === bits[i]) {
					bits.length = i;
					break;
					}
					}
					bits.push('...');
				}
				var truncate = bits.join('');
				j(this).text(truncate);
			});
		}

})


