$j(document).ready(function() { 
 	$j('ul.dd-menu').ddmenu();
	$j(".autoheight .content, .autoheight .content").autoheight();
	
	// menu
	$j("ul.dropdown li").hover(function() {
	    var SubTopRightMargin = $j('.sub-top-left', this).width() + 30 + "px"; // sub top right
	    $j('.sub-top-right', this).css('margin-left', SubTopRightMargin);
	    
	    var SubBotRightMargin = $j('.sub-bot-left', this).width() + 10 + "px"; // sub bot right
	    $j('.sub-bot-right', this).css('margin-left', SubBotRightMargin);
	    
	    $j('.submenu .top', this).autoheight(); // autoheight
	    $j('.submenu .bot', this).autoheight(); // autoheight
	    
        $j('ul.dropdown .sub-top-right > li:not(.title), ul.dropdown .sub-bot-left > li:not(.title)').css({ width: '120px' });

	    $j(this).children('a').andSelf().addClass("hover"); 
	    $j('div.submenu', this).css('visibility', 'visible');
	}, function() {
	    $j(this).children('a').andSelf().removeClass("hover");
	    $j('div.submenu', this).css('visibility', 'hidden');
	});
	if (window.opera) {
   		$j("#login-popup-background").css('z-index',20000);
   		$j("#reason-popup-background").css('z-index',20000);
		$j("#register-popup-background").css('z-index',20000);
		$j("#menu ul.dropdown").css('z-index',1);
	}	
    /* Unable to find a matching skin */
    
    documentLoaded = true;
    $j('#menu ul.dropdown > li').addClass('direct-child');
    $j('#menu ul.dropdown > li > a').addClass('direct-child');
    $j('#menu .platform > li > a').addClass('direct-child');
    $j('#menu .section > li > a').addClass('direct-child');
}); 
	
Event.observe(window,"load",function() {
  $$("a.tooltip").findAll(function(node) {
        return node.readAttribute('title');
    }).each(function(node) {
        new Tooltip(node,node.title);
        node.writeAttribute("title", '');
    });
    $$('a[rel="external"]').each(function(link){
        if(link.getAttribute('href') != '' && link.getAttribute('href') != '#'){
           link.setAttribute('target','_blank');
        }
	});
});
    


