var thisPage = location.href;
var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
var re_product = new RegExp('prods/[0-9]+.html');
var re_productcat = new RegExp('prods/pc[0-9]+.html');
var re_shoppingcart = new RegExp('/basket.zi/');

window.onload=initAll;


function initAll(){


  if (sPath.match(re_shoppingcart)) {

    var pageheader= document.getElementById('shopcartheadline'); 
    var thisTitle = document.title;
    if (thisTitle=="Shopping Cart"){ pageheader.innerText="Shopping Basket";} 

    pageheader.style.color="#4e89d5";
 
    setTheBodyBackground();

    setTheShoppingArea ();

    setTheTableToHoldBasketDetails();
    
    setTheShoppingFooter();

  }  
  document.getElementById('mainbody').style.display='block';
}




function setTheBodyBackground() {
    var theBody = document.getElementsByTagName('body')[0]; 
    theBody.style.background="url('https://www.zinestudio.co.uk/transformation/assets/sty_pgbodyback.jpg') left top";
    theBody.style.backgroundRepeat="repeat-x"; 
    theBody.style.textAlign="center";
}

function setTheShoppingArea() {
    //set the td class maincontent
    var shoppingarea = document.getElementById('mainbody').getElementsByTagName('td')[0];
    shoppingarea.style.width="944px";
    shoppingarea.style.background="url('https://www.zinestudio.co.uk/transformation/images/temp_shoppingbackground.gif') repeat";
    //shoppingarea.style.border="1px solid red";
}

function setTheTableToHoldBasketDetails() {
    //set the div holds the table for shopping
    var shoppingdiv = document.getElementById('mainbody').getElementsByTagName('div')[0];
    shoppingdiv.style.width="900px";
    shoppingdiv.style.background="#ffffff";
    //shoppingdiv.style.border="1px solid yellow";
    shoppingdiv.style.marginLeft="auto";
    shoppingdiv.style.marginRight="auto";
    shoppingdiv.style.marginLeft="5px";
}

function setTheShoppingFooter() {
    //Set the footer on the shopping pages
    var shoppingFooter = document.getElementById('footerpanel');
    shoppingFooter.style.backgroundImage="url('https://www.zinestudio.co.uk/transformation/assets/sty_footback.jpg')";
}
