document.write('<style type="text/css">.portfolio, .portfolio-content {display:none;}</style>');

$(document).ready(function() {
		
		$( '.portfolio' ).fadeIn("slow");
		$( '.portfolio-content' ).fadeIn("slow");
    $('a.external').attr('target', '_blank');    
								
    $('#form_handler').val('ajax');
								
  if($('.file-ajax-form').ajaxForm)
	{
								
								$('.file-ajax-form').ajaxForm(function(retval){
											if(retval) {
																$('#error').show();
																$('#form *').removeClass("error");
																$.each(retval.split(","), function(index, value) {
																	if(value) $('#' + value).addClass("error");
																});
												
																if ($.browser.opera) {
																	//Wenn Browser Opera
																	var target = 'html';
																}else{
																	//Wenn der Browser NICHT Opera
																	var target = 'html,body';
																}
												
																$(target).animate({ scrollTop: $('#error').offset().top }, 500 , function (){});
															} else {
																$('#error').hide();
																$('#form').hide();
																$('#BewerbungIntro').hide();
																$('#thxMessage').show();
															}				
								$("#form-loading").hide();	
								});											
	}
	
	// bind 'myForm' and provide a simple callback function
	$('.ajax-form').submit(function(e){
		e.preventDefault();
		
		var frm = $(this);
		
		$.ajax({
				type: 'POST',
				url: frm.attr('action'),
				data: frm.serialize(),
				enctype: 'application/x-www-form-urlencoded',
				success: function(retval) {
						if(retval) {
							$('#error').show();
							$('#form *').removeClass("error");
							$.each(retval.split(","), function(index, value) {
								if(value) $('#' + value).addClass("error");
							});
			
							if ($.browser.opera) {
								//Wenn Browser Opera
								var target = 'html';
							}else{
								//Wenn der Browser NICHT Opera
								var target = 'html,body';
							}
			
							$(target).animate({ scrollTop: $('#error').offset().top }, 500 , function (){});
						} else {
							$('#error').hide();
							$('#form').hide();
							$('#BewerbungIntro').hide();
							$('#thxMessage').show();
						}
				},
				complete: function(){
								$("#form-loading").hide();
				}
		});
	});
		
				$("#form-loading").ajaxStart(function(){
								$(this).show();
				});		
	
	if($('#Position')) $('#Position').bind("change", function(event) {
		// Standard Verhalten unterdrücken
		event.preventDefault();
		if($(this).val() == "Initiativ") {
			$('#StellennameBlock').show();
		} else {
			$('#StellennameBlock').hide();
		}
	});
			
});
	

(function($){

    $.fn.me1 = function(){
        
        var o = {
            fadeSpeed : 600,
            subTimeout : null
        }
	  var arrow = $('.arrow');
        
        o = jQuery.extend(o);
        
        return $(this).each(function() {
            
            var lis = $(this).children('li');
            
            lis.children('a').hover(
                function() {
                    
                    $(this).siblings('.levelSub').stop(true, true).slideDown(o.fadeSpeed);
                },
                function() {
                }
            );
            
            lis.hover(
                
                function() {
                   $(this).children('.levelSub').css('display', 'none');
			 arrow.fadeIn();
                },
                function() {
                    $(this).children('.levelSub:hidden').css('display', 'block');
	              $(this).children('.levelSub').stop(true, true).slideUp(o.fadeSpeed);
			  arrow.fadeOut();
                }
            );
     
        });
    }
    
})(jQuery)


$(document).ready(function() {
		// Alle internen Links auswählen
		$('.top a[href*=#], .nextItem a[href*=#], .more a[href*=#], a.more[href*=#]' ).bind("click", function(event) {
			// Standard Verhalten unterdrücken
			event.preventDefault();
			// Linkziel in Variable schreiben
			var ziel = $(this).attr("href");
			//Browserweiche
			if ($.browser.opera) {
                    //Wenn Browser Opera
					var target = 'html';
                }else{
					//Wenn der Browser NICHT Opera
                    var target = 'html,body';
                }
			//Scrollen der Seite animieren, body benötigt für Safari
			//Variable für Browserweiche
			//$('html,body').animate({
			$(target).animate({
				//Zum Ziel scrollen (Variable)
				scrollTop: $(ziel).offset().top
			// Dauer der Animation und Callbackfunktion die nach der Animation aufgerufen wird, sie stellt das Standardverhalten wieder her und ergänzt die URL
			}, 1000 , function (){location.hash = ziel;});
	   });
	return false;
	});



