$(document).ready(function() { 
	var x = navigator;
	var left = x.userAgent.indexOf("Firefox");
	var version = x.userAgent.slice(left);
	version = version.replace("Firefox/","");
	//var support = true;
	if(version.slice(0,1) == 2){
		support = false;
	} else {
		support = true;
	}
	if(support) {
		$("#work li a, a.fancybox").fancybox({ 
			'overlayShow': true,
			'frameWidth' : 640,
			'frameHeight' : 480,
			'zoomSpeedIn' : 0,
			'zoomSpeedOut' : 0,
			'overlayOpacity' : .8
		}); 
		$("#studio li a").fancybox({
			'overlayShow': true,
			'frameWidth' : 640,
			'frameHeight' : 480,
			'zoomSpeedIn' : 0,
			'zoomSpeedOut' : 0,
			'overlayOpacity' : .8
		});
	} else {
		$("#work li a, a.fancybox").click( function() {
			window.open($(this).attr("href"),"JourPopup", "menubar=no,width=640,height=480,toolbar=no");
			return false;
		});
		$("#studio li a").click( function() {
			window.open($(this).attr("href"),"JourPopup", "menubar=no,width=640,height=480,toolbar=no");
			return false;
		});
	}
	$('#filter').selectbox();

	$("#all").click( function () {
		$("#work li.All").hide().filter(".All").fadeIn(800);
		$("#all").fadeOut('fast');
		return false;
	});
	var config = {    
		sensitivity: 3, 
		interval: 200,
		over: function() { 
			$(this).animate({ width: "474px"}, 400);
		},  
		timeout: 500, 
		out: function() {
			$(this).animate({ width: "212px"}, 250);
		}
	};
	$("#companylink").hoverIntent(config);
	
}); 

//handle sorting on work page
var filterWork = function (value) {
	if(!value) {
		value = ".All";
	}
	$("#work li.All").hide().filter("."+value).fadeIn(800);
	$("#all").fadeIn('fast');
	return false;
}
var homePop = function(href) {
	var x = navigator;
	var left = x.userAgent.indexOf("Firefox");
	var version = x.userAgent.slice(left);
	version = version.replace("Firefox/","");
	//var support = true;
	if(version.slice(0,1) == 2){
		support = false;
	} else {
		support = true;
	}
	if(support) {
		$.fn.fancybox.start({'href' : href},{ 
			'overlayShow': true,
			'frameWidth' : 640,
			'frameHeight' : 480,
			'zoomSpeedIn' : 0,
			'zoomSpeedOut' : 0,
			'overlayOpacity' : .8
		})
	} else {
		window.open(href,"JourPopup", "menubar=no,width=640,height=480,toolbar=no");
	}
}
var resizeDiv = function() {
	
};
