document.observe( 'dom:loaded', initSCLayout );

function initSCLayout()
{
//	setupTabs();
	openSocialBar();
}

function setupTabs()
{
	$$( '.tab' ).each( function( el )
	{
		new Control.Tabs( el );
	} );
}

function setCookie( szName, szValue, szExpires, szPath, szDomain, bSecure )
{
 	var szCookieText = escape( szName ) + '=' + escape( szValue );
	
	szCookieText +=	szExpires ? '; EXPIRES=' + szExpires.toGMTString() : '' ;
	szCookieText += szPath ? '; PATH=' + szPath : '';
	szCookieText += szDomain ? '; DOMAIN=' + szDomain : '';
	szCookieText += bSecure ? '; SECURE' : '';
	
	document.cookie = szCookieText;
}

function getCookie( szName )
{
 	var szValue = null;

	if( document.cookie ) {
       	var arr = document.cookie.split( escape( szName ) + '=' );
       	
		if( 2 <= arr.length ) {
           	var arr2 = arr[ 1 ].split( ';' );

       		szValue = unescape( arr2[ 0 ] );
       	}
	}

	return szValue;
}

function openSocialBar()
{
	var sb = $( 'socialBar' );

	if( sb && !getCookie( 'noSocialBar' ))
		sb.show();
}

function closeSocialBar()
{
	$( 'socialBar' ).hide()
	setCookie( 'noSocialBar', 1 );
}

