$(document).ready(function()
{

	$('#top ul li').hover(
					function(){  
						/*.css({"overflow":"visible", "box-shadow": "0 0 8px 0px #333", "-moz-box-shadow": "0 0 8px 0px #333", "-webkit-box-shadow": "0 0 8px 0px #333"})*/
						$(this).children('ul').height('auto').stop().css("overflow","visible").slideDown();   
					},
					function(){ 
						/*.css({"box-shadow": "none", "-moz-box-shadow": "none", "-webkit-box-shadow": "none"}); */
						$(this).children('ul').stop().slideUp();
					});	
	

	var anim = 1;
		
	$("#content table tbody tr:odd").addClass("odd");
	$("#content table.software tbody tr").removeClass("odd");
	
	$("div.bus").tipsy({gravity: 'w', html: true, title: function(){ return $(this).text(); }});
	$("div.wire").tipsy({title: function(){ return( $(".pins_desc>table>tbody>tr[title=" + this.getAttribute('original-title') + "]>td:nth-child(3)").text());  }});
	$("div.unit").tipsy({ html: true, title: function(){ return( $(this).children().children().children().children().children().text());  }});
	
	if ($("#slider1vid").length) {
		var flashvars = {};
		var params = {wmode:"transparent"};
		swfobject.embedSWF($("#slider2vid").text() + "/video.swf", "slider1vid", "750", "290", "9.0.0", "expressInstall.swf", flashvars, params);
		
		var anim = 1;	
		$('#sh_1').mousedown(
			function(){ 
				if (anim==1) return; 
				$('#splash_hover').animate({top:8}, 500);   
				swfobject.embedSWF($("#slider2vid").text() + "/video.swf", "slider1vid", "750", "290", "9.0.0", "expressInstall.swf", flashvars, params);
				anim = 1;
			});
		
		$('#sh_2').mousedown(
			function(){ 
				if (anim==2) return; 
				$('#splash_hover').animate({top:98}, 500);  
				swfobject.embedSWF($("#slider2vid").text() + "/video2.swf", "slider1vid", "750", "290", "9.0.0", "expressInstall.swf", flashvars, params);
				anim = 2;
			});
		
		$('#sh_3').mousedown(
			function(){ 
				if (anim==3) return; 
				$('#splash_hover').animate({top:188}, 500); 
				swfobject.embedSWF($("#slider2vid").text() + "/video3.swf", "slider1vid", "750", "290", "9.0.0", "expressInstall.swf", flashvars, params);
				anim = 3; 
			});
	}
	
	if ($("#tabs_container").length) {
		$("#tabs_container .documentation_table li").click(function()
			{
				if ($(this).hasClass("active")) return;
				$("#tabs_container div[class=active]").css("display", "none").removeClass("active");
				$("#tabs_container li[class=active]").removeClass("active");
				$(this).addClass("active");
				$("#tabs_container div[id=" + $(this).attr("rel") + "]").css("display", "block").addClass("active");
				
				
			});
	}
	//
	
	$("#altera_vendor").click(function(){ $(".vendors").removeAttr("name").css("display", "none"); $("#altera_technology").attr("name","fields[technology]").css("display","inline"); });
	$("#xilinx_vendor").click(function(){ $(".vendors").removeAttr("name").css("display", "none"); $("#xilinx_technology").attr("name","fields[technology]").css("display","inline"); });
	$("#lattice_vendor").click(function(){ $(".vendors").removeAttr("name").css("display", "none"); $("#lattice_technology").attr("name","fields[technology]").css("display","inline"); });
	$("#asic_vendor").click(function(){ $(".vendors").removeAttr("name").css("display", "none"); $("#asic_technology").attr("name","fields[technology]").css("display","inline"); });
	
});
