
	function changediv(id){
	  if (document.getElementById(id).style.display == 'none'){
	    document.getElementById(id).style.display = 'block';
	  }
	  else{
	    document.getElementById(id).style.display = 'none';
	  }
	}



$(document).ready(function(){
	nav();
	rotate();
});

this.nav = function(){
	var navId = "nav";
	$("#"+ navId +" li").hover(
	  function () {
		$("ul:first",this).show();
		$("a:first",this).addClass("over");
	  },
	  function () {
		$("ul",this).hide();
		$("a",this).removeClass("over");
	  }
	);
};


/* easy content rotate */
this.rotate = function(){

	$(".rotate").each(function(){

		var obj = this;
		var pause = 4000;
		var length = $("li",obj).length;
		var temp = 0;
		var randomize = false;

		function getRan(){
			var ran = Math.floor(Math.random()*length) + 1;
			return ran;
		};
		function show(){
			if (randomize){
				var ran = getRan();
					while (ran == temp){
					ran = getRan();
				};
				temp = ran;
			} else {
				temp = (temp == length) ? 1 : temp+1 ;
			};
			$("li",obj).hide();
			$("li:nth-child(" + temp + ")",obj).fadeIn("slow");
		};
		show(); setInterval(show,pause);

	});

};
