function cba()
	{
		$("a[rel='cba']").colorbox({
		speed: 700,
		opacity : 0.7,
		scrollbars : false,
		photo : false,
		slideshow : false,
		rel : 'nofollow'
	 });
}


function flash_msgbox()
{
	if ( typeof( $('#flash_msgbox .flash_msgbox_content').html() ) == 'string' && $('#flash_msgbox .flash_msgbox_content').html().length > 0 )
	{ 
		$('#flash_msgbox .flash_msgbox_content').colorbox(
		{
			speed: 250,
			opacity : 0.7,
			scrollbars : false,
			photo : false,
			slideshow : false,
			open : true,
			inline : true,
			href : '#flash_msgbox .flash_msgbox_content',
			maxWidth : '500px',
			rel : 'nofollow'
		});
	}
}

/*
function ajaxload(hash)
{
    // do stuff that loads page content based on hash variable
    //alert(hash);
	if ( ! hash && $('#container').hasClass('ajax-loaded') )
		hash = '/';
	
	if ( hash )
	{
		$.ajax({
			url : hash,
			success : function (data)
			{
				$('#content').html(data);
				$('#container').addClass('ajax-loaded');
				//ajax_links();
				init();
			} 
		});
	}
}

function ajax_links()
{
	$('#container a').each(
		function (index)
		{
			//if ( $(this).attr('rel') != 'cba' && $(this).attr('href').substr(0, 1) != '#' && $(this).attr('href').substr(0, 7) != 'http://' && $(this).attr('href').substr(0, 8) != 'https://' )
			if ( ajax_link( $(this) ) && $(this).attr('href').substr(0, 1) != '#' )
				$(this).attr('href', '#' + $(this).attr('href'));
		}
	);
}

function ajax_link(elm)
{
	if ( elm )
	{
		if ( elm.attr('rel') == 'cba' || elm.attr('class') == 'noajax' || elm.attr('href').substr(0, 7) == 'http://' || elm.attr('href').substr(0, 8) == 'https://' )
			return false;

		return true;
	}
}
*/

function init()
{
	/*
	ajax_links();
	
    $("#container a").click(function()
   	{
	   	if ( ajax_link( $(this) ) )
	   	{
        	$.history.load( this.href.replace(/^.*#/, '') );
        	return false;
	   	}
    });
    */
    
	
}

$(function()
{
	//$.history.init( ajaxload );	// This should be in init();
	
	cba();

	flash_msgbox();

	$('#container, #box, #stats, .rc').corner('13px');

	$.validator.setDefaults(
	{
		submitHandler: function()
		{
			$('#cboxLoadedContent form').ajaxSubmit({
				target : '#cboxLoadedContent',
				success : function() { $.fn.colorbox.resize(); }
			});
			
			return false;
		}
	});

	/*
	$('#cboxLoadedContent form input[type=submit], #cboxLoadedContent form button[type=submit]').live("click", function()
	{
		$.fn.colorbox.resize();
		
		$('#cboxLoadedContent form').validate();
		
		$.fn.colorbox.resize();
	});
	*/

	$().bind('cbox_complete', function()
	{
		$('#cboxLoadedContent form').submit(function()
		{
			$('#cboxLoadedContent form').validate();
			$.fn.colorbox.resize();
			return false;
		})
	})
			

	$('#text_search').change(function()
	{
		if ( $(this).val() == '' )
		{
			
		}
	});

	/*
	$('#cboxLoadedContent form input').live("keyup", function()
	{
		$.fn.colorbox.resize();
	});
	*/

	
})