$(document).ready(function(){
	$('select.combobox')
		.combobox(
		{ 
			comboboxContainerClass: "comboboxContainer", 
			comboboxValueContainerClass: "comboboxValueContainer", 
			//comboboxValueContentClass: "comboboxValueContent", 
			comboboxDropDownClass: "comboboxDropDownContainer", 
			comboboxDropDownButtonClass: "comboboxDropDownButton", 
			//comboboxDropDownItemClass: "comboboxItem", 
			//comboboxDropDownItemHoverClass: "comboboxItemHover", 
			//comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader", 
			//comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer", 
			animationType: "slide", 
			width: "100px",
			height: "20px"
		});
	
	
	$('a#addressFormTrigger')
		.click(function(){
			$('div#addressForm').toggle();
			$('.comboboxValueContainer').height(19);
			$('.comboboxValueContainer').width(100);
			$('.comboboxDropDownContainer').css('min-height:19');
			$('.comboboxDropDownContainer').width(239);
			$('.comboboxDropDownButton').prev().width(82);
			
		});
		
	$('a#categoryFormTrigger')
		.click(function(){
			$('div#categoryForm').toggle();
		});
	$('a#bannerFormTrigger')
		.click(function(){
			$('div#bannerForm').toggle();
		});
		
	$('a.costFormTrigger')
		.click(function(){
			$(this).parent().parent().next().toggle();
			$(this).parent().parent().next().next().toggle();
		});
	$('a.helpFormTrigger')
		.click(function(){
			$(this).next().toggle();
			$(this).next().next().toggle();
		});
		
	$('a.subCategoryFormTrigger')
		.click(function(){
			$(this).parent().next().children().toggle();
			
		});
		
	$('a.materialFormTrigger')
		.click(function(){
			
			$(this).next().toggle();
			
		});
	$('a.tagFormTrigger')
		.click(function(){
			
			$(this).next().toggle();
			
		});
	$('div#smallPhotos img')
		.click(function(){
			var $alt = $(this).attr('alt');
			$('div#medPhoto img').attr({src: $alt});
			
			if($(this).next().attr('class').length > 12){
				var $newphoto = $(this).next().attr('href');
				
				$(this).siblings('a').addClass('gallery');
				$(this).next().removeClass('gallery');
				
				$('div#medPhoto a').attr({href: $newphoto});
				
				$('a.gallery').lightBox({
				imageLoading: '/public/images/lightbox-ico-loading.gif',
				imageBtnClose: '/public/images/lightbox-btn-close.gif',
				imageBtnPrev: '/public/images/lightbox-btn-prev.gif',
				imageBtnNext: '/public/images/lightbox-btn-next.gif'
				});
			}
		});
		$('a.gallery').lightBox({
			imageLoading: '/public/images/lightbox-ico-loading.gif',
			imageBtnClose: '/public/images/lightbox-btn-close.gif',
			imageBtnPrev: '/public/images/lightbox-btn-prev.gif',
			imageBtnNext: '/public/images/lightbox-btn-next.gif'
		});
		
		$('a.formTrigger')
			.click(function(){
				$('.comboboxValueContainer').height(19);
				$('.comboboxValueContainer').width(100);
				$('.comboboxDropDownContainer').css('min-height:19');
				$('.comboboxDropDownContainer').width(239);
				$('.comboboxDropDownButton').prev().width(82);
				$(this).parent().next().children().toggle();
			
		});
				
	 $('#pcolor').attachColorPicker();

	
});
