
// per evitar conflictes amb prototype
jQuery.noConflict();

jQuery(document).ready(function($)
{
	
	if (jQuery('span.ListPlus')!== null && jQuery('span.ListMinus')!== null)
	{

		// community/collection hierarchy expansion with the plus sign
		jQuery("span.ListPlus").click(function(){
			jQuery(this).hide();
			jQuery(this).next("span.ListMinus").show();
	
			//slideDown animation doesn't work in IE6:
			if(navigator.userAgent.match("MSIE 6")) 
			{
				jQuery(this).parent().find("span.ListPlus").hide();
				jQuery(this).parent().find("span.ListMinus").show();
				jQuery(this).parent().find("span.ListMinus + span.bold ~ ul").show();
			}
			else
			{
				jQuery(this).parent().children("ul").slideDown("fast");
			}
		});
	
		// contraction with the minus sign
		jQuery("span.ListMinus").click(function(){
			jQuery(this).hide();
			jQuery(this).prev("span.ListPlus").show();

			//slideUp animation doesn't work in IE6:
			if(navigator.userAgent.match("MSIE 6")) 
			{
				jQuery(this).parent().find("span.ListPlus").show();
				jQuery(this).parent().find("span.ListMinus").hide();
				jQuery(this).parent().find("span.ListMinus + span.bold ~ ul").hide();
			}
			else
			{
				jQuery(this).parent().children("ul").slideUp("fast");
			}
		});

		jQuery("span.ListMinus").click();
	}

	/*
	//First, some css that couldn't be achieved with css selectors
	jQuery("table:not(.ds-includeSet-metadata-table) tr td:has(span[class=bold])").css({ textAlign:"right", verticalAlign:"top" });
	jQuery("table.ds-includeSet-metadata-table tr td:has(span[class=bold])").css({ textAlign:"left", verticalAlign:"top" });
	jQuery("fieldset#aspect_submission_StepTransformer_list_submit-describe ol li.odd div.ds-form-content input#aspect_submission_StepTransformer_field_dc_subject ~ input.ds-button-field").css({display: "inline"});

	//The metadata sliders for ds-artifact-item-with-popup's
	jQuery("div.item_metadata_more").toggle(
		function(){
			jQuery(this).children(".item_more_text").hide();
			jQuery(this).children(".item_less_text").show();
			jQuery(this).next().slideDown();
		},function(){
			jQuery(this).children(".item_more_text").show();
			jQuery(this).children(".item_less_text").hide();
			jQuery(this).next().slideUp();
	});*/
	
	jQuery('div.expandable').expander({
		slicePoint: 500,
		expandText: '[+]',
		userCollapseText: '[-]'
	});

	jQuery('span.read-more:first').children('a:first').attr("href");

	jQuery('div.expandable2').expander({
		slicePoint: 0,
		expandPrefix: '',
		expandText: '>',
		expandSpeed: 100,
		userCollapse: false,
		widow: 0,

		beforeExpand: function($this) 
		{
			$this.hide();
			jQuery('div.expandable2').css('float','left');
			jQuery('span.details').css('display','none');
			jQuery('span.read-more').css('display','inline');
			jQuery($this.children()[0]).css('display','none');
			jQuery('div.expandable2').parent().children(':first-child').css('color','#585a5b');
			jQuery('div.expandable2').parent().children(':first-child').css('background','url("/themes/RECERCAT/Imatges/fletxa_menu2.png") no-repeat scroll left 4px transparent');
			jQuery('div.expandable2').parent().children(':first-child').css('padding-left','10px');

		},
		afterExpand: function($this)
		{
			$this.css('float','none');

			$this.show();
			$this.parent().children(':first-child').css('color','#0032aa');
			$this.parent().children(':first-child').css('background','url("/themes/RECERCAT/Imatges/fletxa_menu3.png") no-repeat scroll left 5px transparent');
			$this.parent().children(':first-child').css('padding-left','13px');
		},
		onCollapse: function($this)
		{
			$this.css('float','right');
			$this.parent().children(':first-child').css('color','red');
		}

	});

	jQuery('div.expandable2:eq(1)').children(':first-child').children(':first-child').click();
 	jQuery("#aspect_submission_StepTransformer_div_submit-describe").validationEngine('attach');

});

var altura = 0; var velocidad = 10; 

function extender()
{ 
	var objeto = document.getElementById('textplus'); 
	objeto.style.visibility = 'visible'; 
	altura ='126'; 
	document.getElementById("plus").innerHTML = '[-]'
	objeto.style.height = '126px'; 
}

function contraer()
{ 
	var objeto2 = document.getElementById('textplus'); 
	altura = 0; 
	document.getElementById("plus").innerHTML = '[+]' 
	objeto2.style.visibility = 'hidden'; 
	objeto2.style.height = '0px'; 
} 

function extender_contraer()
{ 
	if (altura <= 0) extender(); 
	else contraer();
}

