	function showDetails(id) {
		if($("#fproject").css('display') == "none") {
			$("#fproject").show();
			$("#viewbox").hide();
			$("#viewbox").empty();
		} else {
			$("#fproject").hide();
			$("#viewbox").show();
			$("#viewbox").load("/portfolio/getfullone/" + id);
		}
	}
	
	$(document).ready(function(){
		
		
		$('.nojs').removeClass('nojs');
		
		
		var anim = 0;
		var op = 0;
		var op1 = 1;
		var spd = 500;
		if (jQuery.browser.msie) { op1 = 'auto' }
		if (jQuery.browser.msie && jQuery.browser.version=='7.0') { op = 'auto'; spd = 1; }
		  $('#corneriphone').click(function(){
			if (anim == 0) {
			  anim = 1;
			  $('#cakephp').fadeOut(200, function(){$('#iphone').fadeIn("slow");});
			  $('#cornercakephp').show().parent().show();
			  $('#corneriphone').parent().animate({opacity:op}, spd, function(){
				$(this).hide().css({opacity:op1});
			  });
			  $('#corneriphone').animate({width: "600px", height: "600px"}, spd, function() {
				$('#corneriphone').hide().css({width:'318px',height:'308px'});
				anim = 0;
			});
			}
		});
		
		  $('#cornercakephp').click(function(){
			 if (anim == 0) {
			anim = 1;
			$('#iphone').fadeOut(200, function(){$('#cakephp').fadeIn("slow");});
			  $('#corneriphone').show().parent().show();
			  $('#cornercakephp').parent().animate({opacity:op}, spd, function(){
				$(this).hide().css({opacity:op1});
			  });
			  $('#cornercakephp').animate({width: "600px", height: "600px"}, spd, function(){
				$('#cornercakephp').hide().css({width:'318px',height:'308px'});
				anim = 0;
			});
			 }
		  });
		
		
		
		
		
		
		
		$("#prjt").load("/projects/getone");
		
		$("#fproject .paging .previous").click(function(){
			prev = $('#prevRandomProjectId').html();
			url = '/projects/getone/'+prev+'/';
			$("#prjt").fadeTo(500, 0.01);
			
					
			$.get(url, {},
				function(response){
					$("prjt").fadeTo(100, 0.01);
					setTimeout('$("#prjt").html(unescape("'+escape(response)+'"))', 100);
					setTimeout('$("#prjt").fadeTo(500, 1)', 150);
				}
			);
			return false;
		});
		
		$("#fproject .paging .next").click(function(){
			next = $('#nextRandomProjectId').html();
			url = '/projects/getone/'+next+'/';
			$("#prjt").fadeTo(500, 0.01);
			
			$.get(url, {},
				function(response){
					$("prjt").fadeTo(100, 0.01);
					setTimeout('$("#prjt").html(unescape("'+escape(response)+'"))', 100);
					setTimeout('$("#prjt").fadeTo(500, 1)', 150);
				}
			);
			return false;
		});
		
		$('#nav').find('li').hover(function(){
			if ($(this).find('.level2').size() >= 1) {
				$(this).find('a:first-child').addClass('on1');
				if($.browser.msie){
					$(this).find('.level2').css({height: "auto"}).find('ul').stop().animate({top: "0"}, 200);
				} else {
					$(this).find('.level2').css({height: "auto"}).find('ul').stop().animate({opacity: "1", top: "0"}, 200);
				}
			}
		}, function(){
			if($.browser.msie){
				$(this).find('.level2').find('ul').stop().animate({top: "-100pt"}, 200, function(){  $(this).parent().css({height: "0"}).prev().removeClass('on1'); });
			} else {
				$(this).find('.level2').find('ul').stop().animate({opacity: "0", top: "-100pt"}, 200, function(){  $(this).parent().css({height: "0"}).prev().removeClass('on1'); });
			}
		});
		
		if ($('.sidebarbg ul').length) {
			var projectName = $(document)[0].URL.split('/')[$(document)[0].URL.split('/').length-1].split('#')[0].split('?')[0];
			var e = 0;
			if (projectName!='portfolio' && projectName!='iphone-applications') {
				var loc = 0;
				var project = '.'+$('.sidebarbg ul li').find('div:first-child').attr('class');
				$('.sidebarbg ul li').find(project).each(function(e){
					var thisUrl = $(this).find('a').attr('href').split('/')[$(this).find('a').attr('href').split('/').length-1];
					if (thisUrl==projectName) { loc=$(this).parent(); }
				});
				e = $('.sidebarbg ul li').index(loc);
				if (e<0) {e=0}
			}
			var toLft = $('.sidebarbg ul li').eq(e)[0].offsetLeft * (-1);
			$('.sidebarbg ul').stop().css({left:toLft});
			if (e+1==$('.sidebarbg ul li').size()) { $('.sidebar .paging .next').addClass('off'); }
			if (e==0) { $('.sidebar .paging .previous').addClass('off'); }
		}
		
		$('.sidebar .paging .next a').click(function(){
			if (e+1<$('.sidebarbg ul li').size()) {
				var toLft = $('.sidebarbg ul li').eq(e+1)[0].offsetLeft * (-1);
				$('.sidebarbg ul').stop().animate({left:toLft}, 300);
				$('.sidebar .paging .previous').removeClass('off');
				$('.sidebar .paging .previous a').show();
				e++;
			} 
			if (e+1==$('.sidebarbg ul li').size()) { $('.sidebar .paging .next').addClass('off'); }
			return false;
		});
		
		$('.sidebar .paging .previous a').click(function(){
			if (e>=0) {
				var toLft = $('.sidebarbg ul li').eq(e-1)[0].offsetLeft * (-1);
				$('.sidebarbg ul').stop().animate({left:toLft}, 300);
				$('.sidebar .paging .next').removeClass('off');
				e--;
			} 
			if (e==0) { $('.sidebar .paging .previous').addClass('off'); }
			return false;
		});
		
		
		
		$('.tabs').find('a').click(function(){
			$('.act_tab').removeClass('act_tab');
			$('.form_bg').hide();
			$(this).addClass('act_tab');
			var targ = $(this).attr('class').split(' ');
			$(targ).each(function(e){
				var elem = '.'+targ[e];
				$(elem).show();
			});
			return false;
		});
		
		$('.adv, .iph').find('input, textarea, select').focus(function(){
			$(this).parents('.row').addClass('hlight');
		});
		$('.adv, .iph').find('input, textarea, select').blur(function(){
			$(this).parents('.row').removeClass('hlight');
		});
		
		
		$('.adds').find('.short').focus(function(){
			if (!$(this).val()) {
				var t = 0;
				var z = $(this).parent().find('.short').size();
				for (i=0;i<=z;i++) { if ($(this).parent().find('.short').eq(i).val()) { t++; } }
				if(t==z-1) { 
					var toAdd = $(this).parent();
					var nbsp = '&nbsp;';
					var sh = {
						name1: $(this).parent().find('input:last-child').prev().attr('name').split('-'),
						name2: $(this).parent().find('input:last-child').prev().attr('name').split('-')[1].split(']'),
						id: $(this).parent().find('input:last-child').prev().attr('id').split('-')
					};
					var shName = sh.name1[0]+'-'+(parseInt(sh.name2[0])+1)+']';
					var shId = sh.id[0]+'-'+(parseInt(sh.id[1])+1);
					var comm = {
						name1: $(this).parent().find('input:last-child').attr('name').split('-'),
						name2: $(this).parent().find('input:last-child').attr('name').split('-')[1].split(']'),
						id: $(this).parent().find('input:last-child').attr('id').split('-')
					};
					var commName = comm.name1[0]+'-'+(parseInt(comm.name2[0])+1)+']';
					var commId = comm.id[0]+'-'+(parseInt(comm.id[1])+1);
					$(this).clone(true).insertAfter(toAdd.find('input:last-child'));
					toAdd.find('input:last-child').val('').attr({name:shName, id:shId});
					$(this).next().clone(true).insertAfter(toAdd.find('input:last-child'));
					toAdd.find('input:last-child').val('').attr({name:commName, id:commId});
				}
			}
		});
		
		$('.adds').find('input').blur(function(){
			var t = new Array();
			var z = $(this).parent().find('.short').size();
			for (i=0;i<=z;i++) { if (!$(this).parent().find('.short').eq(i).val() && !$(this).parent().find('.short').eq(i).next().val()) { t.push($(this).parent().find('.short').eq(i)); } }
			if(t.length>3) { 
				t[0].next().remove();
				t[0].remove();
			}
		});
		

	});