$(document).ready(function(){

	$("#top-nav li:has(ul)").addClass("root").find("a:first").addClass("sub");
	
	$("#top-nav li.root").hover(function () {
		$(this).children('ul:hidden').slideDown(500); 
	
		},function(){
			$(this).children('ul:visible').slideUp(500);
    	}
    );
	
$("#slidetabs").tabs("#slider .images > div.item", {effect: 'fade', rotate: true, fadeOutSpeed: "slow", fadeInSpeed: "slow"}).slideshow({autoplay: true, clickable: false, interval: 4000});

$("#carrousel .scrollable").scrollable({ circular: true}).autoscroll({interval: 5000});	
	
$("div.scrollable").scrollable({size: 4});
$(".items img").click(function() { 
 
    var url = $(this).attr("rel");
    var wrap = $("#image-wrapper").fadeTo("medium", 0.5); 
    var img = new Image(); 
    img.onload = function() { 
        wrap.fadeTo("fast", 1); 
        wrap.find("img").attr("src", url); 
 
    }; 
    img.src = url; 
	
}).filter(":first").click();

	$('input[type="text"]').focus(function() {
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    $('input[type="text"]').blur(function() {
        if (this.value == ''){
        	this.value = this.defaultValue;
    	}
    });
	
});
