var isVizMenu = false;
var isVizEvents = false;
var isVizCommunity = false;
var isVizAccolades = false;

$(document).ready(function(){ 

	$('#myDiv1').css( { backgroundColor: 'transparent' } );
	$('#myDiv11').css( { backgroundColor: 'transparent' } );
	$('#myDiv12').css( { backgroundColor: 'transparent' } );
	$('#myDiv13').css( { backgroundColor: 'transparent' } );

	var o = $('#myMenuA');
	var off = o.offset();
	
	var o1 = $('#myEventsA');
	var off1 = o1.offset();
	
	var o2 = $('#myCommunityA');
	var off2 = o2.offset();
	
	var o3 = $('#myAccoladesA');
	var off3 = o3.offset();
	
	$('<div style="width:200px; height:40px; margin-left:35px; xborder:1px solid blue; background:transparent;" id="myDiv2"></div>').appendTo('#myDiv1');
	$('<div style="width:200px; height:40px; margin-left:27px; xborder:1px solid blue; background:transparent;" id="myDiv21"></div>').appendTo('#myDiv11');
	$('<div style="width:200px; height:40px; margin-left:10px; xborder:1px solid blue; background:transparent;" id="myDiv22"></div>').appendTo('#myDiv12');	
	$('<div style="width:200px; height:40px; margin-left:0px; xborder:1px solid blue; background:transparent;" id="myDiv23"></div>').appendTo('#myDiv13');
	$('#myDiv2').css( { width: o.width(), height: o.height() } );
	$('#myDiv21').css( { width: o1.width(), height: o1.height() } );
	$('#myDiv22').css( { width: o2.width(), height: o2.height() } );
	$('#myDiv23').css( { width: o3.width(), height: o3.height() } );

	$('#myDivMenu').css({ marginLeft: 37, marginTop: 52 - o.height(), width: o.width(), height: o.height(), zIndex: 400, cursor: 'pointer', position: 'absolute' });
	$('#myDivEvents').css({ marginLeft: 118, marginTop: 52 - o1.height(), width: o1.width(), height: o1.height(), zIndex: 400, cursor: 'pointer', position: 'absolute' });
	$('#myDivCommunity').css({ marginLeft: 450, marginTop: 52 - o2.height(), width: o2.width(), height: o2.height(), zIndex: 400, cursor: 'pointer', position: 'absolute' });
	$('#myDivAccolades').css({ marginLeft: 290, marginTop: 52 - o3.height(), width: o3.width(), height: o3.height(), zIndex: 400, cursor: 'pointer', position: 'absolute' });

	setInterval(function(){
		if ($('#myDivInner').css('visibility')!="hidden" && !isVizMenu){
			$('#myMenuLi').trigger('mouseover');
			isVizMenu = true;
		}
		if ($('#myDivInner').css('display')=="none" && isVizMenu){
			$('#myMenuLi').trigger('mouseout');
			
			isVizMenu = false;
		}
	}, 200);

	setInterval(function(){
		if ($('#myDivInner1').css('visibility')!="hidden" && !isVizEvents){
			$('#myEventsLi').trigger('mouseover');
			isVizEvents = true;
		}
		if ($('#myDivInner1').css('display')=="none" && isVizEvents){
			$('#myEventsLi').trigger('mouseout');
			
			isVizEvents = false;
		}
	}, 200);

	setInterval(function(){
		if ($('#myDivInner2').css('visibility')!="hidden" && !isVizCommunity){
			$('#myCommunityLi').trigger('mouseover');
			isVizCommunity = true;
		}
		if ($('#myDivInner2').css('display')=="none" && isVizCommunity){
			$('#myCommunityLi').trigger('mouseout');
			
			isVizCommunity = false;
		}
	}, 200);
	
	setInterval(function(){
		if ($('#myDivInner3').css('visibility')!="hidden" && !isVizAccolades){
			$('#myAccoladesLi').trigger('mouseover');
			isVizAccolades = true;
		}
		if ($('#myDivInner3').css('display')=="none" && isVizAccolades){
			$('#myAccoladesLi').trigger('mouseout');
			
			isVizAccolades = false;
		}
	}, 200);
	
}); 