/**
 *	This file contains useful utility functions which are used across many
 *	of the web pages within this site.
 *
 *	@author Russell Francis
 */


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18712466-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();




function toggleWorkAreaVisbility()
{
	var workArea = document.getElementById( 'workarea' );
	if ( workArea.style.display == 'none' )
		document.cookie = 'workAreaIsVisible=true;'
		
	else
		document.cookie = 'workAreaIsVisible=false;'
	
	Effect.toggle('workarea','BLIND',{duration: 0});	
}


function setWorkAreaDisplayState()
{
	/*
	if ( getCookieValue( 'workAreaIsVisible' ) == 'true' || !getCookieValue( 'workAreaIsVisible' ) )
	{
		var workArea = document.getElementById( 'workarea' );
		workArea.style.display = 'block';
	}
	*/
}


function showHideEffectParent( effectData )
{
	alert ( effectData.element.parentNode.parentNode )
}


function getCookieValue( name )
{
	var allcookies = document.cookie;
	var pos = allcookies.indexOf( name + "=" );
	if ( pos != -1 )
	{
		var start = pos + ( name.length + 1 );
		var end = allcookies.indexOf( ";", start )
		if ( end == -1 ) end = allcookies.length;
		var value = allcookies.substring( start, end );
		return value;
	}
	
	return null;
}




function registerWorkAreaState() 
{
	alert( 'register state' );
}
