/*
 * File: ajax.js
 * Author: Christopher Hortig, BrandFormers.de (programmierung@brandformers.de)
 * Copyright: 2011
 * Version: 1.0.00
*/

// include function {start}
jQuery.event.remove( window, "load", jQuery.ready );
jQuery.event.add( window, "load", function(){ jQuery.ready(); } );
jQuery.extend({
	includeStates: {},
	include: function(url, callback, dependency){
		if ( typeof callback != 'function' && ! dependency ) {
			dependency = callback;
			callback = null;
		}
		url = url.replace('\n', '');
		jQuery.includeStates[url] = false;
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.onload = function () {
			jQuery.includeStates[url] = true;
			if ( callback )
				callback.call(script);
		};
		script.onreadystatechange = function () {
			if ( this.readyState != "complete" && this.readyState != "loaded" ) return;
			jQuery.includeStates[url] = true;
			if ( callback )
				callback.call(script);
		};
		script.src = url;
		if ( dependency ) {
			if ( dependency.constructor != Array )
				dependency = [dependency];
			setTimeout(function(){
				var valid = true;
				$.each(dependency, function(k, v){
					if (! v() ) {
						valid = false;
						return false;
					}
				})
				if ( valid )
					document.getElementsByTagName('head')[0].appendChild(script);
				else
					setTimeout(arguments.callee, 10);
			}, 10);
		}
		else
			document.getElementsByTagName('head')[0].appendChild(script);
		return function(){
			return jQuery.includeStates[url];
		}
	},
	readyOld: jQuery.ready,
	ready: function () {
		if (jQuery.isReady) return;
		imReady = true;
		$.each(jQuery.includeStates, function(url, state) {
			if (! state)
				return imReady = false;
		});
		if (imReady) {
			jQuery.readyOld.apply(jQuery, arguments);
		} else {
			setTimeout(arguments.callee, 10);
		}
	}
});
//\ {ende}


// include {start}
$.include ("assets/js/mba/contactform.js");
//\ {ende}


// document {start}
$(document).ready(function() {
    
    $('td.navigation ul li').click(function() { 
        $('td.navigation ul li').removeClass('active'); 
        $(this).addClass('active'); 
    });
    
    $('td.navigation>ul>li>ul').hide();
    $('td.navigation>ul>li').hover(
		function (e) {
		  e.preventDefault();
			$(this).find('>ul').stop(true, false).delay(550).height('auto').slideDown(350);
                if ($(this).hasClass('active')) { } else { $(this).addClass('active4'); }
		}, 
		function (e) {
		  e.preventDefault();
			$('ul', this).stop(true, false).slideUp(350);	
                if ($(this).hasClass('active')) { } else { $(this).removeClass('active4'); }
		}
	);
    
});
//\ {ende}
