// JavaScript Document

jQuery.maxZIndex = jQuery.fn.maxZIndex = function(opt) {
    var def = { inc: 10, group: "*" };
    jQuery.extend(def, opt);    
    var zmax = 0;
    jQuery(def.group).each(function() {
        var cur = parseInt(jQuery(this).css('z-index'));
        zmax = cur > zmax ? cur : zmax;
    });
    if (!this.jquery)
        return zmax;

    return this.each(function() {
        zmax += def.inc;
        jQuery(this).css("z-index", zmax);
    });
}


jQuery.noConflict();



jQuery(document).ready(function(){
		
		
		jQuery('a.showpopup').nyroModal();
		
		
		
		
		jQuery.nyroModalSettings({
								 width: 1920,
						height: 1200,
				processHandler: function(settings) {
				var url = settings.url;
				if (url && url.indexOf('http://www.youtube.com/watch?v=') == 0) {
					jQuery.nyroModalSettings({
						type: 'swf',
						height: 355,
						width: 425,
						url: url.replace(new RegExp("watch\\?v=", "i"), 'v/')
					});
				} 
			}
		});
		
		
		
		
		// fade-out-effect for H3-heading in the menu-continaer
		jQuery("#cnt_main-nav h3").prepend("<span></span>");
		// add the menu-toggle-button
		jQuery("#cnt_main-nav").prepend('<span id="menu_toggle"></span>');
		//
		jQuery(".iteminfo,.articleinfo").after('<span class="clr"></span>');
		
		
		jQuery("#nav-1").show();
		jQuery("#nav-2").hide();
		
		var i = 0;
		
		jQuery('#menu_toggle').click(function(){
	
			if (jQuery("#nav-2:first-child").is(":hidden")) {
				
			} else {
				jQuery("#nav-1,#nav-2").slideToggle("slow");
				$(this).toggleClass("move_in");
			}
			

 						
    	});

		jQuery('#nav-top ul:first-child').droppy({speed: 150});
		
	
	jQuery(".contenttoc").mouseenter(function(){
      jQuery(".contenttoc").animate({ 
		height: "200px"
      }, 250 );
    });
	jQuery(".contenttoc").mouseleave(function(){
      jQuery(".contenttoc").animate({ 
		height: "25px"
      }, 250 );
    });	
	
	
	
		
	jQuery('#cnt_main-nav .moduletable_menu .parent').mouseenter(function(){
		jQuery('#cnt_main-nav .moduletable_menu .parent ul').slideDown('medium'); 						
    });
	jQuery('#cnt_main-nav .moduletable_menu .parent').mouseleave(function(){
		jQuery('#cnt_main-nav .moduletable_menu .parent ul').slideUp('medium'); 						
    });
	
	// Position the footer

	pageheight = jQuery(document).height();
	jQuery("#cnt_footer").css('top',pageheight + 50);

	
});
