$(document).ready(function() {
    hs.graphicsDir = '/javascripts/highslide/graphics/';
    hs.registerOverlay({
thumbnailId: 'twipl',
html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
position: 'top right',
fade: 2 // fading the semi-transparent overlay looks bad in IE
}); 


$('.project-overlay').mouseover(function(){
	$(this).find('.project_text').show();
});
$('.project-overlay').mouseout(function(){
	$(this).find('.project_text').hide();
});
$('.panel_twi').click(function(){
    var stream = $(this).attr('stream');
    $('#show-' + stream).trigger('click');
    if(!$(this).hasClass('open'))
    {
      $(this).addClass('open');
  	  $('.twi_form_pos').animate({top: getBodyScrollTop()+70+'px', left: '600px'}, 500);
	} else {
	  $(this).removeClass('open');
	  $('.twi_form_pos a.close').click();
	}
});
$(window).scroll(function(){
//console.log(document.body.)
  if(getBodyScrollTop() < document.documentElement.offsetHeight-700)
	$('.twi_form_pos').stop().animate({'top': getBodyScrollTop()+70+'px'});
});

});

function getBodyScrollTop()
{
  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
