(function($){
	var initLayout = function() {
		$('#CP1,#CP2,#CP3,#CP4,#CP5,#CP6,#CP7,#CP8,#CP9,#CP10,#CP11,#CP12,#CP13,#CP14,#CP15,#CP16,#CP17,#CP18,#CP19,#CP20,#CP21,#CP22,#CP23,#CP24,#CP25,#CP26,#CP27,#CP28,#CP29,#CP30,#CP31,#CP32,#CP33,#CP34,#CP35,#CP36,#CP37,#CP38,#CP39,#CP40,#CP41,#CP42,#CP43,#CP44,#CP45,#CP46,#CP47,#CP48,#CP49,#CP50,#CP51,#CP52,#CP53,#CP54,#CP55,#CP56,#CP57,#CP58,#CP59,#CP60,#CP61,#CP62,#CP63,#CP64,#CP65,#CP66,#CP67,#CP68,#CP69,#CP70').ColorPicker({
			onSubmit: function(hsb, hex, rgb, el) {
				$(el).val(hex);
				$(el).ColorPickerHide();
				$(el).focus();
				$(el).parent().submit();
			},
			onBeforeShow: function () {
				$(this).ColorPickerSetColor(this.value);
			}
			
		})
		.bind('keyup', function(){
			$(this).ColorPickerSetColor(this.value);
		});
		$('#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) {
				$('#colorSelector div').css('backgroundColor', '#' + hex);
			}
		});
	};
	
	var showTab = function(e) {
		var tabIndex = $('ul.navigationTabs a')
							.removeClass('active')
							.index(this);
		$(this)
			.addClass('active')
			.blur();
		$('div.tab')
			.hide()
				.eq(tabIndex)
				.show();
	};
	
	EYE.register(initLayout, 'init');
})(jQuery)
