// popup functions
function open_popup (ref, url, width, height, scroll, resizable) {
  window.open(url,
              ref,
              "menubar=no, " +
              "toolbar=no, " +
              "status=no, " +
              "location=no" + 
              ((width) ? (", width=" + width) : "") + 
              ((height) ? (", height=" + height) : "") +
              ((scroll) ? ", scrollbars=yes " : ", scrollbars=no") +
              ((resizable) ? ", resizable=yes " : ", resizable=no") 
             );
}

var top_banners = [{image_1 : '/images/random/rdt_1.jpg',
                    image_2 : '/images/random/rdt_2.jpg',
                    colour  : '#e18537',
                    url     : 'http://www.radleys.com/',
                    target  : '_blank'
                   },
                   {image_1 : '/images/random/glass_1.jpg',
                    image_2 : '/images/random/glass_2.jpg',
                    colour  : '#2c110b',
                    url     : '/pages/products/glass_reaction_product.shtml'
                   },
                   {image_1 : '/images/random/heidolph_1.jpg',
                    image_2 : '/images/random/heidolph_2.jpg',
                    colour  : '#999ba8',
                    url     : '/pages/products/heidolph.shtml'
                   },
                   {image_1 : '/images/random/huber_1.jpg',
                    image_2 : '/images/random/huber_2.jpg',
                    colour  : '#0662ae',
                    url     : '/pages/products/huber.shtml'
                   },
                   {image_1 : '/images/random/lara_1.jpg',
                    image_2 : '/images/random/lara_2.jpg',
                    colour  : '#c95f2b',
                    url     : 'http://www.lara-clr.com',
					target  : '_blank'
                   },
                   {image_1 : '/images/random/reaction_1.jpg',
                    image_2 : '/images/random/reaction_2.jpg',
                    colour  : '#c0d9ee',
                    url     : '/pages/products/glass_reaction.shtml'
                   },
                   {image_1 : '/images/random/servicing_1.jpg',
                    image_2 : '/images/random/servicing_2.jpg',
                    colour  : '#3e429a',
                    url     : '/pages/servicing/'
                   }
                  ];

var quotes = [{quote   : '"Bradford is an Eco-versity and the StarFish sits very well with the Universities’ aim of reducing energy and waste. Using only one heat source, as opposed to five, reduces the electrical energy requirement and therefore the carbon footprint and cost of operation. Instead of five individual..." <a href="javascript:starfish_popup();">more..</a>',
               person  : 'Laboratory Manager, Alan Hague<br />School of Life Sciences at the University of Bradford'
              },
              {quote   : '"I liked Reactor-Ready the minute I saw how easy it was to change reactors. Reactor-Ready does it all. I get one stand which fits all sizes up to 5 litres. I get overhead stirring on all scales. I get vacuum jacketed vessels, which provide excellent temperature control with minimum heat loss, which is a real advantage at low temperatures, and I get the ability to rapidly change out my reactors." <a href="javascript:testimonials_popup();">more..</a>',
               person  : 'Lead Scientist, Process R &amp; D'
              },
              {quote   : '"Since I first got my hands on a Radleys Reaction Carousel, I don\t think it left my hands for at least 6 months, and that was only because one of my colleagues was so impressed with it that he wanted to borrow it for a short while. Our small group now has a variety of carousels and over the last 5-6 years, I don\t think there has a day gone by without myself or one of my colleagues using one..." <a href="javascript:bibliography_popup();">more..</a>',
               person  : 'Robert J Dancer, Lundbeck A/S'
              },
              {quote   : '"Our Radleys glass reactor vessels are an important facility, helping to expand Peakdale\'s catalogue and custom synthesis business. We have been impressed with the quality of the reactor vessels which have provided us with a safe, reliable and efficient processing resource."',
               person  : 'Jonathan Moore, Assistant Technical Manager<br>Peakdale Molecular'
              },
              {quote   : '"Our Radleys glass reactor vessels are an important facility, helping to expand Peakdale\'s catalogue and custom synthesis business. We have been impressed with the quality of the reactor vessels which have provided us with a safe, reliable and efficient processing resource."',
               person  : 'Jonathan Moore, Assistant Technical Manager<br>Peakdale Molecular'
              },
              {quote   : '"In the short time using StarFish, we at GSK have found the product flexible, versatile and very easy to set up a wide variety of experiments.  The fact that StarFish can easily be used with a range of stirring hotplates and existing laboratory glassware provides \'added-value\' at GSK."',
               person  : 'Senior Chemist, GSK Harlow'
              },
              {quote   : '"In the short time using StarFish, we at GSK have found the product flexible, versatile and very easy to set up a wide variety of experiments.  The fact that StarFish can easily be used with a range of stirring hotplates and existing laboratory glassware provides \'added-value\' at GSK."',
               person  : 'Senior Chemist, GSK Harlow'
              },
             ];

var top_banners_sorted = new Array;

while (top_banners.length) {
  top_banners_sorted.push(top_banners.splice(Math.random() * top_banners.length, 1)[0]);
}

function display_top () {
  var selected = top_banners_sorted.shift();

  // colour
  var top_cell      = document.getElementById('top_cell');
  var top_cell_left = document.getElementById('top_cell_left');
  top_cell_left.style.backgroundColor =
  top_cell.style.backgroundColor      = selected.colour;

  // images
  var image_1 = document.getElementById('top_image_1');
  image_1.src = selected.image_1;

  var image_2 = document.getElementById('top_image_2');
  image_2.src = selected.image_2;

  // link
  for (var i = 1; i <= 2; i++) {
    var link = document.getElementById('top_link_' + i);

    if (selected.url) {
      link.href = selected.url;

      if (selected.target) {
        link.target = selected.target;
        link.style.cursor = 'pointer';

      } else {
        link.target       = '_self';
        link.style.cursor = 'pointer';
      }

    } else {
      link.href         = '#';
      link.target       = '_self';
      link.style.cursor = 'arrow';
    }
  }

  // quote
  var quote = quotes.shift();
  document.getElementById('top_quote').innerHTML  = quote.quote;
  document.getElementById('top_person').innerHTML = quote.person;

  top_banners_sorted.push(selected);
  quotes.push(quote);

  setTimeout('display_top();', 25000);
}

addLoadEvent(display_top);

function bibliography_popup () {
open_popup ('ref', 'http://www.radleys.com/pages/popup/carousel_reaction_station.html', '350', '410', 'no', 'no')
window.parent.location = 'http://www.radleys.com/pages/bibliography.shtml#testimonials';
}

function testimonials_popup () {
open_popup ('ref', '/pages/testimonials/1.html', 560, 460, true, true)
window.parent.location = '/pages/products/reactor_ready.shtml';
}

function starfish_popup () {
open_popup ('ref', '/pages/testimonials/2.html', 560, 460, true, true);
}