$(document).ready(function(){
	$(".CMSListMenuUL > li").mouseenter(function() {	
		if($(this).children('div').hasClass('flyout-wrapper')){		
			$(this).addClass('active');
			$(this).children('.flyout-wrapper').show();
			var selectedItem = $('#menuElem li.active');
			$(this).css('background-image', 'none');
			$(this).next('li').css('background-image', 'none');
			$(this).next('li').children('a').css('padding-left','10px')
			if($(this).children('a').hasClass('last')){
				$('li a.last').css('background', 'url(../images/main-nav-separator.gif) no-repeat scroll right 2px #fff');
				$('li a.last').css('padding-right','10px')
			}
		}
	});
	
	$(".CMSListMenuUL li").mouseleave(function() {
		$(this).removeClass('active');
		$(this).children('.flyout-wrapper').hide();
		$(this).next('li').removeAttr('style');
		$(this).removeAttr('style');
		$(this).next('li').children().first().removeAttr('style');
		if($('.main-nav > li').children('a').hasClass('last')){
			$('li a.last').removeAttr('style');
		}
	});
});


$(function(){
	$("a.lightbox").colorbox({opacity: 0.4, close: "Schliessen", open: true});
});

$(document).ready(function() {
    //$("input#plc_lt_zoneSearch_SearchBox_txtWord").DefaultValue("Suchbegriff");
    $("input#plc_lt_zoneSearch_SearchBox_txtWord").DefaultValue($("input#plc_lt_zoneSearch_SearchBox_txtWord").val());
    $("input#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_SearchBox_txtWord").DefaultValue($("input#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_SearchBox_txtWord").val());
});

//Clears DefaultValue of a Inputfield
jQuery.fn.DefaultValue = function() {
	// Scope
	var elements = this;
	var args = arguments;
	var c = 0;
	
	return(
		elements.each(function() {				
		
			var el = $(this);
			var def = args[c++];
			el.val(def).focus(function() {
				if(el.val() == def) {
					el.val("");
				}
				el.blur(function() {
					if(el.val() == "") {
						el.val(def);
					}
				});
			});
		})
	);
};

// submit with return key
//$(document).ready(function() {
//    $(".content").each(function() {
//        // find button
//        var btn = $('BUTTON', $(this));
//        alert(btn.attr('id'));
//        // find textfields
//        $("INPUT:text", $(this)).each(function() {
//            $(this).keypress(function(event) {
//                if (event.keyCode == '13') {
//                    btn.click();
//                    event.preventDefault();
//                    return false;
//                }
//            });
//        });
//    });
//});


$(document).ready(function() {
    $(".content INPUT:text", $(this)).each(function() {
        $(this).keypress(function(event) {
            if (event.keyCode == '13') {
                $('.FormButton').click();
                event.preventDefault();
                return false;
            }
        });
    });

    $(".searchBox INPUT:text").keypress(function(event) {
        if (event.keyCode == '13') {
            $('INPUT:image').click();
            event.preventDefault();
            return false;
        }
    });
});


// set focus in forms
$(document).ready(function() {
//    $("input#plc_lt_zoneSearch_SearchBox_btnImageButton").focus();
//    $("input#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneText_BizForm_viewBiz_ctl00_btnOK").focus();
//    $("input#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneNewsLetter_BizForm_viewBiz_ctl00_btnOK").focus();
});

	




