$(function() 
{
	$('body').delegate(".viewermenuitem", "hover",
		function (event) 
		{
			if($(this).data("workanimate") != "no")
			{
				if(event.type == "mouseenter")
				{
					//$(this).children(".footerwindow").children(".viewermenuitemfooter").stop().animate({'top':'95'}, 300);
					$(this).children(".viewermenuhighlight").stop().fadeTo(300, 1);
				}
				else
				{
					//$(this).children(".footerwindow").children(".viewermenuitemfooter").stop().animate({'top':'146'}, 300);
					$(this).children(".viewermenuhighlight").stop().fadeTo(300, 0);
				}
			}
		}
	);
	
	$('body').delegate(".homemenuitem", "hover",
		function (event) 
		{
			if(event.type == "mouseenter")
			{
				$(this).children(".viewermenuhighlight").stop().fadeTo(300, 1);
			}
			else
			{
				$(this).children(".viewermenuhighlight").stop().fadeTo(300, 0);
			}
		}
	);
	
	$('body').delegate(".btnproject_rollover, .btnhighlights_rollover, .btndemo_rollover", "click",
		function (event) 
		{
			var panel = "";
			
			var current_href = $(location).attr("href");
			
			if(current_href.indexOf("#") != -1)
			{
				// In work.php
				var split = current_href.split("#");
				panel = split[1];
			}
			else
			{
				// Not in work.php
			}
			
			// /work/[client]/view/
			if(panel != "" && _gaq)
			{
				var path = "/work/" + panel + "/view/";
				_gaq.push(["_trackPageview", path]);
			}
		}
	);
});

function getQuerystring(key, default_)
{
  	if (default_==null)
  	{	
  		default_="";
  	}
  	
  	key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  	var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  	var qs = regex.exec(window.location.href);
  	
  	if(qs == null)
  	{
    	return default_;
    }
  	else
  	{
    	return qs[1];
	}
}
