$(document).ready(function(){
	initBlocks();
	ShowImages();
	initSelect();
});
function initBlocks(){
	//console.log(Drupal);
	$('fieldset.group-location').hide();
	$('div.location-terms').hide();
	$('fieldset.group-props').hide();
	$('select#edit-reg-obj').change(function(){
		var product = $('select#edit-reg-obj').val();
		switch (product) {
		case String(Drupal.settings.pf.categoryTerms.talent):
			$('fieldset.group-talent').show();
			$('div.talent-terms').show();
			$('fieldset.group-location').hide();
			$('div.location-terms input[@type="checkbox"]:checked').removeAttr('checked');
			$('div.location-terms').hide();
			$('fieldset.group-props').hide();
		break;
		case String(Drupal.settings.pf.categoryTerms.location):
			$('fieldset.group-talent').hide();
			$('div.talent-terms').hide();
			$('div.talent-terms input[@type="checkbox"]:checked').removeAttr('checked');
			$('fieldset.group-props').hide();
			$('fieldset.group-location').show();
			$('div.location-terms').show();
		break;
		case String(Drupal.settings.pf.categoryTerms.prop):
			$('fieldset.group-props').show();
			$('fieldset.group-talent').hide();
			$('div.talent-terms').hide();
			$('fieldset.group-location').hide();
			$('div.location-terms').hide();
			$('div.talent-terms input[@type="checkbox"]:checked').removeAttr('checked');
			$('div.location-terms input[@type="checkbox"]:checked').removeAttr('checked');
		break;
	}
	});
}
function ShowImages(){
	$('#content div.main-image img').not(':first').hide();
	$('div.all-images a').click(function(){
		//alert(1);
		var index = $('div.all-images a').index(this);
		$('#content div.main-image img').hide();
		$('#content div.main-image img:eq('+index+')').show();
		//$('.node-type-actor #content div.main-image img').attr('src',new_src);
		return false;
	})
};
function initSelect(){
	$('#edit-terms-wrapper #edit-terms').selectbox();
}