jQuery.noConflict()(function($){
	$(document).ready(function() {  

	$('#colorSelector').ColorPicker({
				color: '#0000ff',
				onShow: function (colpkr) {
					$(colpkr).fadeIn(500);
					return false;
				},
				onHide: function (colpkr) {
					$(colpkr).fadeOut(500);
					return false;
				},
				onChange: function (hsb, hex, rgb) {
					
					var color = hex;
					$.cookies.set('inkd_skin_light', hex);
					
		$('#tagline, a:link, a:visited').css('color', '#' + hex);
		$('.circle-carousel, #port-list-active').css('background-color', '#' + hex);
		$('.highlight, #skills li, .port-active a, .pag-active, .post-date, #awards li span').css('background-color', '#' + hex);
		$('blockquote').css('border-color', '#' + hex);	
		$('#main-nav li #nav-active, .highlight-ruler, h1').css('border-bottom-color', '#' + hex);	
		$('#header-social li a').css('color', '#8a8a8a');	
		$('#main-nav > li > a, #social-nav li a,.port-columns li span a, .post-head h1 a ').css('color', '#000');	
		$('#main-nav li ul li a, a.btn, #social-nav .tab-active a, #port-filter a, #port-list-active').css('color', '#fff');	


		   $('a.btn,.port-prev span, .port-next span, .form input[type="submit"], #team-info li ul li a').hover( function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '#000');
		   });
		


		   $('.pagination li, #port-filter li a').hover( function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '#000');
		   });
			
		   $('.port-active a, .pagination .pag-active').live('hover', function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '#' + hex);
		   });		 	

			$('#port-filter li a').click(function(){
				$(this).parents('#port-filter').find('a').css('background-color', '#000');
				$(this).css('background-color', '#' + hex);			
		   });		
		   
		   	$('.paginate-nav .pagination li').click(function(){
				$('.paginate-nav').find('li').css('background-color', '#000');
				$(this).css('background-color', '#' + hex);
				$('.pag-active').css('background-color', '#' + hex);
		   });	
				
	
		   $('#social-nav li a').hover( function(){
			 $(this).css('color', '#fff').css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '').css('color', '#000');
		   });
		   
			$('#social-nav a').click(function(){
				$(this).parents('#social-nav').find('a').css('background-color', '').css('color', '#000');
				$(this).css('background-color', '#000').css('color', '#fff');		
		   });	
		   
		   $('#social-nav li.tab-active a').live('hover', function(){
			 $(this).css('background-color', '#000').css('color', '#fff');
		   },
		   function(){
			 $(this).css('background-color', '#000').css('color', '#fff');
		   });			   


		   $('.port-columns li a, .port-columns li span a').hover( function(){
			 $(this).css('color', '#' + hex);
			 $(this).find('span').css('color', '#' + hex);			 
		   },
		   function(){
			  $(this).css('color', '#000');
			  $(this).find('span').css('color', '#000');			  
		   });

		   $('#header-social li a').hover( function(){
			 $(this).css('color', '#000');
			 $(this).children().css('background-color', '#' + hex);		 
		   },
		   function(){
			  $(this).css('color', '#8a8a8a');
			  $(this).children().css('background-color', '#000');		  
		   });

		   $('#main-nav li ul li a').hover( function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			  $(this).css('background-color', 'transparent');
		   });
		   
		   $('.post-head h1 a').hover( function(){
			 $(this).css('color', '#' + hex);
		   },
		   function(){
			 $(this).css('color', '#000');
		   });			   

		}
	});
		
	//Options Panel 
		$("#handle").toggle(
		function(){
			$('#handle a').addClass("opt-open");
			$('#options-panel').animate({'left':'0px'}, 800, 'swing');			
		},
		function(){
			$('#handle a').removeClass("opt-open");
			$('#options-panel').animate({'left':'-221px'}, 800, 'swing');				
		});

	//Change background image 
	$('#swatches a').click(function() {
		var swatch = $(this).attr('href');
		
		$('body').css('background-image', 'url(' + swatch + ')');
		$('#swatches').find('a').removeClass('swatch-active');
		$(this).addClass('swatch-active');
		
		$.cookies.set('inkd_background_light', swatch);
		
		return false;		
	});
	
	//Add background and skin from cookie
	var background = $.cookies.get('inkd_background_light');
	var hex = $.cookies.get('inkd_skin_light');
	if(background == null) {
	}
	else {
	$('body').css('background-image', 'url(' + background + ')');			
	}	
	
	if(hex == null) {
	}
	else {
		$('#tagline, a:link, a:visited').css('color', '#' + hex);
		$('.circle-carousel, #port-list-active').css('background-color', '#' + hex);
		$('.highlight, #skills li, .port-active a, .pag-active, .post-date, #awards li span').css('background-color', '#' + hex);
		$('blockquote').css('border-color', '#' + hex);	
		$('#main-nav li #nav-active, .highlight-ruler, h1').css('border-bottom-color', '#' + hex);	
		$('#header-social li a').css('color', '#8a8a8a');	
		$('#main-nav > li > a, #social-nav li a,.port-columns li span a,.post-head h1 a ').css('color', '#000');	
		$('#main-nav li ul li a, a.btn, #social-nav .tab-active a, #port-filter a, #port-list-active').css('color', '#fff');	


		   $('a.btn,.port-prev span, .port-next span, .form input[type="submit"], #team-info li ul li a').hover( function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '#000');
		   });
		


		   $('.pagination li, #port-filter li a').hover( function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '#000');
		   });
			
		   $('.port-active a, .pagination .pag-active').live('hover', function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '#' + hex);
		   });		 	

			$('#port-filter li a').click(function(){
				$(this).parents('#port-filter').find('a').css('background-color', '#000');
				$(this).css('background-color', '#' + hex);			
		   });		
		   
		   	$('.paginate-nav .pagination li').click(function(){
				$('.paginate-nav').find('li').css('background-color', '#000');
				$(this).css('background-color', '#' + hex);
				$('.pag-active').css('background-color', '#' + hex);
		   });	
				
	
		   $('#social-nav li a').hover( function(){
			 $(this).css('color', '#fff').css('background-color', '#' + hex);
		   },
		   function(){
			 $(this).css('background-color', '').css('color', '#000');
		   });
		   
			$('#social-nav a').click(function(){
				$(this).parents('#social-nav').find('a').css('background-color', '').css('color', '#000');
				$(this).css('background-color', '#000').css('color', '#fff');		
		   });	
		   
		   $('#social-nav li.tab-active a').live('hover', function(){
			 $(this).css('background-color', '#000').css('color', '#fff');
		   },
		   function(){
			 $(this).css('background-color', '#000').css('color', '#fff');
		   });			   


		   $('.port-columns li a, .port-columns li span a').hover( function(){
			 $(this).css('color', '#' + hex);
			 $(this).find('span').css('color', '#' + hex);			 
		   },
		   function(){
			  $(this).css('color', '#000');
			  $(this).find('span').css('color', '#000');			  
		   });

		   $('#header-social li a').hover( function(){
			 $(this).css('color', '#000');
			 $(this).children().css('background-color', '#' + hex);		 
		   },
		   function(){
			  $(this).css('color', '#8a8a8a');
			  $(this).children().css('background-color', '#000');		  
		   });

		   $('#main-nav li ul li a').hover( function(){
			 $(this).css('background-color', '#' + hex);
		   },
		   function(){
			  $(this).css('background-color', 'transparent');
		   });
		   
		   $('.post-head h1 a').hover( function(){
			 $(this).css('color', '#' + hex);
		   },
		   function(){
			 $(this).css('color', '#000');
		   });		   
		   

	 $(window).load(function() {
		$('.tweet_list a').css('color', '#' + hex);		
	 }); 

	}
}); 
});

