

function hideFadeShowAppear(targetDiv, targetSpan) {
	
	var openedIconSpan = document.getElementById(targetSpan);
	
	if (checkIfDisplayPropertyEqualsNone(targetDiv)) {
		Effect.Appear(targetDiv);
		
		if(openedIconSpan != null && openedIconSpan != undefined)
			openedIconSpan.setAttribute("class", "opened");
		
	} else {
		Effect.Fade(targetDiv,{ duration: 0.1 });
		
		if(openedIconSpan != null && openedIconSpan != undefined)
			openedIconSpan.setAttribute("class", "");
	}
}

function hideFadeShowAppearclose(targetDiv1,targetDiv2,targetSpan1,targetSpan2 ) {
	
		var closedIconSpan1 = document.getElementById(targetSpan1);
		var closedIconSpan2 = document.getElementById(targetSpan2);
		
		if(closedIconSpan1 != null && closedIconSpan1 != undefined)
			closedIconSpan1.setAttribute("class", "");
			
		if(closedIconSpan2 != null && closedIconSpan2 != undefined)
			closedIconSpan2.setAttribute("class", "");
				
		Effect.Fade(targetDiv1,{ duration: 0.1 });
		Effect.Fade(targetDiv2,{ duration: 0.1 });
}

function checkIfDisplayPropertyEqualsNone(targetDiv)
{
	var target = document.getElementById(targetDiv);
	if(target != null) {
		if (target.style.display=='none') {
			return true;
		} else {
			return false;
		}
	}
	else {
		// if nothing is found return true, this way the element will continue visible 
		return true;
	}
}

function hideFadeShowAppearFieldsWrapper(target) {
	hideFadeShowAppear(target + "_groupBox");
}
function changeClassToHideShow(target) {
	
	var content = document.getElementById(target + "_content");
	var group = document.getElementById(target + "_groupBox");
	var link = document.getElementById(target + "_link");
	
	if(group != null && link != null && content != null) {
		
		if(content.style.display=='none') {
			Effect.Appear(content , { beforeStart : function() {
				group.setAttribute("class", "groupBox");
				link.setAttribute("class", "icon");
				}});
		} else {
			Effect.Fade(content, { afterFinish : function() {
				group.setAttribute("class", "groupBox closed");
			link.setAttribute("class", "icon");
				}});
		}
	}
}