$(document).ready(function()
{
	$("a[rel='lightbox']").colorbox();
    
    $('.innerfade').innerfade({
		speed: 750,
		timeout: 5000,
		type: 'random'
	});
    
    $(".validateForm").validate({
        errorPlacement: function(error, element) {
			error.prependTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
    });
    
    $leftHeight = parseInt($('#left').height());
    $rightHeight = parseInt($('#right').height());
    
    if ($leftHeight > $rightHeight)
    {
        $swirlHeight = $leftHeight;
    }
    else
    {
        $swirlHeight = $rightHeight + 20;
    }

    if ($leftHeight < $swirlHeight)
    {
        $('#left').height($swirlHeight);
    }

    $('#swirl').css('top', $swirlHeight + 300);
    $('#contentContainer').height($swirlHeight + 157)
    
    $('.submenu ul').each(function()
    {
        $width = 0;
        $(this).children('li').each(function()
        {
            if ($width < $(this).children('a').width())
            {
                $width = $(this).children('a').width();
            }
            
        });
        $(this).children('li').width($width + 17);
        $(this).children('li').children('a').css('display', 'block');
    });
});

function reloadCaptcha()
{
	document.getElementById('captcha').src = document.getElementById('captcha').src+ '?' +new Date();
}
