﻿ $(document).ready(function(){
    var newPhoto01 = new Image();
    newPhoto01.src = 'images/image1.jpg';
    var newPhoto02 = new Image();
    newPhoto02.src = 'images/image2.jpg';
    var newPhoto03 = new Image();
    newPhoto03.src = 'images/image3.jpg';
    var newPhoto04 = new Image();
    newPhoto04.src = 'images/image4.jpg';
    var newPhoto05 = new Image();
    newPhoto05.src = 'images/image5.jpg';
    var newPhoto06 = new Image();
    newPhoto06.src = 'images/image6.jpg';

    var newPhoto07 = new Image();
    newPhoto07.src = 'images/inspiration2.jpg';
    var newPhoto08 = new Image();
    newPhoto08.src = 'images/distressed2.gif';
    var newPhoto09 = new Image();
    newPhoto09.src = 'images/confused2.gif';

    var newPhoto12 = new Image();
    newPhoto12.src = 'images/ssSmall.jpg';
    var newPhoto13 = new Image();
    newPhoto13.src = 'images/rwSmall.jpg';
    var newPhoto14 = new Image();
    newPhoto14.src = 'images/m2mSmall.jpg';
    var newPhoto15 = new Image();
    newPhoto15.src = 'images/uvSmall.jpg';

    $('#imgid01').mouseover(function() {
      $('#imgid07').attr('src', newPhoto07.src);
      $(this).attr('src', newPhoto01.src);
    });

    $('#imgid01').mouseout(function() {
      $(this).attr('src', 'images/image11.jpg');
      $('#imgid07').attr('src', 'images/inspiration1.jpg');
    });

    $('#imgid02').mouseover(function() {
      $('#imgid07').attr('src', newPhoto07.src);
      $(this).attr('src', newPhoto02.src);
    });

    $('#imgid02').mouseout(function() {
      $(this).attr('src', 'images/image21.jpg');
      $('#imgid07').attr('src', 'images/inspiration1.jpg');
    });

    $('#imgid03').mouseover(function() {
      $('#imgid07').attr('src', newPhoto07.src);
      $(this).attr('src', newPhoto03.src);
    });

    $('#imgid03').mouseout(function() {
      $(this).attr('src', 'images/image31.jpg');
      $('#imgid07').attr('src', 'images/inspiration1.jpg');
    });

    $('#imgid04').mouseover(function() {
      $('#imgid07').attr('src', newPhoto07.src);
      $(this).attr('src', newPhoto04.src);
    });

    $('#imgid04').mouseout(function() {
      $(this).attr('src', 'images/image41.jpg');
      $('#imgid07').attr('src', 'images/inspiration1.jpg');
    });

    $('#imgid05').mouseover(function() {
      $('#imgid07').attr('src', newPhoto07.src);
      $(this).attr('src', newPhoto05.src);
    });

    $('#imgid05').mouseout(function() {
      $(this).attr('src', 'images/image51.jpg');
      $('#imgid07').attr('src', 'images/inspiration1.jpg');
    });

    $('#imgid06').mouseover(function() {
      $('#imgid07').attr('src', newPhoto07.src);
      $(this).attr('src', newPhoto06.src);
    });

    $('#imgid06').mouseout(function() {
      $(this).attr('src', 'images/image61.jpg');
      $('#imgid07').attr('src', 'images/inspiration1.jpg');
    });


    
    $('#imgid07').mouseover(function() {
      $(this).attr('src', newPhoto07.src);
    });

    $('#imgid07').mouseout(function() {
      $(this).attr('src', 'images/inspiration1.jpg');
    });

    $('#imgid08').mouseover(function() {
      $(this).attr('src', newPhoto08.src);
    });

    $('#imgid08').mouseout(function() {
      $(this).attr('src', 'images/distressed1.gif');
      $('div.topbanner1 h1 a').css('background-position', 'left top');
    });

    $('#imgid09').mouseover(function() {
      $(this).attr('src', newPhoto09.src);
      $('div.topbanner1 h1 a').css('background-position', 'left bottom');
    });

    $('#imgid09').mouseout(function() {
      $(this).attr('src', 'images/confused1.gif');
      $('div.topbanner1 h1 a').css('background-position', 'left top');
    });

    $('#imgidw01').mouseover(function() {
      $(this).attr('src', newPhoto12.src);
    });

    $('#imgidw01').mouseout(function() {
      $(this).attr('src', 'images/ssSmall_1.jpg');
    });

    $('#imgidw02').mouseover(function() {
      $(this).attr('src', newPhoto13.src);
    });

    $('#imgidw02').mouseout(function() {
      $(this).attr('src', 'images/rwSmall_1.jpg');
    });

    $('#imgidw03').mouseover(function() {
      $(this).attr('src', newPhoto14.src);
    });

    $('#imgidw03').mouseout(function() {
      $(this).attr('src', 'images/m2mSmall_1.jpg');
    });

    $('#imgidw04').mouseover(function() {
      $(this).attr('src', newPhoto15.src);
    });

    $('#imgidw04').mouseout(function() {
      $(this).attr('src', 'images/uvSmall_1.jpg');
    });


    $('#id02').mouseover(function() {
      $('div.topbanner1 h1 a').css('background-position', 'left bottom');
    });

    $('#id02').mouseout(function() {
      $('div.topbanner1 h1 a').css('background-position', 'left top');
    });
    $('#id02').mouseover(function() {
      $('div.topbanner2 h1 a').css('background-position', 'left bottom');
    });

    $('#id02').mouseout(function() {
      $('div.topbanner2 h1 a').css('background-position', 'left top');
    });
    
    $('#id02').mouseover(function() {
      $('div.topbanner3 h1 a').css('background-position', 'left bottom');
    });

    $('#id02').mouseout(function() {
      $('div.topbanner3 h1 a').css('background-position', 'left top');
    });

    $('table.t2 tr:even').addClass('even');

    $('table.t2 tr').mouseover(function() {
      $(this).addClass('highlight');
    });

    $('table.t2 tr').mouseout(function() {
      $(this).removeClass('highlight');
    });
 
 });
