/*
 * Behaviour-Datei zur Vereinfachung von Verhaltensweisen
 * @version: $Id: behavior.js 993 2011-11-10 10:48:02Z dbunpia $
 */

$nolte(document).ready(function() {

	$nolte.each({
		'#main_menu_links > ul > li, #main_menu_map > div, #main_menu_language > div': {
			'mouseenter': function() {
				$nolte(this).addClass('active');
			},
			'mouseleave': function() {
				$nolte(this).removeClass('active');
			}
		},
		'#main_menu_links > ul > li > ul > li, #main_menu_countries ul li, #main_menu_languages ul li': {
			'mouseenter': function() {
				$nolte(this).addClass('active');
			},
			'mouseleave': function() {
				$nolte(this).removeClass('active');
			}
		}
	},function(index1,el1) {
		$nolte.each(el1,function(index2,el2) {
			$nolte(index1).bind(index2,el2);
		});
	});
	
	
	if (! ("placeholder" in document.createElement("input"))) 
	{
		$nolte('*[placeholder]').each(function() 
		{
            var _this = $nolte(this),
            	placeholder = $nolte(this).attr('placeholder');
            
            if ( $nolte(this).val() === '' ) 
            {
            	_this.val( placeholder );
            }
            _this.bind(
            	'focus',
	            function() 
	            {
	                if ($nolte(this).val() === placeholder) 
	                {
	                    this.plchldr = placeholder;
	                    $nolte(this).val('');
	                }
	            }
            );
            _this.bind(
    			'blur',
	            function() {
	                if ($nolte(this).val() === '' && $nolte(this).val() !== this.plchldr) 
	                {
	                	$nolte(this).val( this.plchldr );
	                }
	            }
        	);
        });
		
		$nolte('form').bind(
        	'submit',
	        function() {
        		$nolte(this).find('*[placeholder]').each(function() {
	                if ( $nolte(this).val() === $nolte(this).attr('placeholder') ) 
	                {
	                	$nolte(this).val('');
	                }
	            });
	        }
        );
    }
});
