function expand(id) {
  var elem = document.getElementById(id);
  if (elem) {
    var interior = document.getElementById('id_interior');
    if (elem.style.display != 'none') {
      var width = interior.style.width;
      interior.style.width = '200px'; // mozilla hack
      interior.style.visibility='hidden';
      elem.style.display = 'none';
      interior.style.width = width;
      interior.style.visibility='visible';
    } else {
      var width = interior.style.width;
      interior.style.visibility='hidden';
      interior.style.width = '200px'; // mozilla hack
      elem.style.display = '';
      interior.style.width = width;
      interior.style.visibility='visible';
    }
  }
}

function get_cookie( name )
{
  var all_cookies = document.cookie;
  var pos = all_cookies.indexOf(name);
  if (pos >= 0) {
    if (pos != 1) {
      var start = pos + name.length + 1;
      var end = all_cookies.indexOf(";", start);
      if (end == -1) {
        end = all_cookies.length;
      }
      var value = all_cookies.substring(start, end);
      return unescape(value);
    }
  }

  return "";
}

function delete_cookie( cookie_name )
{
    var d = new Date();
    document.cookie = cookie_name + "=mitcheljh;expires=" + d.toGMTString() + ";path=/" + ";";

}


function set_content_height()
{
  if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
    var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
    var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
  }
  if (ieversion != 6) {
    return;
  }

  var contentDiv = document.getElementById('id_interior_content');
  // hack for blog
  if (document.body.id == 'id_body_blogindex') {
    contentDiv = document.getElementById('content');
  }

  var height = contentDiv.offsetHeight; // - 17;
  height = Math.max(height, 400) + 'px';
  var leftBorder = document.getElementById('id_interior_left');
  var rightBorder = document.getElementById('id_interior_right');
  leftBorder.style.height = height;
  rightBorder.style.height = height;
  return;
  // min width
  if (document.body.clientWidth < 1000) {
    document.body.style.width = 1000;
  }
}




function applyCornerShadows(group)
{
  //return;
  $.divsurround.setImagePath('/common/images/shadow');

  // header
  if (group == 'index') {
    $('#header').divsurround({
      imagePrefix: 'header',
      sides: '25 25 25 25',
      deflate: '30 15 8 15',
    });

    $('#toplink').divsurround({
      imagePrefix: 'toplink',
      sides: '0 11 8 11',
      deflate: '0 1 0 1',
      corners: {bottomleft: [11,8], bottomright: [11,8]},
      exclude: ['top', 'topleft', 'topright']
    });

    $('#id_interior').divsurround({
      imagePrefix: 'topfold',
      sides: '0 11 8 11',
      deflate: '0 1 0 1',
      corners: {bottomleft: [11,8], bottomright: [11,8]},
      exclude: ['top', 'topleft', 'topright'],
    });

    $('#wts').divsurround({
      imagePrefix: 'wts',
      sides: '0 11 8 11',
      deflate: '0 1 0 1',
      corners: {bottomleft: [11,8], bottomright: [11,8]},
      exclude: ['top', 'topleft', 'topright']
    });

    $('#footer').divsurround({
      imagePrefix: 'footer',
      sides: '0 11 0 11',
      deflate: '0 1 0 1',
      exclude: ['top', 'bottom', 'topleft', 'topright', 'bottomleft', 'bottomright'],
      substitute: {left: 'toplink', right: 'toplink'}
    });

    $('#post_footer').divsurround({
      imagePrefix: 'post-footer',
      sides: '0 25 25 25',
      deflate: '0 15 15 15',
      exclude: ['top', 'topleft', 'topright', 'left', 'right']
    });

    $('#testimonials-top').divsurround({
      imagePrefix: 'testimonials',
      sides: '25 25 0 25',
      deflate: '15 15 0 15',
      exclude: ['left', 'bottomleft', 'bottom', 'bottomright', 'right']
    });

    $('#testimonials').divsurround({
      imagePrefix: 'testimonials',
      sides: '0 11 0 11',
      deflate: '0 1 0 1',
      exclude: ['bottomleft', 'bottom', 'bottomright', 'topleft', 'topright']
    });

    $('#testimonials-bottom').divsurround({
      imagePrefix: 'testimonials',
      sides: '25 0 25 25',
      deflate: '0 15 15 15',
      exclude: ['left', 'topleft', 'topright', 'right', 'top']
    });
  } else if (group == 'general') {
    $('#header').divsurround({
      imagePrefix: 'header',
      sides: '25 25 8 25',
      deflate: '30 15 8 15',
      corners: { bottomleft: [25,8], bottomright: [25,8]}
    });

    $('#toplink').divsurround({
      imagePrefix: 'toplink',
      sides: '0 11 8 11',
      deflate: '0 1 0 1',
      corners: {bottomleft: [11,8], bottomright: [11,8]},
      exclude: ['top', 'topleft', 'topright']
    });

    $('#id_interior').divsurround({
      imagePrefix: 'topfold',
      sides: '0 11 8 11',
      deflate: '0 1 0 1',
      corners: {bottomleft: [11,8], bottomright: [11,8]},
      exclude: ['top', 'topleft', 'topright'],
      substitute: { bottomleft: 'toplink', bottomright: 'toplink'}
    });

    $('#footer').divsurround({
      imagePrefix: 'footer',
      sides: '0 11 0 11',
      deflate: '0 1 0 1',
      exclude: ['top', 'bottom', 'topleft', 'topright', 'bottomleft', 'bottomright'],
      substitute: {left: 'toplink', right: 'toplink'}
    });

    $('#post_footer').divsurround({
      imagePrefix: 'post-footer',
      sides: '0 25 25 25',
      deflate: '0 15 15 15',
      exclude: ['top', 'topleft', 'topright', 'left', 'right']
    });

    $('#testimonials-top').divsurround({
      imagePrefix: 'testimonials',
      sides: '25 25 0 25',
      deflate: '15 15 0 15',
      exclude: ['left', 'bottomleft', 'bottom', 'bottomright', 'right']
    });

    $('#testimonials').divsurround({
      imagePrefix: 'testimonials',
      sides: '0 11 0 11',
      deflate: '0 1 0 1',
      exclude: ['bottomleft', 'bottom', 'bottomright', 'topleft', 'topright']
    });

    $('#testimonials-bottom').divsurround({
      imagePrefix: 'testimonials',
      sides: '25 0 25 25',
      deflate: '0 15 15 15',
      exclude: ['left', 'topleft', 'topright', 'right', 'top']
    });
  }
}


