/**
 * **********************************************************************
 * **********************************************************************
 * becks.de/presse website behavior.
 *
 * @author stefan kloiber, <stk@coma.de>
 * @date 2008-08
 *
 * @version 0.10
 *
 *
 * @tested Firefox 3.0.1, IE 6.0.2, Opera 9.5, Safari 3.1.2 (PC)
 * **********************************************************************
 * **********************************************************************
 */


/**
 *
 *
 */
var cf =
{
   /**
	*
	*
	*/
	search :
	{
		defaultValue : "Suchbegriff",
		clearDefault : function(ev)
		{
			if ($(this).val() == cf.search.defaultValue)
			{
				$(this).val('').addClass('active');
			}
			else
			{
			    $(this).addClass('active');
			}
			$(this).blur(function()
			{
				if ($(this).val() == "")
				{
					$(this).val(cf.search.defaultValue).removeClass('active');
				}
			});
		}
	},


   /**
	*
	*
	*/
	select :
	{
        toggleActive : function(ev)
        {
            if ($(this).val() != "0")
            {
                $(this).removeClass('default').addClass('item');
            }
            else
            {
                $(this).removeClass('item').addClass('default');
            }
        }
	},


   /**
	*
	*
	*/
    init : function()
    {
        /* event: focus */
        $('input#pr_filter_search').focus(cf.search.clearDefault);
        $('input#mf_filter_search').focus(cf.search.clearDefault);
        /* event: change selected option */
        $('select').change(cf.select.toggleActive);
    }
};


/**
 * things to do when the dom is available
 */
$(document).ready(function()
{
    // avoid the outline that appears around links upon clicking 
    // them and make them active. used for ie.
    $('a').click(function() { this.blur(); });

	// open link in blank browser window
	$('a[rel="blank"]').click(function() { window.open(this.href); return false; });

	// initiate customized select box
	cf.init();
});

