$(function()
{
	$("#body").hide();	
	$("#info").hide();
	$("#reel").hide();
});

window.onload = function()
{
	$('#works a').addClass('grid');
	$("#body").show();	
	$("#info").show();
	$("#reel").show();
};


function getWindowHeight()
{ 
	var windowHeight = 0; 
	if (typeof(window.innerHeight) == 'number')
	{ 
		windowHeight = window.innerHeight; 
	} 
	else
	{ 
		if (document.documentElement && document.documentElement.clientHeight) 
		{ 
			windowHeight = document.documentElement.clientHeight; 
		} 
		else
		{ 
			if (document.body && document.body.clientHeight)
			{ 
				 windowHeight = document.body.clientHeight; 
			} 
		} 
	} 
	return windowHeight; 
} 

function setHeight()
{
	var windowHeight = getWindowHeight();
	document.getElementById('info').style.height = windowHeight+'px';
	document.getElementById('reel').style.height = windowHeight+'px';
}

$(function() {setHeight();});
window.onresize = function() {setHeight();}

$(document).ready(function(){
  $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target 
      || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body')
        .animate({scrollTop: targetOffset}, 500);
       return false;
      }
    }
  });
});

function tns()
{
for (i=68; i>=1; i--)
	if (i<=9)
		{
			document.write ("<div class=\'tn\' style=\'background-image: url(img/0"+i+"_tn.jpg);\'><a href=\'img/0"+i+".jpg\'><img src=\'img/0"+i+"_tn.jpg\' alt=\'\'/></a></div>");
		}
	else
		{
			document.write ("<div class=\'tn\' style=\'background-image: url(img/"+i+"_tn.jpg);\'><a href=\'img/"+i+".jpg\'><img src=\'img/"+i+"_tn.jpg\' alt=\'\' /></a></div>");
		}
};

$(function()
{
	$("#menu").draggable({ revert: true, revertDuration: 2500 });
	$("#contacts").draggable({ revert: true, revertDuration: 2500 });
});

$(function() {$('#works a').lightBox();});

$(function()
{
	$("#menu_works").click(function()
	{
		$('#menu_works').addClass('active');
		$('#menu_info').removeClass('active');
		$('#menu_reel').removeClass('active');
	});
});	

$(function()
{
	$("#menu_info").click(function()
	{
		$('#menu_works').removeClass('active');
		$('#menu_info').addClass('active');
		$('#menu_reel').removeClass('active');
	});
});

$(function()
{
	$("#menu_reel").click(function()
	{
		$('#menu_works').removeClass('active');
		$('#menu_info').removeClass('active');
		$('#menu_reel').addClass('active');
	});
});