/*
    Prepared by Blue Lab                   www.bluelab.com
    All Rights Are Reserved.

============================================================================================================
Edit Date   Edited By                 Description
----------  ----------------------    ----------------------------------------------------------------------
03312009    kdeluca@bluelab.com       Created.
04232009    kdeluca@bluelab.com       Edited.
05282009    kdeluca@bluelab.com       Edited.
============================================================================================================
*/
/*  window.addEvent('domready', function(){
  });
*/


  window.addEvent('load', function(e){

if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    windowWidth = window.innerWidth;
    windowHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }


      var posContainer = $('divContainer').getSize();
      var divContainerHeight = posContainer.size['y'];

      var posMain = $('divMain').getSize();
      var divMainHeight = posMain.size['y'];

      var posMinHeight = $('divMinHeight').getSize();
      var divMinHeightHeight = posMinHeight.size['y'];

      var tallest = windowHeight;
      if (divMinHeightHeight > tallest) {tallest = divMinHeightHeight;}
      if (divMainHeight > tallest) {tallest = divMainHeight;}
      if (divContainerHeight > tallest) {tallest = divContainerHeight;}

      // alert ('Window Width: ' + windowWidth + '\nWindow Height: ' + windowHeight + '\n__________________________\ndivContainer Height: ' + divContainerHeight + '\ndivMainHeight Height: ' + divMainHeight + '\ndivMinHeight Height: ' + divMinHeightHeight + '\nTallest Height: ' + tallest);

     document.getElementById('divBody').style.height = (tallest) +"px";
     document.getElementById('divFooter').style.top = (tallest) +"px";
     document.getElementById('divSearchContainer').style.left = ((windowWidth/2)+152) +"px";

    // divLeft and divRight Matching Columns Check
    if ($defined($('divRight')) && $defined($('divLeft'))  ) {
        var posFullColumn = $('divLeft').getSize();
        var divLeftHeight = posFullColumn.size['y'];

        var posRightNarrowColumn = $('divRight').getSize();
        var divRightHeight = posRightNarrowColumn.size['y'];

       var matchingLRcolumns = divLeftHeight;
       if (divRightHeight > matchingLRcolumns) {matchingLRcolumns = divRightHeight};

       document.getElementById('divLeft').style.height = (matchingLRcolumns) +"px";
       document.getElementById('divRight').style.height = (matchingLRcolumns) +"px";
    }

    // divR2_left_50p and divR2_right_50p Matching Columns Check
    if ($defined($('divR2_left_50p')) && $defined($('divR2_right_50p'))  ) {
        var posR2_left_50p = $('divR2_left_50p').getSize();
        var divR2_left_50pHeight = posR2_left_50p.size['y'];

        var posR2_right_50p = $('divR2_right_50p').getSize();
        var divR2_right_50pHeight = posR2_right_50p.size['y'];

       var matchingR2columns = divR2_left_50pHeight;
       if (divR2_right_50pHeight > matchingR2columns) {matchingR2columns = divR2_right_50pHeight};

       document.getElementById('divR2_left_50p').style.height = (matchingR2columns) +"px";
       document.getElementById('divR2_right_50p').style.height = (matchingR2columns) +"px";
    }

    // R3_left_1_25p, R3_left_2_25p, R3right_1_25p and R3_right_2_25p Matching Columns Check
    if ($defined($('divR3_left_1_25p')) && $defined($('divR3_left_2_25p')) && $defined($('divR3_right_1_25p')) && $defined($('divR3_right_2_25p'))  ) {
        var posR3_left_1_25p = $('divR3_left_1_25p').getSize();
        var divR3_left_1_25pHeight = posR3_left_1_25p.size['y'];
        var posR3_left_2_25p = $('divR3_left_2_25p').getSize();
        var divR3_left_2_25pHeight = posR3_left_2_25p.size['y'];

        var posR3_right_1_25p = $('divR3_right_1_25p').getSize();
        var divR3_right_1_25pHeight = posR3_right_1_25p.size['y'];
        var posR3_right_2_25p = $('divR3_right_2_25p').getSize();
        var divR3_right_2_25pHeight = posR3_right_2_25p.size['y'];

       var matchingR3columns = divR3_left_1_25pHeight;
       if (divR3_left_2_25pHeight > matchingR3columns) {matchingR3columns = divR3_left_2_25pHeight};
       if (divR3_right_1_25pHeight > matchingR3columns) {matchingR3columns = divR3_right_1_25pHeight};
       if (divR3_right_2_25pHeight > matchingR3columns) {matchingR3columns = divR3_right_2_25pHeight};

       document.getElementById('divR3_left_1_25p').style.height = (matchingR3columns) +"px";
       document.getElementById('divR3_left_2_25p').style.height = (matchingR3columns) +"px";
       document.getElementById('divR3_right_1_25p').style.height = (matchingR3columns) +"px";
       document.getElementById('divR3_right_2_25p').style.height = (matchingR3columns) +"px";
    }

    // R4_left_50p and R4_right_50p Matching Columns Check
    if ($defined($('divR4_left_50p')) && $defined($('divR4_right_50p'))  ) {
        var posR4_left_50p = $('divR4_left_50p').getSize();
        var divR4_left_50pHeight = posR4_left_50p.size['y'];

        var posR4_right_50p = $('divR4_right_50p').getSize();
        var divR4_right_50pHeight = posR4_right_50p.size['y'];

       var matchingR4columns = divR4_left_50pHeight;
       if (divR4_right_50pHeight > matchingR4columns) {matchingR4columns = divR4_right_50pHeight};

       document.getElementById('divR4_left_50p').style.height = (matchingR4columns) +"px";
       document.getElementById('divR4_right_50p').style.height = (matchingR4columns) +"px";
    }

    // R5_left_33p and R5_center33p and R5_right_33p Matching Columns Check
    if ($defined($('divR5_left_33p')) && $defined($('divR5_center_33p')) && $defined($('divR5_right_33p'))  ) {
        var posR5_left_33p = $('divR5_left_33p').getSize();
        var divR5_left_33pHeight = posR5_left_33p.size['y'];

        var posR5_center_33p = $('divR5_center_33p').getSize();
        var divR5_center_33pHeight = posR5_center_33p.size['y'];

        var posR5_right_33p = $('divR5_right_33p').getSize();
        var divR5_right_33pHeight = posR5_right_33p.size['y'];

       var matchingR5columns = divR5_left_33pHeight;
       if (divR5_center_33pHeight > matchingR5columns) {matchingR5columns = divR5_center_33pHeight};
       if (divR5_right_33pHeight > matchingR5columns) {matchingR5columns = divR5_right_33pHeight};

       document.getElementById('divR5_left_33p').style.height = (matchingR5columns) +"px";
       document.getElementById('divR5_center_33p').style.height = (matchingR5columns) +"px";
       document.getElementById('divR5_right_33p').style.height = (matchingR5columns) +"px";
    }


  });



