TriggerGallery();
if(document.getElementById('location_select')){
	var locationSelect = document.getElementById('location_select');
	var hiddeName = document.getElementById('location_name');
	locationSelect.onchange=function(){
		var selIndex = locationSelect.selectedIndex;
		var optionText = locationSelect.options[selIndex].text;
		hiddeName.value = optionText;
	};

	var typeSelect = document.getElementById('type-select');
	var hiddenType = document.getElementById('type_name');
	typeSelect.onchange=function(){
		var selIndex = typeSelect.selectedIndex;
		var optionText = typeSelect.options[selIndex].text;
		hiddenType.value = optionText;
	};
}


function TriggerGallery(){
	if(!$('gallery-thumbs')){
		return false;
	}
	var items = $$('#gallery-thumbs img.keyvisual');

	items.each(function(item){
		item.onclick = function(event){
			//alert(item.id);
			var idString = item.id;
			var aId = idString.split('-');
			var image_id = aId[1];
			xajax_xajaxTriggerGallery.DisplayImage(image_id);
			//xajax_xajaxTriggerGallery.Test();
			return false;
		};
	});
}

function HiliteThumb(id){

	var items = $$('#gallery-thumbs img.keyvisual');
	items.each(function(item){
		if(item.id == id){
			Effect.Fade(id, {to: 0.6});
			item.addClassName('active');
		}else{
			Effect.Appear(item);
			item.removeClassName('active');
		}
	});
}
