jQuery(document).ready(function(){
	
	// arrange cart nav in master page
	yourBagLink = '<a href="/cart" id="yourBag">YOUR BAG</a>'
	jQuery(".cartInformation").prepend(yourBagLink);
	
	
	
 // replace text within div class using jQuery textReplace plugin
	jQuery(".staticMiniCart .cartInformation p.itemsInCart").replaceText("item(s) in", "ITEM(S)");
	

	// UB LOOK BOOK
	if(jQuery("body.browse#pageId3005486011").length > 0) {
		// hoverscroll plugin
		// Creating hoverscroll with fixed arrows
		jQuery('#lookBook').hoverscroll({
			arrows: true,
			vertical: true,
			width: 747,
			height: 420,
			arrowsOpacity: 1
		});
	
		var direction = 0,
			speed = 50;
		jQuery("#lookBook")[0].startMoving(direction, speed);
	}
	
	
	//PDP
	if (jQuery("body.detail").length > 0) {
	
		// text replacement
		jQuery("body.detail p.colorMsgLabel").replaceText("Click on a color swatch below", "");
		jQuery("body.detail select#size_dropdown option.normal").replaceText("- Select -", "select size");
		jQuery("body.detail li#quantityBox label").replaceText("Quantity:", "quantity");
		jQuery("body.detail #rightColumn .reviewSummary .averageRating").replaceText("Avg. Customer Rating:", "overall rating");
		jQuery("body.detail div.com-amazon-webstore-ColorSwatches-3 div.colorSwatches div.chooseSwatch strong.label").replaceText("Select", "choose");
		jQuery("body.detail .buyBox ol.formFields li.formField.variationDropdown a.formHelp").replaceText("guide", "chart");
		
		jQuery('iframe#ImageFrame #zoomImageHolder').attr('style', 'border: 1px dotted #cccccc; padding: 10px;');
		
		// rearrange product details
		//		
		jQuery('dl.attributeList.priceBlock').append(jQuery('dt.itemNo'));
		jQuery('dl.attributeList.priceBlock').append(jQuery('dd.itemNo'));
		jQuery('#leftColumn').append(jQuery('.target-amazon-com-target-pagelets-IncaProductAccessoriesWidgetPagelet-1'));
		jQuery('#leftColumn').append(jQuery('.target-amazon-com-target-pagelets-IncaRecentHistoryWidgetPagelet-1'));
		jQuery('#leftColumn ul.productList li.product').attr('style', 'width: 148px;');
		
		// link to different size chart depending on category
		var gender = jQuery('body.detail .com-amazon-webstore-BreadcrumbDetail-2 li').eq(1).text();
		var gender = jQuery.trim(gender);
		
		var thisURL = window.location.href.split("com/"), thisSubPage = thisURL[1];
		
		
		if (/*thisSubPage.indexOf(catHer) != -1 || */gender == 'UB Her') {
			jQuery('ol.formFields li.formField.variationDropdown a.formHelp').attr('href', '/info/sizeGuide');
			
		}
		else 
			if (/*thisSubPage.indexOf(catHim) != -1|| */gender == 'UB Him') {
			
				jQuery('ol.formFields li.formField.variationDropdown a.formHelp').attr('href', '/info/sizeChartHim');
			}
		
		if (jQuery("body#pageIdinfoPress").length > 0) {
			jQuery('.gallery a').lightBox();
			
		}
		
	}	
	
});
