	function get_cookie ( cookie_name )
        {
          var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

          if ( results )
            return ( unescape ( results[2] ) );
          else
            return null;
        }

$( document ).ready( function(){
	$('.field')
		.focus(function(){
			if ( $(this).attr('value') == $(this).attr('title') ) {
				$(this).attr({ 'value': '' })
			}
		})
		.blur(function(){
			if ( $(this).attr('value') == '' ) {
				$(this).attr({ 'value': $(this).attr('title') })
			}
			
		})
		
	
	var opt=get_cookie ( "node" );

	if(opt==null)
	    document.cookie = "node=opened";
    else
    {
        if(opt=="opened")
        {
           // _open_menu();
            //return false;
        }
        else
        {
           // _close_menu();
            //return false;
        }
    }

	$('.open-menu').click(function(){
		_open_menu();
		

		return false;
	});
	
	$('.close-menu').click(function(){
		_close_menu();
	
				
		return false;
	});
	
//			 var leftCol = $.cookie('leftCol');
//    // Set the user's selection for the menu
//    if (leftCol == 'opened') {
//	_open_menu();
//		return false;
//    }
//    if (leftCol == 'closed') {
//	_close_menu();
//	return false;
//    }

	
	
	window.setInterval(function(){
		var num = $('.img-slider a').length;
		_index++;
		if( _index == num ) _index = 0;
		_show_slide('.img-slider a', _index );
	},4000);
	
	_show_slide('.img-slider a', 0);
	
	
	$('.tabbed a').click(function(){
		var id = $(this).attr('title') + '-content';
		
		$('.tabs-content').hide();
		$('#'+id).show();
		
		$(this).parent().find('a').removeClass('active');
		$(this).addClass('active');
		
		return false;
	});
});

var _index=0;

function _open_menu() {
	    document.cookie = "node=opened";
	    //alert("hi");
	$('.open-menu').hide();
	$('#quick-bar').show().css({'overflow':'visible', 'height':'0'}).animate({ 'height': '132px' }, function(){ $('.close-menu').fadeIn(); });
}

function _close_menu() {
	//$('#quick-bar').hide();
		//$.cookie('leftCol', 'closed');
    document.cookie = "node=closed";
	$('.close-menu').hide();
	$('#quick-bar').css({'overflow':'hidden'}).animate({ 'height': '0' }, function(){ $('.open-menu').fadeIn(); $('#quick-bar').hide(); });
	//$('.open-menu').show();
}

function _show_slide(selector, index) {
	$(selector).hide();
	$(selector).eq(index).fadeIn('slow');
}