//top menu
jQuery(document).ready(function(){
jQuery(" .main_menu ul ").css({display: "none"}); // Opera Fix
jQuery(" .main_menu li ").hover(function(){
    jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn('3000');
    },function(){
    jQuery(this).find('ul:first').css({visibility: "hidden"});
    });   
});

jQuery(function() {
	jQuery(".slider").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		visible: 4
	});
});
// equal height
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = jQuery(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}
jQuery(document).ready(function($) {
    equalHeight(jQuery(".category"));
});
//comment
jQuery(document).ready(function () {
	jQuery('#commentform input, #commentform textarea').each(function () {
		if (jQuery(this).val() == '') {
			jQuery(this).val(jQuery(this).attr('defaultvalue'));
		}
	}).focus(function () {
		jQuery(this).removeClass('inputerror');
		if (jQuery(this).val() == jQuery(this).attr('defaultvalue')) {
			jQuery(this).val('');
		}
	}).blur(function () {
		if (jQuery(this).val() == '') {
			jQuery(this).val(jQuery(this).attr('defaultvalue'));
		}
	});
	jQuery('#commentform').submit(function () {
		jQuery('#submiterror').remove();
		var errors = 0;
		jQuery(this).find('textarea, input').each(function () {
			if (jQuery(this).val() == jQuery(this).attr('defaultvalue')) {
				jQuery(this).val('');
			}
			if (jQuery(this).hasClass('required') && jQuery(this).val() == '') {
				jQuery(this).addClass('inputerror');
				errors++;
			}
		});

		if (errors > 0) {
			jQuery(this).find('textarea, input').each(function () {
				if (jQuery(this).val() == '') {
					jQuery(this).val(jQuery(this).attr('defaultvalue'));
				}
			});
			jQuery(this).prepend('<div id="submiterror">Please complete the highlighted fields.</div>');
			return false;
		}
		return true;
	});
});

