$(document).ready(function() {
    InitForms();
    InitSearchBoxes();
    InitSearchHelp();
});

function InitForms()
{
    $( "a.submit" ).live( "click", function() {
        $( this ).closest( "form" ).submit();
        return false;
    });
}

function InitSearchBoxes()
{
    var SearchBoxDefault        = "Suchen...";
    var SearchBoxActiveClass    = "active";
    var SearchBoxes             = $( ".searchbox" );

    // Set standard text, if needed
    SearchBoxes.each(function() {
        if( $( this ).val() == "") $( this ).val( SearchBoxDefault );
    });

    // Searchbox get active
    SearchBoxes.focus( function(e) {

        // Set searchbox active
	    $( this ).addClass( SearchBoxActiveClass );

        // Deleting standard text
        if( $( this ).val() == SearchBoxDefault ) $( this ).val( "" );

    });

    // Searchbox get inactive
    SearchBoxes.blur( function( e ){

        // Set searchbox inactive
	    $( this ).removeClass( SearchBoxActiveClass );
        
        // Setting default text if needed
        if( $( this ).val() == "") $( this ).val( SearchBoxDefault );

    });
}

function InitSearchHelp()
{
    var Options = {
        // 'hideOnContentClick': true,
        'overlayColor': '#fff'
    };

    $(".overlay").fancybox(Options);
}

function submitForm(Selector)
{
    $(Selector).submit();
}
