jQuery(function($) {
	// fields
	$('.blink').live('focus', function(){
		if( $(this).val() == $(this).attr('title') ) {
			$(this).val('');
		}
	}).live('blur', function(){
		if( $(this).val() == '' ) {
			$(this).val( $(this).attr('title') );
		}
	});
		
	// dd
	$('#navigation .shell > ul > li').hover(function() {
		$(this).find('> ul').stop(true, true).slideDown();
		$(this).find('a:eq(0)').addClass('hover');
	}, function() {
		$(this).find('> ul').stop(true, true).slideUp();
		$(this).find('a:eq(0)').removeClass('hover');
	});
	
	$('#navigation ul, .f-nav, .b-nav').each(function() {
		$(this).children('li:last').addClass('last');
	});
	
	$('.events li:last').addClass('last');
	
	if($.browser.msie && $.browser.version.substr(0,1) == 6) {
		DD_belatedPNG.fix('#navigation, .socials img, .box-white, .btn-blue, .btn-blue2, .btn-green, .btn-black, .newsletter .button, .signup .btn-gray, .boxes2 h2 img');
	}
	
	var login_boxes = ['admin-login', 'affiliate-login', 'advertiser-login'];
	for (var i = login_boxes.length - 1; i >= 0; i--){
		$("#box-" + login_boxes[i]).appendTo('.menu .menu-item-' + login_boxes[i]);
	};
	
	$('#navigation .login a').click(function() {
		var box = $(this).parent().find('.box-login');
		if (!box.is(':visible')) {
			box.fadeIn("fast");
			$(this).parent().addClass('current_page_item');
		} else {
			box.fadeOut("fast");
			$(this).parent().removeClass('current_page_item');
		}
		return false;
	});
	
	$('.recent img').removeAttr('height');
	
	$('.box-get .ginput_container input, .box-get .ginput_container textarea').each(function() {
		$(this).attr('title', $(this).val());
		$(this).addClass('blink');
	});
	
	$('a.fancybox').fancybox();
	
	$('a.fancybox-iframe').fancybox({
		'type':'iframe'
	});
	
	$('#navigation ul li').each(function() {
		if ($(this).find('ul').length) {
			$(this).find('ul').append('<div class="shadow"></div>');
		}
	});
	
	$('.boxes').each(function() {
		if (!$(this).find('div:not(.cl)').length) {
			$(this).remove();
		}
	});
});

