var expandedImageSource = "";
var shrunkImageSource = "";


// Function which shrinks sections 
function shrinkSection( imageName, sectionName ) {
	// set image source 
	document.images[ imageName ].src = shrunkImageSource;
	// set the text
	// Internet Explorer
	if ( document.all) {
		document.all[ sectionName ].innerHTML = "";
	}
	// Netscape 6
	else if ( document.getElementById ) {
		document.getElementById( sectionName ).innerHTML = "";
	}
}


// Function checks whether section is expanded or not and acts appropriately
function checkSection( fieldName, imageName, sectionName, textValue ) {
	// check value of field
	if ( document.forms[ "formExpand" ].elements[ fieldName ].value == 1 ) { 
		// if field value is expanded then shrink section and set field
		shrinkSection( imageName, sectionName );
		document.forms[ "formExpand" ].elements[ fieldName ].value = 0;
	}
	else {
		// if field value is shrunk then expand section and set field value
		expandSection( imageName, sectionName, textValue );
		document.forms[ "formExpand" ].elements[ fieldName ].value = 1;
	}
}


function expandSection( imageName, sectionName, textValue ) {
	// set image source 
	document.images[ imageName ].src = expandedImageSource;
	// get the HTML to add to the answer
	openStyle = "<span class=\"ajudaResposta\">";
	closeStyle = "</span>"
	textValue = openStyle + textValue + closeStyle;
	// set the text
	// Internet Explorer
	if ( document.all) {
		document.all[ sectionName ].innerHTML = textValue;
	}
	 // Netscape 6
	else if ( document.getElementById ) {
		document.getElementById( sectionName ).innerHTML = textValue;
	}
}