// preload common images
img0 = new Image(1,8000);
img0.src = '/common/images/body-gradient.png';
img1 = new Image(400, 150);
img1.src = '/common/images/logo.png';
img2 = new Image(1,200);
img2.src = '/common/images/header-gradient.png';
//img4 = new Image(393, 216);
//img4.src = '/common/images/blueStopwatchWatermark.png';
img5 = new Image(1,50);
img5.src = '/common/images/toplink-gradient.png';



// corners and sides
htopleft = new Image(25,25);
htopleft.src = '/common/images/shadow/header-top-left.png';
htop = new Image(1, 25);
htop.src = '/common/images/shadow/header-top.png';
htopright = new Image(25,25);
htopright.src = '/common/images/shadow/header-top-right.png';
hright = new Image(25,1);
hright.src = '/common/images/shadow/header-right.png';
hbotright = new Image(25,25);
hbotright.src = '/common/images/shadow/header-bottom-right.png';
hbotleft = new Image(25,25);
hbotleft.src = '/common/images/shadow/header-bottom-left.png';
hleft = new Image(25,1);
hleft.src = '/common/images/shadow/header-left.png';

tlright = new Image(25,1);
tlright.src = '/common/images/shadow/toplink-right.png';
tlbotright = new Image(25,25);
tlbotright.src = '/common/images/shadow/toplink-bottom-right.png';
tlbotleft = new Image(25,25);
tlbotleft.src = '/common/images/shadow/toplink-bottom-left.png';
tlleft = new Image(25,1);
tlleft.src = '/common/images/shadow/toplink-left.png';


pfright = new Image(25,1);
pfright.src = '/common/images/shadow/post-footer-right.png';
pfbotright = new Image(25,25);
pfright.src = '/common/images/shadow/post-footer-bottom-right.png';
pfbottom = new Image(1,25);
pfbottom.src = '/common/images/shadow/post-footer-bottom.png';
pfbotleft = new Image(25,25);
pfbotleft.src = '/common/images/shadow/post-footer-bottom-left.png';
pfleft = new Image(25,1);
pfleft.src = '/common/images/shadow/post-footer-left.png';

testtopleft = new Image(25,25);
testtopleft.src = '/common/images/shadow/testimonials-top-left.png';
testtop = new Image(1,25);
testtop.src = '/common/images/shadow/tesimonials-top.png';
testtopright = new Image(25,25);
testtopright.src = '/common/images/shadow/testimonials-top-right.png';
testright = new Image(25,1);
testright.src = '/common/images/shadow/testimonials-right.png';
testbotright = new Image(25,25);
testbotright.src = '/common/images/shadow/testimonials-bottom-right.png';
testbottom = new Image(1, 25);
testbottom.src = '/common/images/shadow/testimonials-bottom.png';
testbotleft = new Image(25,25);
testbotleft.src = '/common/images/shadow/testimonials-bottom-left.png';
testleft = new Image(25,1);
testleft.src = '/common/images/shadow/testimonials-left.png';

img15 = new Image(15, 45);
img15.src = '/menu_sidebar/images/menu_topLeft.png';
img16 = new Image(1, 45);
img16.src = '/menu_sidebar/images/menu_topCenter.png';
img17 = new Image(15, 45);
img17.src = '/menu_sidebar/images/menu_topRight.png';
img18 = new Image(20, 40);
img18.src = '/menu_sidebar/images/menu_bottomRight.png';
img19 = new Image(1, 40);
img19.src = '/menu_sidebar/images/menu_bottomCenter.png';
img20 = new Image(15, 40);
img20.src = '/menu_sidebar/images/menu_bottomLeft.png';



