/* topnav fade links */
$(document).ready(function(){
	if ($('.topnav').length){
		$(".topnav").fadeTo("slow", 0.7);
		$(".topnav").hover(function(){
			$(this).css ({'text-decoration':'underline'});
			//$(this).css ({'font-weight':'bold'});
			$(this).fadeTo("slow", 1.0);
		//$(this).css ({'font-weight':'bold'}).fadeTo("slow", 1.0);
		},	function(){
		
		$(this).fadeTo("slow", 0.7);
		$(this).css ({'text-decoration':'none'});
		//$(this).css ({'font-weight':''});
		//$(this).css ({'font-weight':''}).fadeTo("slow", 0.8);
		//$(this).css ({'background-color':'transparent'}).fadeTo("slow", 0.8);
		});
	}
});

/* bottomnav fade links */
$(document).ready(function(){
	if ($('.bottomnav').length){
		$(".bottomnav").fadeTo("slow", 0.7);
		$(".bottomnav").hover(function(){
			$(this).css ({'text-decoration':'underline'});
			$(this).fadeTo("slow", 1.0);
		},	function(){
		
		$(this).fadeTo("slow", 0.7);
		$(this).css ({'text-decoration':'none'});	
		});
	}
});

/* image slider plugin */

$(document).ready(function(){	
	if ($('#slider').length){
		$("#slider").easySlider({
			auto: true,
			continuous: true,
			controlsShow:false,
			speed:1500
		});
	}
});

/* zoom tool plugin */
$(document).ready (function() {
	if ($('.jqzoom').length){
		$(".jqzoom").jqzoom({
			zoomWidth:300,
			zoomHeight:200
		
		});
	}
});


/* modal window plugin */


/* start revolving cloudlist */

$(document).ready(function(){
   if ($('#cloudlist').length){
			var element = $('#cloudlist a');
			var offset = 0;
			var stepping = 0.005;
			var list = $('#cloudlist');
			var $list = $(list)
			
			$list.mousemove(function(e){
			    var topOfList = $list.eq(0).offset().top
			    var listHeight = $list.height()
			    stepping = 0.008;
			   
			});
			
			
			for (var i = element.length - 1; i >= 0; i--)
			{
			    element[i].elemAngle = i * Math.PI * 2 / element.length;
			}
			
			
			setInterval(render, 20);
			
			
			
	}
	
	function render(){
			    for (var i = element.length - 1; i >= 0; i--){
			       
			        var angle = element[i].elemAngle + offset;
			       
			        x = 110 + Math.sin(angle) * 30;
			        y = 45 + Math.cos(angle) * 40;
			        size = Math.round(30 - Math.sin(angle) * 10);
			       
			        var elementCenter = $(element[i]).width() / 2;
			
			        var leftValue = (($list.width()/2) * x / 100 - elementCenter) + "px"
			
			        $(element[i]).css("fontSize", size + "pt");
			        $(element[i]).css("opacity",size/100);
			        $(element[i]).css("zIndex" ,size);
			        $(element[i]).css("left" ,leftValue);
			        $(element[i]).css("top", y + "%");
			    }
			   
			    offset += stepping;
			}
});
/* end revolving cloudlist */

/* start static cloud list */
/*$(document).ready(function(){
				
				//get tag feed
				$.getJSON("http://localhost/jquery/tagcloud.php?callback=?", function(data) {
				
					//create list for tag links
					$("<ul>").attr("id", "tagList").appendTo("#tagCloud");
					
					//create tags
					$.each(data.tags, function(i, val) {
						
						//create item
						var li = $("<li>");
						
						//create link
						$("<a>").text(val.tag).attr({title:"See all pages tagged with " + val.tag, href:"http://localhost/tags/" + val.tag + ".html"}).appendTo(li);
						
						//set tag size
						li.children().css("fontSize", (val.freq / 10 < 1) ? val.freq / 10 + 1 + "em": (val.freq / 10 > 2) ? "2em" : val.freq / 10 + "em");
						
						//add to list
						li.appendTo("#tagList");
						
					});
				});
});
*/

/* end static cloud list */
