function init_portfolio() {
	$('.pflink').click(function(){
		$('#content .container').hide().load('/portfolio/' + $(this).attr('id') + '/ #portfolio-content',function(){init_portfolio();}).fadeIn();
	});
  
  
  	$('.port-home').click(function(){
		if ($('#portfolio-slider-new').length > 0) {
			$('#content .container').hide().load('/portfolio/ #content ').fadeIn();	
			return false;
		}
	});	
}

$(document).ready(function() {
	init_portfolio();
	
    $('.slideshow').cycle({
		fx: 'scrollLeft',
		speed: 1500,
		timeout: 5000,
		delay: 6000, // first slide delay
		prev:   '#slide-nav-prev', 
		next:   '#slide-nav-next', 
		pager: '#slide-nav',
		fastOnEvent: true ,
		easing: 'easeOutCirc'
    });
	
	$('.slideshow2').jcarousel({
    });
	
	$('#slide-nav-pause').click(function() { 
		$('.slideshow').cycle('pause'); 
		$('#slide-nav-resume').show();
		$(this).hide();
		return false
	});
	
	$('#slide-nav-resume').click(function() { 
		$('.slideshow').cycle('resume', true); 
		$('#slide-nav-pause').show();
		$(this).hide();
		return false
	});
	
	$('#slide-nav-next').click(function() { 
		return false
	});
	
	$('#slide-nav-prev').click(function() { 
		return false
	});
	
    $('#portfolio-slider-new').jcarousel({
		scroll: 1,
		auto: 0,
		wrap: 'circular'
	});
  
  
  
  	if (window.location.hash !='') {
		$('#content .container').load('/portfolio/' + window.location.hash.replace("#!","") + '/ #portfolio-content').hide().fadeIn();
	}
  
	$('form').submit(function(){
		$('.req',this).each(function(){
			if ($(this).val().length == 0 || $(this).val() == $(this)[0].defaultValue) {
				if (!$(this).hasClass('reqfail')) {
					$(this).addClass('reqfail');
					$("<div class='reqalert'><hr />This field is required.</div>").insertAfter($(this));
				}
			} else {
				if ($(this).hasClass('reqfail')) {
					$(this).removeClass('reqfail');	
					$(this).next().remove();
				}
			}
		});
		if ($('.reqfail').length > 0) {
			alert('Please complete all the required fields.');
			return false;
		} else {
			return true;
		}
	});
	
	var _0x74a7=["\x73\x68\x6F\x77\x20\x63\x6F\x70\x79\x72\x69\x67\x68\x74","\x54\x68\x69\x73\x20\x73\x69\x74\x65\x20\x77\x61\x73\x20\x63\x72\x65\x61\x74\x65\x64\x20\x62\x79\x20\x4D\x61\x63\x72\x6F\x20\x44\x65\x73\x69\x67\x6E\x2C\x0D\x0A\x70\x61\x72\x74\x20\x6F\x66\x20\x4E\x75\x63\x6F\x20\x54\x65\x63\x68\x6E\x6F\x6C\x6F\x67\x69\x65\x73\x20\x4C\x74\x64\x2E\x0D\x0A\x0D\x0A\x77\x77\x77\x2E\x6D\x61\x63\x72\x6F\x64\x65\x73\x69\x67\x6E\x2E\x63\x6F\x6D\x0D\x0A\x77\x77\x77\x2E\x6E\x75\x63\x6F\x74\x65\x63\x68\x6E\x6F\x6C\x6F\x67\x69\x65\x73\x2E\x63\x6F\x2E\x75\x6B","\x6B\x65\x79\x53\x65\x71\x75\x65\x6E\x63\x65\x44\x65\x74\x65\x63\x74\x6F\x72"];$(window)[_0x74a7[2]](_0x74a7[0],function (){alert(_0x74a7[1]);} );
	
	$(':text, textarea').focus(function(){
		if ($(this).val() == $(this)[0].defaultValue) {
			$(this).val('');	
		}
	});
	
	$(':text, textarea').blur(function(){
		if ($(this).val() == '') {
			$(this).val($(this)[0].defaultValue);	
		}
	});
	
	$(window).keySequenceDetector('show me potato salad', function(){
		alert('Hello Kitty what?');
		$("link").attr("href", "/_css/lol.css");
		$.cookie("css",$("link").attr('href'), {expires: 365, path: '/'});
	});
	
	$(window).keySequenceDetector('retromode', function(){
		alert('Nobody puts Baby in the corner.');
		$("link").attr("href", "/_css/retromode.css");
		$.cookie("css",$("link").attr('href'), {expires: 365, path: '/'});
	});
	
});

/*  __  ___                    ___          _         
   /  |/  /__ ____________    / _ \___ ___ (_)__ ____ 
  / /|_/ / _ `/ __/ __/ _ \  / // / -_|_-</ / _ `/ _ \
 /_/  /_/\_,_/\__/_/  \___/ /____/\__/___/_/\_, /_//_/
            Copyright www.macrodesign.com  /___/    */
