// jQuery action script
$('document').ready(function(){

	$('.corner20').cornerz({
		radius: 20
	});
	$('.corner10').cornerz({
		radius: 10
	});
	$('#nav li, #nav li a').cornerz({
		radius: 10,
		corners: "tl tr",
		background: '#d2dfe8'
	});
	
	$('#content-panel').cornerz({
		radius: 20,
		corners: "tr",
		background: "#d2dfe8"
	}).cornerz({
		radius: 20,
		corners: "bl br",
		background: "#bbccd7"
	});
	$('.work-thumb').cornerz({
		radius: 10,
		background: "#c9d8e2"
	});
	$('.input-corner10').cornerz({
		radius: 10,
		background: "#c9d8e2"
	});
	$('#tech-used dt').cornerz({
		radius: 20,
		background: "#c9d8e2"
	});
	$('.input-corner20, .message').cornerz({
		radius: 20,
		background: "#c9d8e2"
	});
	$('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth: 19, scrollbarMargin:10, wheelSpeed:30});
	$('#tech-used dt')
		.css({
			cursor:'pointer'
		})
		.hover(
			function(e){
				target = $(e.target);
				target.animate({opacity:.5},500)
			},
			function(){
				//var target = $(e.target);
				target.animate({opacity:1},500)
			}
		)
		.click(function(){
			$('#tech-used dd:visible').fadeOut(500);
			$(this).next('dd')
				.fadeIn(1000);
		});
	
	$('#tech-used dd')
		.css({
			position: 'absolute',
			top: 0,
			right: '-67%'
		})
		.each(function(){
			var tmpsrc = $(this).prev('dt').children('img:first').attr('src');
			var tmpalt = $(this).prev('dt img').attr('alt');
			$(this).prepend('<span class="mini-badge"><img src="' + tmpsrc + '" alt="'+tmpalt+'" width="60" height="60" /></span>');
			$('.mini-badge').cornerz({
				radius: 10,
				background: "#c9d8e2"
			});
		})
		.cornerz({
			radius: 20,
			background: "#c9d8e2"
		})
		.hide();
		$('a[rel="external"]')
  			.attr({
    			target: "_blank", 
    			title: "Opens in a new window"
  			})
  			.css({
  				background:'transparent url(/img/extlink_wht.gif) right 50% no-repeat',
  				paddingRight:'15px'
  			});
  	$('.contact-submit').click(function(){
  		if($('#ContactsName').val() == '' || $('#ContactsEmailAddress').val() == '' || $('#ContactsMessage').val() == '')
  		{
  			alert('...oops\n\nWe really need you to fill in all the fields before you hit send.\n\nThanks!');
  			return false;
  		}
  	});
});