// JavaScript Document

function open_project(location){
	var windowa=window.open(location,"_blank",'height=530,width=800');
};
function open_link(location){
	var windowa=window.open(location,"_parent");
};

$(document).ready(function(){
	$(document).pngFix(); 	
//hover sticker
	$(".sticker img").css({'height': '150px'}).hover(
		function(){
			$(this).animate({"height": "170" , "top":"0px" , "left":"0px"}, 50);
		},
		function(){
			$(this).animate({"height": "150" , "top":"10px" , "left":"10px"}, 50); 
		});	
//tooltip
	$(".sticker").mousemove(function(e){								 
	$("#tool_tip").css({'visibility':'visible', 'left':e.pageX+20, 'top':e.pageY+40});
	$(".tool_tip span").text($(this).attr('id'));
	});
	$(".sticker").mouseout(function(){
	$("#tool_tip").css({'visibility':'hidden'});
	});
//navigation
	$("ul>ul>ul").hide();
	var curr_url=window.location.href;
	var selection="#all_work";
	if(curr_url.search(/index/)>-1){var selection="#all_work"; }
	if(curr_url.search(/about/)>-1){var selection="#about"; $("ul>ul").hide();}
	if(curr_url.search(/client_work/)>-1){var selection="#client_work"; $("ul>ul").hide();}
	if(curr_url.search(/play/)>-1){var selection="#play"; $("ul>ul").hide();}
	$(selection).css({"background-color": "#ffffff" , "color": "#0000FF"});
	$(selection).find("li").css({"background": "transparent" , "color": "#ffffff"});
	
	//hover navigation
	$("li").hover(
		function(){
			$(this).not(selection).css({"background-color": "#ffffff" , "color": "#0000FF"});
		},
		function(){
			$(this).not(selection).css({"background-color": "transparent" , "color": "#ffffff"});
		}
	);
	//click navigation
	$("li").click(function(){
		selection="#"+$(this).attr("id");
		var tag=$(this).text();
		$("li").css({"background-color": "transparent" , "color": "#ffffff"});
		$(this).css({"background-color": "#ffffff" , "color": "#0000FF"});
		$(".sticker").fadeOut(80);
		$(".sticker[alt*='"+tag+"']").fadeIn(80);
		var tag_nav=tag+"_nav";
		var parent_name="#"+$(this).parent().attr("id");
		$("ul>ul>ul:visible").not(parent_name).hide();
		$("ul[id='"+tag_nav+"']:hidden").show();
	});
	//all work show
	$("#all_work").click(function(){
		$(".sticker").fadeIn(80);
	});
	

})