function initTopMenu(){
	var topMenu = $('#nav2');	
	if(!topMenu.length) return;
	
	var liLevel1 = $('#nav2 > li');
	var lastOver = null;
	var lastSubOver = null;
	var isLastOver = false;
	var timeOut = null;
	liLevel1.each(function(){
		var li = $(this);
		li.mouseover(function(event){
			window.clearTimeout(timeOut);
			
			isLastOver = true;
			if(lastSubOver){
				if(lastSubOver.attr('tagName')!='DIV'){
					lastSubOver.css('display', 'none');			
				}else{
					lastSubOver.children('ul').css('display', 'none');			
				}
			}
			lastOver = $(this);
			lastSubOver = lastOver.children('ul');
			if(lastSubOver.length){				
				lastSubOver.css('display', 'block');
			}else{				
				lastSubOver = lastOver.children('div');
				lastSubOver.css('position', 'absolute');
				lastSubOver.css('top', li.position().top + liLevel1.height() + 'px');
				
				if((lastSubOver.children('ul').width() + li.position().left) + ($(window).width() - 1024)/2> $(window).width()){
					lastSubOver.css('left', li.position().left - (lastSubOver.children('ul').width() - li.width()) + 27 + 'px');
				}else{								
					lastSubOver.css('left', li.position().left + 'px');
				}			
				lastSubOver.children('ul').css('display', 'block');
			}
			event.stopPropagation();
		});
		li.mouseout(function(event){
			isLastOver = false;	
			timeOut = window.setTimeout(function(){
				if(!isLastOver){					
					if(lastSubOver.attr('tagName') != 'DIV'){
						lastSubOver.css('display', 'none');
						lastSubOver = null;
					}else{
						lastSubOver.children('ul').css('display', 'none');
						lastSubOver = null;
					}
				}
			}, 200);
			event.stopPropagation();
		});
	});	
}


$(document).ready(function(){
	//initTopMenu();
	
	$.fn.createLayer.defaults = {
		progress: true,
		center: true,
		opacity: 0.7,
		bg: '#000',
		index: 99999
	}	
	
	$('#popupelite').createLayer({
		addr: '../../popups/PopUp-Audio-OpAssisted-Elite.html',
		opacity: 0.7		
	});	
	
	$('#popupcompare').createLayer({
		addr: '../../popups/compare-conferencecast-types.html',
		opacity: 0.7		
	});
	
	$('#popuprcchart').createLayer({
		addr: '../../popups/PopUp-RCWeb-FeaturesComparisonChart.html',
		opacity: 0.7		
	});
});