window.addEvent('resize',function(e){
      /*var windowHeight = window.getHeight();
      if (this.ie6) {var windowHeight = document.body.clientHeight;}
      var windowWidth = window.getWidth();
      if (this.ie6) {var windowWidth = document.body.clientWidth;}*/

if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    windowWidth = window.innerWidth;
    windowHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }



      var posContainer = $('divContainer').getSize();
      var divContainerHeight = posContainer.size['y'];

      var posMain = $('divMain').getSize();
      var divMainHeight = posMain.size['y'];

      var posMinHeight = $('divMinHeight').getSize();
      var divMinHeightHeight = posMinHeight.size['y'];

      var tallest = windowHeight;
      if (divMinHeightHeight > tallest) {tallest = divMinHeightHeight;}
      if (divMainHeight > tallest) {tallest = divMainHeight;}
      if (divContainerHeight > tallest) {tallest = divContainerHeight;}

      // alert ('Window Width: ' + windowWidth + '\nWindow Height: ' + windowHeight + '\n__________________________\ndivContainer Height: ' + divContainerHeight + '\ndivMainHeight Height: ' + divMainHeight + '\ndivMinHeight Height: ' + divMinHeightHeight + '\nTallest Height: ' + tallest);

     document.getElementById('divBody').style.height = (tallest) +"px";
     document.getElementById('divFooter').style.top = (tallest) +"px";
     document.getElementById('divSearchContainer').style.left = ((windowWidth/2)+152) +"px";
  });


window.addEvent('domready',function() {
    //smooooooth scrolling enabled
    //new SmoothScroll({ options }, window);
    new SmoothScroll({ duration:700 }, window); //700 milliseconds to get there
});