/* Function takes an array of div Id's */

function setDivHeights(sArray){
  var arrayDivID = [];

  var iMaxDivHeight = 0;
  var strDivHeight = '';
  var strPaddingTop, strPaddingBottom = '';
  var iPaddingTop, iPaddingBottom = 0;
  
  var i1 = 0;
  for (i1 = 0; i1 < sArray.length; i1++)
       arrayDivID[i1] = sArray[i1];
  /* First find tallest div in array */  
  for (i1 = 0; i1 < sArray.length; i1++){
       if (iMaxDivHeight < document.getElementById(arrayDivID[i1]).offsetHeight)
           iMaxDivHeight = document.getElementById(arrayDivID[i1]).offsetHeight;
      }
      
  for (i1 = 0; i1 < sArray.length; i1++){
       strPaddingTop = strPaddingBottom = '';
       iPaddingTop = iPaddingBotton = 0;
       
        /* The recovered height includes padding get this. This assumes both divs have the same padding */
       if (document.getElementById(arrayDivID[i1]).offsetHeight < iMaxDivHeight){
           /* Firefox does not use currentStyle it uses getComputedStyle, Opera uses both */
           if (document.defaultView && document.defaultView.getComputedStyle){
               strPaddingTop = document.defaultView.getComputedStyle(document.getElementById(arrayDivID[i1]),null).paddingTop;
               strPaddingBottom = document.defaultView.getComputedStyle(document.getElementById(arrayDivID[i1]),null).paddingBottom;
           }
           else{
                /* Opera uses both so would do above, IE and Safari uses this */
                strPaddingTop = document.getElementById(arrayDivID[i1]).currentStyle.paddingTop;
                strPaddingBottom = document.getElementById(arrayDivID[i1]).currentStyle.paddingBottom;
           }
           /* Extract padding from height of tallest div in array */
           iPaddingTop = parseInt(strPaddingTop);
           iPaddingBottom = parseInt(strPaddingBottom);
           iMaxDivHeight -= iPaddingTop;
           iMaxDivHeight -= iPaddingBottom;
           strDivHeight = iMaxDivHeight + 'px';
           document.getElementById(arrayDivID[i1]).style.height = strDivHeight;
          }       
       }
}
/* Function takes an array of div Id's */
function setDivWidths(sArray){
  var arrayDivID = [];

  var iMaxDivWidth = 0;
  var strDivWidth = '';
  var strPaddingRight, strPaddingLeft = '';
  var iPaddingRight, iPaddingLeft = 0;
  
  var i1 = 0;
  for (i1 = 0; i1 < sArray.length; i1++)
       arrayDivID[i1] = sArray[i1];
  
  /* First find widest div in array */  
  for (i1 = 0; i1 < sArray.length; i1++){
       if (iMaxDivWidth < document.getElementById(arrayDivID[i1]).offsetWidth)
           iMaxDivWidth = document.getElementById(arrayDivID[i1]).offsetWidth;
      }
      
  for (i1 = 0; i1 < sArray.length; i1++){
       strPaddingRight = strPaddingLeft = '';
       iPaddingRight = iPaddingBotton = 0;
       
       /* The recovered width includes padding get this. This assumes both divs have the same padding */
       if (document.getElementById(arrayDivID[i1]).offsetWidth < iMaxDivWidth){
           /* Firefox does not use currentStyle it uses getComputedStyle, Opera uses both */
           if (document.defaultView && document.defaultView.getComputedStyle){
               strPaddingRight = document.defaultView.getComputedStyle(document.getElementById(arrayDivID[i1]),null).paddingRight;
               strPaddingLeft = document.defaultView.getComputedStyle(document.getElementById(arrayDivID[i1]),null).paddingLeft;
           }
           else{
                /* Opera uses both so would do above, IE and Safari uses this */
                strPaddingRight = document.getElementById(arrayDivID[i1]).currentStyle.paddingRight;
                strPaddingLeft = document.getElementById(arrayDivID[i1]).currentStyle.paddingLeft;
           }
           /* Extract padding from width of widest div in array */
           iPaddingRight = parseInt(strPaddingRight);
           iPaddingLeft = parseInt(strPaddingLeft);
           iMaxDivWidth -= iPaddingRight;
           iMaxDivWidth -= iPaddingLeft;
           strDivWidth = iMaxDivWidth + 'px';
           document.getElementById(arrayDivID[i1]).style.height = strDivWidth;
          }       
       }
}

var winContent;
function newWindow(newContent, newWin){
   winContent = window.open(newContent, newWin);
   winContent.focus();
   return false;
  }

