function mainmenu(){
$("#navigation ul ul ").css({display: "none", "opacity":"1"}); // Opera Fix
$("#navigation ul li").hover(function(){
$(this).addClass('active');
var width = $(this).find('ul:first').width();
$(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
$(this).find('ul:first').find('li').css({"width":width});
},function(){
$(this).removeClass('active');
$(this).find('ul:first').css({visibility: "hidden"});
});
}

$(function() {
	mainmenu();
	
	
	var x =1;
	var slideclass;
	var tabclass;
	var y = 0;
	$('#banner .tabs .tab').click(function() {
		y = 1;
		x = $(this).attr('id');
		slideclass = ".slide"+x;
		$('#banner .slide').fadeOut();
		$(slideclass).fadeIn();
		if(x == 1) { $('#banner .arrow').animate({"left":"135px"}); } else 
		if(x == 2) { $('#banner .arrow').animate({"left":"460px"}); } else 
		if(x == 3) { $('#banner .arrow').animate({"left":"790px"}); } else { $('#banner .arrow').animate({"left":"135px"}); }
		$('#banner .tabs .tab').removeClass('tabactive');
		$(this).addClass('tabactive');
	});
	
	
	setInterval(function() {
	if(y==0) {
		x++;
		if(x == 4) { x = 1; }
		slideclass = ".slide"+x;
		$('#banner .slide').fadeOut();
		$(slideclass).fadeIn();
		if(x == 1) { $('#banner .arrow').animate({"left":"135px"}); } else 
		if(x == 2) { $('#banner .arrow').animate({"left":"460px"}); } else 
		if(x == 3) { $('#banner .arrow').animate({"left":"790px"}); } else { $('#banner .arrow').animate({"left":"135px"}); }		
		tabclass = "#banner .tabs #"+x;
		$('#banner .tabs .tab').removeClass('tabactive');
		$(tabclass).addClass('tabactive');
	}
	}, 4000);
	
	
	$('#sidebar .pagelist li:first').addClass('toph4');
	
	$('#s').focus(function() {
		if($(this).attr("value") == "Search our website") { $(this).attr("value",""); }
	});
	$('#s').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Search our website"); }
	});
	
	// DOTS 
	$('ul.dots li.dot').css({"opacity":"0.2"});
	$('ul.dots li.dot1').css({"opacity":"1.0"});
	
	
	// TABPOSTS //
	$('ul.dots li').css({"opacity":"0.2"});
	$('ul.dots li.dot1').css({"opacity":"1"});
	
	$('.dots li').click(function() {
		$('.dots li').animate({"opacity":"0.2"});
		$(this).animate({"opacity":"1.0"});
		return false;
	});
	
	$('.dots li.dot1').click(function() {
		$('.post1').fadeIn();
		$('.post2').hide();
		$('.post3').hide();
		$('.tagsbox').hide();
	}); 
	
	$('.dots li.dot2').click(function() {
		$('.post2').fadeIn();
		$('.post3').hide();
		$('.post1').hide();
		$('.tagsbox').hide();
	}); 
	
	$('.dots li.dot3').click(function() {
		$('.post3').fadeIn();
		$('.post2').hide();
		$('.post1').hide();
		$('.tagsbox').hide();
	});
	
	$('.dots li.tags').click(function() {
		$('.tagsbox').fadeIn();
		$('.post3').hide();
		$('.post2').hide();
		$('.post1').hide();
	});
	
	
});