// Function to Expand FAQ Divs - AT 4-19-2011
$(document).ready(function()
{
  //hide the all of the element with class faq_body
  $(".faq_body").hide();
  //toggle the componenet with class faq_body
  $(".faq_header").click(function()
  {
    $(this).next(".faq_body").slideToggle(300);
  });
});


// Function to Expand Comment Div - AT 5-09-2011
$(document).ready(function()
{
  //hide the all of the element with class faq_body
  $(".comment_form").hide();
  //toggle the componenet with class faq_body
  $(".comment_right").click(function()
  {
    $(this).next(".comment_form").slideToggle(300);
  });
});

// COMMENTS FUNCTION
function BxLinks(ndx) {
  var tmp = ''
  for (var i=0; i<3; i++) {
    tmp = 'div'+(i+1);  
    document.getElementById(tmp).style.display = 'none';
  }
  tmp = 'div'+ndx;
  var w = document.getElementById(tmp);
  if (w.style.display == "none") { w.style.display = "block"; }
  return false;
} 
function InitBxLinks() {
  document.getElementById('div1').style.display = 'block';
}

document.getElementByI

// SHOW/HIDE DIV FOR COLUMNS FILTER
function colLinks(ndx) {
  var tmp = ''
  for (var i=0; i<7; i++) {
    tmp = 'dmc_Column'+(i+1);  
    document.getElementById(tmp).style.display = 'none';
  }
  tmp = 'dmc_Column'+ndx;
  var w = document.getElementById(tmp);
  if (w.style.display == "none") { w.style.display = "block"; }
  return false;
}

$(document).ready(function(){
  
  
  /*if ($('.crop').height > '150px'){
    //get the width of the parent  
    var parent_height = $('.crop').parent().parent().height();    
    //get the width of the image  
    var image_height = $('.crop').height();  
		    //calculate how far from top the image should be  
    var top_margin = (parent_height - image_height)/2;  
    //and change the margin-top css attribute of the image  
    $('.crop').css( 'margin-top' , top_margin);
  }
  else {
    var height = $('.crop').parent().parent().height();
    alert(height);
    $('.crop').height(height);
  }*/
  $('.crop').each(function(index){
    var ratio = ($(this).width())/($(this).height());
    var trueratio = ($(this).parent().parent().width())/($(this).parent().parent().height());
    if (ratio < trueratio){
      var width = $(this).parent().parent().width();
      $(this).width(width);
      var parent_height = $(this).parent().parent().height();    
      var image_height = $(this).height();  
      var top_margin = (parent_height - image_height)/2;  
      //and change the margin-top css attribute of the image  
      $(this).css( 'margin-top' , top_margin);
      }
    else if (ratio > trueratio){
      var height = $(this).parent().parent().height();
      $(this).height(height);
      var parent_width = $(this).parent().parent().width();    
      var image_width = $(this).width();  
      var left_margin = (parent_width - image_width)/2;  
      //and change the margin-top css attribute of the image  
      $(this).css( 'margin-left' , left_margin);
    }
    else {
      var height = $(this).parent().parent().height();
      var width = $(this).parent().parent().width();
      $(this).width(width);
      $(this).height(height);
    }
  });
});  
