//ThorneWashington.com Master Javasript//
$(document).ready(function() {
$('.gallery-left-side img, .gallery-right-side img').each(function() {
	$(this).addClass('gallery-image');
  var ratio = 0;  // sets the ratio of the image
  var el = $(this);
  var width = el[0].width; 
  var height = el[0].height;
	if (width > height) {  // this is a landscape photo
	  var maxWidth = 270; // Max width for the image
	  var maxHeight = 162;    // Max height for the image
	  if(width > maxWidth){
	    ratio = maxWidth / width;
	    $(this).css("width", maxWidth);
	    $(this).css("height", height * ratio);
	    return;
	  }
	}
	if (height > width) {  // this is a portrait photo
	  var maxWidth = 120; // Max width for the image
	  var maxHeight = 200;    // Max height for the image
	  if(height > maxHeight){
	  	console.log(height);
	    ratio = maxHeight / height; // get ratio for scaling image
	    $(this).css("width", width * ratio);
	    $(this).css("height", maxHeight);
	    return; 
	  }
  }
});


var newHeight = $('.gallery-right-side').height();
$('.middle-separator').css('height', newHeight+20);


Cufon.replace('h2, .twitter-contact, .blog-entry h3, .sidebar-320-box h3 a, h3.category-page span, h3.gallery-header, h3.contact-header', {hover: true, fontFamily: 'Neuzeit S LT Std' });
if(typeof ActiveXObject == "function" && typeof XMLHttpRequest == "undefined"){
	XMLHttpRequest = function(){
		try {
			return new ActiveXObject('Msxml2.XMLHTTP');
		} catch (e) {
			return new ActiveXObject('Microsoft.XMLHTTP');
		}
	}
}
var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),
i = e.length;
while (i--) {
	document.createElement(e[i])
}
$('.gallery-item').hover(
  function () {
    $(this).addClass("hover");
  },
  function () {
    $(this).removeClass("hover");
  }
);
});
