function doResize(){
	$('#commentWrapper').css("left", $('#rightContent').offset().left + "px");	
}

$(window).resize(doResize);

$(document).ready(function () {

  doResize();

$("div.featuredWork").click(
	function(event)
	{
		event.preventDefault();
    	window.location = jQuery("a", this).attr("href");
	});

	$("div.featuredWork").mouseover(
		function(event)
		{
			event.preventDefault();
									
			$("h2 a", this).stop(true, true).animate({color:"#cd7e32"}, 300);
			//$(this).stop(true, true).animate({backgroundColor:"#f7f7f7"}, 300);
		});

	$("div.featuredWork").mouseleave(
		function(event)
		{
			event.preventDefault();
	    	$("h2 a", this).stop(true, true).animate({color:'#343434'}, 300);
			//$(this).stop(true, true).animate({backgroundColor:"#fffff"}, 300);
		});



	 $("div.featuredWorkSm").click(
		function(event)
		{
			event.preventDefault();
	    	window.location = jQuery("a", this).attr("href");
		});

		$("div.featuredWorkSm").mouseover(
			function(event)
			{
				event.preventDefault();
		    	//$("h2 a", this).css("color","#cd7e32");
				$("h2 a", this).stop(true, true).animate({color:"#cd7e32"}, 300);
			});

		$("div.featuredWorkSm").mouseleave(
			function(event)
			{
				event.preventDefault();
		    	//$("h2 a", this).css("color","#343434");
				$("h2 a", this).stop(true, true).animate({color:'#343434'}, 300);
			});




  try{
  	var top = $('#comment').offset().top - parseFloat($('#comment').css('marginTop').replace(/auto/, 0)); 
  	var numThumbs = $('.scroll').length;

	$(window).scroll(function (event) {
	    // what the y position of the scroll is
	    var y = $(this).scrollTop();
	    var bottom = $('#shot' + numThumbs).offset().top;

		if(DetectIphone() || DetectIpod() || DetectIpad()){
			return;
		}

		if(jQuery.browser.msie && jQuery.browser.version == "6.0"){
			return;
		}

	    if (y >= top && y < bottom) {
	    	$('#comment').addClass('fixed');
			$('#comment').css("top", "0px");
			if($('#commentNav').css('opacity') == 0){
				$('#commentNav').css("display", "block");
				$('#commentNav').css("visibility", "visible");
				$('#commentNav').animate({opacity:1}, 300);
			}
	    } 
		else if(y < top){
			$('#comment').removeClass('fixed');
			if($('#commentNav').css('opacity') == 1){
				$('#commentNav').css("display", "none");
				$('#commentNav').css("visibility", "hidden");
				$('#commentNav').animate({opacity:0}, 0);
			}
		}
		else if(y >= bottom){
			$('#comment').removeClass('fixed');
			$('#comment').css("top", (bottom - 234) + "px");
		}


	  });
	
  }
  catch(e){
	//alert(e)
	}


  


});
