﻿$(document).ready(function(){content_resize();

$(window).resize(content_resize);

$(document).resize(content_resize);

//Caption Sliding (Partially Hidden to Visible)
$('.boxgrid.caption').hover(function(){
$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:150});
}, function() {
$(".cover", this).stop().animate({top:'198px'},{queue:false,duration:250});
});

// Toggles the slickbox on clicking the noted link
$('#slickbox').hide(); 
$('#slick-toggle').click(function() {
$('#slickbox').slideToggle(400);
 return false;
});

$('#slickbox2').hide(); 
$('#slick-toggle2').click(function() {
$('#slickbox2').slideToggle(400);
 return false;
});

$('#slickbox3').hide(); 
$('#slick-toggle3').click(function() {
$('#slickbox3').slideToggle(400);
 return false;
});

$('#slickbox4').hide(); 
$('#slick-toggle4').click(function() {
$('#slickbox4').slideToggle(400);
 return false;
});

$('#slideshow').cycle({fx:'scrollLeft',speed:1000,timeout:6000,easing:'easeOutQuad'});

$("#sitemenu li").hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')});if(document.getElementById('news-page')){var newsItems;var rowCnt;var colCnt=4;var gridH=$(".newscol").height();

$(".newscol").hide();newsItems=new Array();

$(".newscol").each(function(){newsItems.push($(this))});rowCnt=Math.ceil((newsItems.length)/colCnt);

$('#pg-content').css({'height':((gridH*rowCnt)+(rowCnt*30))+'px'});doAnimation(newsItems.shift())}function doAnimation(item){item.fadeIn("fast",function(){if(newsItems.length>0)doAnimation(newsItems.shift())})}if(document.getElementById('content-grid')){var fitems;var rCnt;var cCnt=4;var cH;var gH=$(".grid").height()+40;var gM=16;var nH=65;

$(".grid").hide();fitems=new Array();

$(".grid").each(function(){fitems.push($(this))});rCnt=Math.ceil((fitems.length)/cCnt);cH=((gH*rCnt)+(rCnt*gM))+nH;

$('#content-grid').css({'height':cH+'px'});gridAnimation(fitems.shift())}function gridAnimation(item){item.fadeIn("fast",function(){if(fitems.length>0)gridAnimation(fitems.shift())})}if(document.getElementById('project-page')){$(".grid").hover(function(){$(this).css({'cursor':'pointer'});

$(this).find('img').fadeTo(150,0.5);

$(this).find('h2').stop().animate({'color':'#3d372d'},300)},function(){$(this).find('img').fadeTo(150,1.0);

$(this).find('h2').stop().animate({'color':'#00a99d'},300)});

$(".grid").click(function(){var link=$(this).find('a').attr('href');window.location.href=link})}if(document.getElementById('pg-content')){$(".newscol").hover(function(){$(this).css({'cursor':'pointer'});

$(this).find('img').fadeTo(150,0.5);

$(this).find('h2, h2 a').stop().animate({'color':'#3d372d'},300)},function(){$(this).find('img').fadeTo(150,1.0);

$(this).find('h2, h2 a').stop().animate({'color':'#00a99d'},300)})}if(document.getElementById('blog-sidebar')){$(".togglebox ul").hide();

$(".togglebox h4").hover(function(){$(this).css({'cursor':'pointer'})},function(){});

$(".togglebox h4").click(function(){$(".togglebox ul").toggle()})}if(document.getElementById('comments')){$("#commentform").validate()}function content_resize(){var w=$(window);var H=w.height();var W=w.width();var hdrHeight=$('#header').height();var pgHeight=$('#content').height();var ftrHeight=$('#footer').height();if(document.getElementById('content-grid')){pgHeight=$('#content-grid').height()-40}fPos=(H-((hdrHeight+40)+pgHeight)-ftrHeight);if(document.getElementById('project-gallery')){fPos=fPos-380}if(fPos>0){if(typeof document.body.style.maxHeight!=="undefined"){$('#footer').css({'margin-top':fPos})}}}});



