$(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);
    	}
    );

	$('#slider-nav').tabs('#ad-slider > div', {effect: 'fade', fadeOutSpeed: "normal", rotate: true}).slideshow({autoplay: true, clickable: false, interval: 5000});
	
	 $('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;
        }
    });
	
$("#pop[rel]").overlay({

			mask: '#444', 
			
			onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentwrap");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
			
		}});
	
});
