$(document).ready(function(){

// init menu and buttons
if (!$.browser.msie) { 
  init_menu_and_buttons();
}

// ae
$('a.ht').click(function(){
  $('#children').slideUp();
  $('#ajax').fadeOut('fast');
  $('.loading').fadeIn('slow');
  doSend('/aesthetic/groups/'+$(this).attr('rel'), '', $('#ajax'), $('.loading'));
});

$('#fff_click2').click(function(){
 document.location.href="/contest/about";   
});

// init hidden text
$('a.ht2').click(function(){
    
});

$('a.ht2').live('click', function(){
  var title = $(this).html();
  var msg = $(this).next().html();
  $.popup.show(title, msg); 
});

// lightbox
$('a.preview').live('mouseover', function(){
  $('a.preview').fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'easingIn' : 'easeOutBack',
				'easingOut' : 'easeInBack',
				'overlayShow'	:	true,
				'autoScale'			: true,
				'titleShow'		: false
			});

});
// init user forms
$('#user_submit').live('click', function(){
    
    //$('#admin_loading').fadeIn();
    $('#user_form').ajaxSubmit({ 
    target: '#content',
    type: 'post', 
    success: function() { 
        //$('#admin_loading').hide();
        $('#content').fadeIn('fast');
        return false; 
    } 
   }); 
});


});

// --------------------------------------------------------------------------------------------------
          
// ajax routines
function doSend(url, data, target, bar)
{
  $.ajax({
       type: 'POST',
       cache: true,
       url: url,
       dataType: 'html',
       data: data,
       ajaxSend : function() { },
       success: function(response){
       bar.hide();
       target.html(response);
       target.fadeIn('fast');
      }
   });
}

function init_menu_and_buttons() {
  if ($('.menu-item')) {
  $('.menu-item, .admin-button-html, .para > a').mouseover(function(){
    $(this).fadeTo('fast', 0.50);
  }).mouseout(function(){
    $(this).fadeTo('fast', 1.0);
  });
 }
}


