// Start jQuery
$(document).ready(function(){

    // Clear default function
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).val();
            // Textareas don't read val() function from jquery so we use normal js
            if(default_value == ""){
              default_value = this.value;
            }
			$(this).focus(function(){
				if ($(this).val() == default_value) $(this).val("");
			});
			$(this).blur(function(){
				if ($(this).val() == "") $(this).val(default_value);
			});
		});
	};

    $('input.clear-default').clearDefault();
    $('textarea.clear-default').clearDefault();

    // Menu hover function
    /* Activate the javascript to the hover submenu */
    $("#menu li").hover(function(){

        $(this).addClass("current");
        $('ul:first',this).css('display', 'block');

    }, function(){

        $(this).removeClass("current");
        $('ul:first',this).css('display', 'none');

    });

	// Pie function
	$(function() {
    if (window.PIE) {
        $('.rounded').each(function() {
            PIE.attach(this);
        });
    }
	});

});
