$(document).ready(function(){
	
	// init tooltip
	$("a.tip[title]").tooltip({ 
		tip: '#tooltip', offset: [0, -50], effect: 'slide' 
		    }).dynamic( { 
		        bottom: { direction: 'down', bounce: true } 
    });
	
	// scroll to top
	$('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
	
	// contact form focus function
	$('input[type="text"], textarea').addClass("idleField");
		$('input[type="text"], textarea').focus(function() {
			$(this).removeClass("idleField").addClass("focusField");
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('input[type="text"], textarea').blur(function() {
			$(this).removeClass("focusField").addClass("idleField");
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
		
	// init Fancybox
	
	$("ul.fancybox li a").fancybox();
	
});
