/**
  * Class containing information needed to enforce maximum widths
  * picID = the id specified in the HTML
  * container = the id of the div containing the picture AND whose width is important
  * maxWidth = the maximum number of pixels that the picture width can be
  * ratio = a number between 0 and 1 specifying how much of the container this picture is 
  *  allowed to have
  **/
function PicToResize(picID, container, maxWidth, ratio) {
  this.id = picID;
  this.container = container;
  this.maxWidth = maxWidth;
  this.ratio = ratio;
}
PicToResize.prototype.setWidth = setPicWidth;

function setPicWidth() {
    var image = document.getElementById(this.id);
    var contentdiv = document.getElementById(this.container);
   if (contentdiv.clientWidth * this.ratio > this.maxWidth){
    image.width = this.maxWidth;
   }
   else {
    image.width = contentdiv.clientWidth * this.ratio;
   }
}

function setDivWidths() {
 var image1 = document.getElementById("fasttrack");
 if (image1 != null){
   var image2 = document.getElementById("baudboys");
   var contentdiv = document.getElementById("content");

   if (contentdiv.clientWidth * .7 > 400){
    image1.width = 400;
    image2.width = 400;
   }
   else {
    image1.width = contentdiv.clientWidth * .7;
    image2.width = contentdiv.clientWidth * .7;
   }
   image1 = document.getElementById("frenzy");
   image2 = document.getElementById("sweetgherkin");
   var image3 = document.getElementById("champagne");
   var image4 = document.getElementById("spareparts");
   if (contentdiv.clientWidth*0.4>(300)){
    image1.width = 300;
    image2.width = 300;
    image3.width = 300;
    image4.width = 300;
   }
   else {
    image1.width = contentdiv.clientWidth*0.4;
    image2.width = contentdiv.clientWidth*0.4;
    image3.width = contentdiv.clientWidth*0.4;
    image4.width = contentdiv.clientWidth*0.4;
   }
}

 image1 = document.getElementById("logo");
 image2 = document.getElementById("ajoypic");
 var bannerdiv = document.getElementById("banner");
 if (bannerdiv.clientWidth * .2 >221){
  image1.width = 221;
 }
 else {
  image1.width = bannerdiv.clientWidth * .2 * .99;
 }
 if (bannerdiv.clientWidth * .52 >640){
  image2.width = 640;
 }
 else {
  image2.width = bannerdiv.clientWidth * .52 * .99;
 }

}
 




