$(document).ready(function(){
	$('#backgroundColor').ColorPicker({
		targetID : '',
		newTimeout : '',
		
		eventName: 'focus',
		
		onSubmit: function(hsb, hex, rgb, el) {
			$(el).val("#" + hex);
			$(el).ColorPickerHide();
		},
		onChange: function(cal, hex, el) {
			$("#" + targetID).val('#' + hex);
		},
		onBeforeShow: function () {
			$(this).ColorPickerSetColor(this.value);
			targetID = this.id;
		}
	});
	
	setType();
	setRepeat();
});

function setType()
{
	if ($("#backgroundType").val() == "color")
	{
		$("#backgroundImageShow").css("display", "none");
	}
	else
	{
		$("#backgroundImageShow").css("display", "inline");
	}
}

function setRepeat()
{
	if ($("#repeatType").val() == "no-repeat")
	{
		$("#repeatDiv").css("display", "inline");
	}
	else
	{
		$("#repeatDiv").css("display", "none");
	}
}