// POST JSON
$(document).ready(function(){

// DROPDOWN
	var timeout         = 500;
	var closetimer		= 0;
	var ddmenuitem      = 0;
	
// ROTATION
	function changeBox1() {
		var s = $("div[id^='box1rotate']").length;
		var p = 1, i = 1;
		
		$("div[id^='box1rotate']").each(function(){
			if ($(this).is(':visible')) p = i;
			i += 1;
		});
		if (p>=s) var n = 1;
		else var n = p+1;
		$('#box1rotate'+p).fadeOut("slow",function(){
			$('#box1rotate'+n).fadeIn("slow",function(){
				setTimeout(changeBox1,5000);
			});
		});
	}
	function changeBox2() {
		var s = $("div[id^='box2rotate']").length;
		var p = 1, i = 1;
		
		$("div[id^='box2rotate']").each(function(){
			if ($(this).is(':visible')) p = i;
			i += 1;
		});
		if (p>=s) var n = 1;
		else var n = p+1;
		$('#box2rotate'+p).fadeOut("slow",function(){
			$('#box2rotate'+n).fadeIn("slow",function(){
				setTimeout(changeBox2,5000);
			});
		});
	}

	setTimeout(changeBox1,5000);
	setTimeout(changeBox2,5000);

// NAVIGATION
	$("#topnav ul").superfish(); 

});