$(document).ready(function(){	
	hc=null;
	$(".nosee").hide();
	var hiddiv = {
        'position' : 'absolute',
        'z-index' : '100'
      }
    $("#drops").css(hiddiv);
	$("#cat-button").hover(
		function(){
			fo=null;
			clearTimeout(hc);
			hideDrops();
			$("#drops-mid").append($("#drop-cats").html());
			$("#drops").fadeIn('normal')
			$("#drops-top").fadeIn('normal')
			$("#drops-mid").fadeIn('normal')
			$("#drops-bottom").fadeIn('normal')
		},
		function(){
			hc =setTimeout("hideDropsnormal()", 1000);
		}
	)	
	$("#arc-button").hover(
		function(){
			fo=null;
			clearTimeout(hc);
			hideDrops();
			$("#drops-mid").append($("#drop-arcs").html());
			$("#drops").fadeIn('normal')
			$("#drops-top").fadeIn('normal')
			$("#drops-mid").fadeIn('normal')
			$("#drops-bottom").fadeIn('normal')
		},
		function(){
			hc =setTimeout("hideDropsnormal()", 1000);
		}
	)
	$("#search-button").hover(
		function(){
			fo=null;
			clearTimeout(hc);
			hideDrops();
			$("#drops-mid").append($("#drop-search").html());
			$("#drops").fadeIn('normal')
			$("#drops-top").fadeIn('normal')
			$("#drops-mid").fadeIn('normal')
			$("#drops-bottom").fadeIn('normal')
		},
		function(){
			hc =setTimeout("hideDropsnormal()", 1000);
		}
	)
	$("#meta-button").hover(
		function(){
			fo=null;
			clearTimeout(hc);
			hideDrops();
			$("#drops-mid").append($("#drop-meta").html());
			$("#drops").fadeIn('normal')
			$("#drops-top").fadeIn('normal')
			$("#drops-mid").fadeIn('normal')
			$("#drops-bottom").fadeIn('normal')
		},
		function(){
			hc =setTimeout("hideDrops()", 1000);
		}
	)
	$("#links-button").hover(
		function(){
			fo=null;
			clearTimeout(hc);
			hideDrops();
			$("#drops-mid").append($("#drop-links").html());
			$("#drops").fadeIn('normal')
			$("#drops-top").fadeIn('normal')
			$("#drops-mid").fadeIn('normal')
			$("#drops-bottom").fadeIn('normal')
		},
		function(){
			hc =setTimeout("hideDropsnormal()", 1000);
		}
	)
	$("#feeds-button").hover(
		function(){
			fo=null;
			clearTimeout(hc);
			hideDrops();
			$("#drops-mid").append($("#drop-feeds").html());
			$("#drops").fadeIn('normal')
			$("#drops-top").fadeIn('normal')
			$("#drops-mid").fadeIn('normal')
			$("#drops-bottom").fadeIn('normal')
		},
		function(){
			hc =setTimeout("hideDrops()", 1000);
		}
	)
	$("#drops").hover(
		function(){
			fo=null;
			clearTimeout(hc);
		},
		function(){
			hc=setTimeout("hideDropsnormal()", 2000);
		}
	)
	$(".lrgr-lnk").click(function() {
		//$(this).fadeOut(500);
		for(x=0; x <20; x++){
			var name = 'clip-'+x;
			if($(this).hasClass(name)) {
				var divId = name;
				var infoId ='info-'+x;
				var linkDivId ='link-'+x;
			}
		}
		var div = document.getElementById(divId);
		var clipdiv = $(div);
		var linkholder=document.getElementById(linkDivId);
		var linkdiv = $(linkholder);
		var divheight = clipdiv.css('height');
		var divwidth = clipdiv.css('width');
		var infodiv = document.getElementById(infoId);
		var infoObj = $(infodiv);
		var info = infoObj.html();
		//fullwidth=560&fullheight=340&smallwidth=300&smallheight=183
		var vals=info.split('&amp;');
		var pairs=new Array();
		var i = 0;
		for(x in vals){
			pairs[i]=vals[x].split('=');
			i++;
		}
		// for(x in pairs){ document.write(pairs[x]+"<br>");}
		/*
		fullwidth,560
		fullheight,340
		smallwidth,300
		smallheight,183
		*/
		var clipleft=parseInt(pairs[0][1])-300;
		if($(this).html().indexOf('Close')> -1) {
			var smallheight= parseInt(pairs[3][1])+"px";
			clipdiv.animate(
			{ 
				"width": '300px',
				"height": smallheight,
				"left": "0px"
			}, 1500, '', switchLnk($(this)) );
			linkdiv.animate(
			{ 
				"width": "300px",
				"left": "0px"
			}, 1500);
		} else {
			var width = parseInt(pairs[0][1])+"px";
			var height = parseInt(pairs[1][1])+"px";
			clipdiv.animate(
			{ 
				"width": width,
				"height": height,
				"left": "-="+clipleft+"px"
			}, 1500, '', switchLnk($(this)) );
			linkdiv.animate(
			{ 
				"width": width,
				"left": "-="+clipleft+"px"
			}, 1500);
			// .animate( properties, [ duration ], [ easing ], [ callback ] )
		}
	});
	function switchLnk(lnkObj){
		if(lnkObj.html().indexOf('Close')!=-1){
			lnkObj.empty();
			lnkObj.append('&laquo; View Larger &raquo;');		
		} else {
			lnkObj.empty();
			lnkObj.append('&raquo; Close &laquo;');
		}
		lnkObj.fadeIn('fast');
	}
})
function hideDrops(){
	$("#drops").hide();
	$("#drops-mid").empty();									   
}
function hideDropsnormal(){
	var fo =$("#drops").fadeOut('fast');
	$("#drops-mid").empty();									   
}