/*CSS Browser Selector v0.3.1 by Rafael Lima (http://rafael.adm.br)*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' '+s+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);


/*Tooltip script powered by jQuery (http://www.jquery.com)*/

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -15;
		yOffset = 12;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<div id='tooltip'><p id='tooltipX'>"+ this.t +"</p></div>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
	
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? this.t : "";
		$("body").append("<div id='screenshot'><p id='screenshotX'><span>"+ c +"</span><img src='"+ this.rel +"' alt='url preview' /></p></div>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
	
$(document).ready(function(){

	tooltip();
	$(".tabdiv").hide();
	$(".tabdiv:first").show();
	$("#about").height($("#about").height()-20);
	$("#webdesign").height($("#webdesign").height()-10);
	$("#magazines li a").hover(
		function () {
			$(this).animate({ backgroundColor: '#1E1F20' },{queue:false}, "normal" );
		}, 
		function () {
			$(this).animate({ backgroundColor: '#131415' },{queue:false}, "normal" );
		}
    );

	$("#navigation li a").click(function(){
	    $("#navigation li a").removeClass("selected");
		$("#navigation li a span").removeClass("selected2");
		$(this).addClass("selected");
		$(this).children().addClass("selected2");
		var current = $(this).attr("href");
		$(".tabdiv:visible").hide();
		$(current).fadeIn("slow");
		$("#content").animate({"height":$(current).height()});
		return false;
	});

	$("#about p a").click(function(){
		var current = $(this).attr("href");
		$(".tabdiv:visible").hide();
		$(current).fadeIn("slow");
		$("#content").animate({"height":$(current).height()});
		return false;
	});
});
