jQuery(function() {
	jQuery('.nav > ul').hover(function() {
	}, function() {
		jQuery('.nav ul > li ul').hide();
		jQuery('.current_page_item ul, .current_page_ancestor ul').show();
	}).children('li').hover(function() {
		jQuery('.nav ul > li ul').hide();
		jQuery(this).addClass('hover').children('ul').css({ 'display':'none', 'left':'26px' }).show();
	}, function() {
		jQuery(this).removeClass('hover');
	});
	
	if (jQuery('#page-home .action').is('div')) {
		liCount = jQuery('#page-home .action ul li').length;
		setInterval('changeMsg()', 5500);
	}
	
	jQuery('#book-quotes li:first-child').addClass('active');
	if (jQuery('#book-quotes').is('ul')) {
		liCount = jQuery('#book-quotes li').length;
		bqHeight = 0;
		jQuery('#book-quotes li').each(function(i) {
			bqHeight = (jQuery(this).height() > bqHeight) ? jQuery(this).height() : bqHeight;
		});
		jQuery('#book-quotes').height(bqHeight);
		setInterval('changeQuote()', 6500);
	}
	
	//jQuery('#page-home .action ul').animate({ backgroundPosition: '0 -251px' }, 2000);
	jQuery('.hotlist tr:even').addClass('even');
	jQuery('.hotlist tr td:even').addClass('col-1');
	jQuery('.hotlist tr td:odd').addClass('col-2');
	jQuery('#cm-name').focus(function() { if (jQuery(this).val() == 'Name') { jQuery(this).val(''); } });
	jQuery('#cm-name').blur(function() { if (jQuery(this).val() == '') { jQuery(this).val('Name'); } });
	jQuery('#cm-xtdkd-xtdkd').focus(function() { if (jQuery(this).val() == 'Email') { jQuery(this).val(''); } });
	jQuery('#cm-xtdkd-xtdkd').blur(function() { if (jQuery(this).val() == '') { jQuery(this).val('Email'); } });
});

function changeMsg() {
	nextLi = ( jQuery('.action ul li').index(jQuery('.active')) == liCount - 1 ) ? jQuery('.action li:first') : jQuery('.action li.active').next();
	nextLi.css({ zIndex:'1', display:'block' });
	jQuery('.action li.active').fadeOut(1000, function() {
		jQuery(this).removeClass('active');
		nextLi.addClass('active').css('z-index','2');
	});
}

function changeQuote() {
	nextLi = ( jQuery('#book-quotes li').index(jQuery('.active')) == liCount - 1 ) ? jQuery('#book-quotes li:first') : jQuery('#book-quotes li.active').next();
	padding = (nextLi.find('.text').css('padding-bottom') != '0px') ? nextLi.find('.text').css('padding-bottom') : bqHeight - nextLi.height() + 'px';
	nextLi.css({ display:'block' }).find('.text').css('padding-bottom', padding);
	jQuery('#book-quotes li.active').fadeOut(500, function() {
		jQuery(this).removeClass('active');
		nextLi.addClass('active');
	});
}