// JavaScript Document
// Replaces the Merchandise category link with the Home link on Merch pages.
$(document).ready(function() {
$("[id*='spanBreadcrumbRoot']").replaceWith('<span id="ctl00_ctl00_Content_Content_spanBreadcrumbRoot"><a id="ctl00_ctl00_Content_Content_lnkBreadcrumbRoot" href="http://www.uwbookstore.com/home.aspx">Home</a>&nbsp;&gt;</span>');
});

//Adds the Cart info to the cart dropdown menu (jQuery fired)
$(document).ready(function() {
$("[id*='pnlHorz']").appendTo("#mySearch");

// Get cart values //
var cartSubTotal = $('#dvCart span[id*=lblCartTotal]').text();
var cartItemCount = $('#dvCart span[id*=lblCount]').text();
// Append to div#myCart //
$('div#myCart').html('<p>Total Items In Cart: <span>' + cartItemCount + '</span></p><p>Sub Total: <span>' + cartSubTotal + '</span></p>');

});

// Changes the default nav buttons on the merchandise pages.
$(document).ready(function(){
// Change inline background color style of MerchList nav button row //
$('table [id*=dgMerch] tr').add('table [id*=dgBooks] tr').css('background-color','white');
// Swap default MerchList page nav buttons with custom images //
$('input[alt="<<"]').attr("src","SiteImages/11-SchoolImages/11-newSite/11-button_first.png");
$('input[alt="<"]').attr("src","SiteImages/11-SchoolImages/11-newSite/11-button_prev.png");
$('input[alt=">"]').attr("src","SiteImages/11-SchoolImages/11-newSite/11-button_next.png");
$('input[alt=">>"]').attr("src","SiteImages/11-SchoolImages/11-newSite/11-button_last.png");
});

// Code makes the login link dynamic.
// If the customer is logged in
// the login link is replaced with a
// Logout/My Account link.
$(document).ready(function() {
// Check if we're already logged in.  If so, replace the //
// "log in" link with the "log out" link, within the     //
// div using the ID "login".                             //
if($('div.AspNet-Menu-Vertical a:contains("Log Out")').length) {
$('div#login').html('<a href="http://www.uwbookstore.com/logout.aspx">Log Out</a> / <a href="http://www.uwbookstore.com/customeraccount.aspx">Account</a>');
}
});
