jQuery(document).ready(function(){
						   
	jQuery("#tabs").tabs();
							   
	jQuery("div.part img[rel='change']").fadeTo(200, 0.6);
	
	jQuery("select[name='projos']").change(function(){
		window.location = 'project.php?id=' + jQuery(this).val();
	});
	
	jQuery("#content div.part img").hover(function(){
		$this = jQuery(this);
		$cat = $this.attr("class");
		//alert($cat);
		jQuery("#nav ul li."+$cat).addClass('hover');
	},
	function(){
		$this = jQuery(this);
		$cat = $this.attr("class");
		//alert($cat);
		jQuery("#nav ul li."+$cat).removeClass('hover');
	});
	
	jQuery("#nav ul ul ul li").hover(function(){
		$this = jQuery(this);
		$cat = $this.find("a").attr("class");
		if($cat == ""){
			$cat = "none";
		}
		//console.log($cat);
		//alert($cat);
		jQuery("div.part img#"+$cat).each(function(){
			$it = jQuery(this);
			if($it.attr("rel") == "change")
			{
				$o_src = $it.attr("src");
				$n_src = $o_src.replace(/_small_bw.jpg/,'_small.jpg');
				$it.attr("src", $n_src);
				$it.fadeTo(100, 1);
			}
			$it.css("border", "1px black solid");
		});
	},
	function(){
		$this = jQuery(this);
		$cat = $this.find("a").attr("class");
		if($cat == ""){
			$cat = "none";
		}
		//alert($cat);
		jQuery("div.part img#"+$cat).each(function(){
			$it = jQuery(this);
			if($it.attr("rel") == "change")
			{
				$o_src = $it.attr("src");
				$n_src = $o_src.replace(/_small.jpg/,'_small_bw.jpg');
				$it.attr("src", $n_src);
				$it.fadeTo(200, 0.6);
			}
			$it.css("border", "1px white solid");
		});
	});
	
	jQuery("#nav ul li").hover(function(){
		$this = jQuery(this);
		$cat = $this.attr("class");
		if($cat == ""){
			$cat = "none";
		}
		//alert($cat);
		jQuery("div.part img."+$cat).each(function(){
			$it = jQuery(this);
			if($it.attr("rel") == "change")
			{
				$o_src = $it.attr("src");
				$n_src = $o_src.replace(/_small_bw.jpg/,'_small.jpg');
				$it.attr("src", $n_src);
				$it.fadeTo(100, 1);
			}
			$it.css("border", "1px black solid");
		});
	},
	function(){
		$this = jQuery(this);
		$cat = $this.attr("class");
		if($cat == ""){
			$cat = "none";
		}
		//alert($cat);
		jQuery("div.part img."+$cat).each(function(){
			$it = jQuery(this);
			if($it.attr("rel") == "change")
			{
				$o_src = $it.attr("src");
				$n_src = $o_src.replace(/_small.jpg/,'_small_bw.jpg');
				$it.attr("src", $n_src);
				$it.fadeTo(200, 0.6);
			}
			$it.css("border", "1px white solid");
		});
	});
	
		jQuery(".switch").click(function () {
		if (jQuery(this).next(":visible").length !== 0) {
			jQuery(this).next().hide("fast");
		} else {
			jQuery(".switch").next().slideUp("fast");
			jQuery(this).next().slideToggle("fast");
		}
		return false;
	});
		
		
	jQuery("li[rel='parent']").parent().show();
		
	jQuery("div.part a").tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false,
		fade: 150 
	});
	
	jQuery(".parent").next().show();
	
	//.next().slideUp()
	
	jQuery("#nav ul ul li").css("opacity","0.85");
	
	jQuery("#nav ul ul li").hover(
		function (){
			jQuery(this).animate({ 
				opacity: 1,
				paddingLeft: "24px"
			}, 100 );
		}, 
		function () {
			jQuery(this).animate({ 
			opacity: 0.85,
			paddingLeft: "15px"
		}, 200 );
		}
	);
	
	jQuery("#content div.part img").hover(function(){
		$this = jQuery(this);
		$rel = $this.attr("id");
		//console.log($rel);
		//alert($rel);
		//alert(jQuery("a."+$rel).html());
		jQuery("#nav a."+$rel).parent().addClass('hover2');
		//alert(jQuery("#nav ."+$rel).parent().parent().prev().html());
		if(jQuery.browser.msie){
			if(jQuery.browser.version < 8){
				jQuery("#nav ."+$rel).parent().parent().parent().removeClass('hover');
			}
			else
			{
				jQuery("#nav ."+$rel).parent().parent().prev().removeClass('hover');
			}
			
		}
		else
		{
			jQuery("#nav ."+$rel).parent().parent().prev().removeClass('hover');
		}
		//console.log(jQuery("#nav ul ul ul li[hov='"+$rel+"']") + "\n ------ \n");
		//console.log(jQuery("#nav ul ul ul li[hov='"+$rel+"']").html() + "\n ------ \n");
		//console.log(jQuery("#nav ul ul ul li[hov='"+$rel+"']").text() + "\n ------ \n");
		//console.log($rel + "\n ------ \n");
	},
	function(){
		$this = jQuery(this);
		$rel = $this.attr("id");
		//alert($cat);
		jQuery("#nav ul ul ul li a."+$rel).parent().removeClass('hover2');
	});
	
	jQuery("#content .staff").click(function(){
		$this = jQuery(this);
		jQuery.get("team-solo.php?id=" + $this.attr("id"), function(data){
			jQuery("#result").slideUp("fast", function()
			{
				jQuery("#result").slideUp().html(data).slideDown("fast", function(){
					jQuery.scrollTo("#result",600);
				 });
			});
		});
	});
});