jQuery(document).ready(function ($){
	/* Top menu drop down menu */
	jQuery("ul#menu-horizontal > li").hover(
		function () {
			if(typeof(jQuery(this).find('ul.sub-menu').queue())!='undefined' && jQuery(this).find('ul.sub-menu').queue().length<=1)
				jQuery(this).find("ul.sub-menu").slideDown();
		}, 
		function () {
			if(typeof(jQuery(this).find('ul.sub-menu').queue())!='undefined' && jQuery(this).find('ul.sub-menu').queue().length<=2)
				jQuery(this).find("ul.sub-menu").slideUp();
		}
	);
	
	/* Selectboxes */
	jQuery(".search_box").sb({fixedWidth:true, minWidth: 120});
	
	/* Carousel */
	jQuery('.carousel').jcarousel({
    	wrap: 'circular'
    });
	
	/* Fancybox */
	jQuery("a img[class*='wp-image-']").parent().fancybox({
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	jQuery("a.fancybox").fancybox({
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	jQuery("a[rel=group].fancybox").fancybox({
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	/*jQuery('input[type="text"]').addClass("idleField");
	jQuery('input[type="text"]').focus(function() {
		jQuery(this).removeClass("idleField").addClass("focusField");
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    jQuery('input[type="text"]').blur(function() {
    	jQuery(this).removeClass("focusField").addClass("idleField");
        if ($.trim(this.value) == ''){
        	this.value = (this.defaultValue ? this.defaultValue : '');
    	}
    });*/
	jQuery("#searchform").submit(function (){
		if(jQuery("input#search").val() == '')
		{
			jQuery("input#search").val(' ');
		}
		/*if(jQuery("input#search").val() == document.getElementById('search').defaultValue)
		{
			jQuery("input#search").val('');
			//jQuery("input#search").focus();
			//return false;
		}*/
	});
});
