function ShowHideParenthetically( oElem ) {
	
	var sBlockId = oElem.id;
	var iBlockNum = sBlockId.substr(sBlockId.length - 1);
	
	var oLeftParBlock = document.getElementById('prod_block_' + iBlockNum);
	var oRightParBlock = document.getElementById('prod_block__' + iBlockNum);
	
	if(cmnMatch_class( oElem, "par_cally_hide" ) ){
		cmnSet_class( oElem, "par_r_cally", "par_cally_hide" );
		cmnSet_class( oLeftParBlock, "par_l_cally", "par_cally_hide" );
	}
	else{
		cmnSet_class( oElem, "par_cally_hide", "par_r_cally" );
		cmnSet_class( oLeftParBlock, "par_cally_hide", "par_l_cally" );
	}
}

function cmnSwitch_class( eOn, sClass_name, sInstead ){
	if( cmnMatch_class( eOn, sClass_name ) ){
		cmnSet_class( eOn, sInstead, sClass_name );
	}else{
		cmnSet_class( eOn, sClass_name, sInstead );
	}
}

function cmnRemove_class( eOn, sClass_name ){
	cmnSet_class( eOn, "", sClass_name );
}

function cmnSet_class( eOn, sClass_name, sInstead ){
	if( eOn ){
		sClass_name = ( sClass_name.length ) ? sClass_name.replace( /(^\s+|\s+$)/, "" ) : "";
		if( eOn.className.length ){
			var sOld = sClass_name;
			if( sInstead && sInstead.length ){
				sInstead = sInstead.replace( /\s+(\S)/g, "|$1" );
				if( sOld ){
					sOld += "|";
				}
				sOld += sInstead;
			}
			eOn.className = eOn.className.replace( new RegExp("(^|\\s+)(" + sOld +")($|\\s+)", "g"), "$1" );
		}
		eOn.className += ( eOn.className.length && sClass_name ? " " : "" ) + sClass_name;
	}
}

function cmnMatch_class( eOn, sClass_name ){
	return ( sClass_name && eOn.className && eOn.className.length && eOn.className.match( new RegExp("(^|\\s+)(" + sClass_name +")($|\\s+)") ) );
}

function cmnAdd_event( eOn, sEvent_type, ptrFunction ){
	if( eOn.addEventListener ){
		eOn.addEventListener( sEvent_type, ptrFunction, false );
	}else{
		if( !ptrFunction.$$guid ){ ptrFunction.$$guid = cmnAdd_event.guid++; }
		if( !eOn.events ){ eOn.events = {}; }
		var aHandler = eOn.events[sEvent_type];
		if( !aHandler ){
			aHandler = eOn.events[sEvent_type] = {};
			if( eOn['on' + sEvent_type] ){ aHandler[0] = eOn['on' + sEvent_type]; }
			eOn['on' + sEvent_type] = cmnHandle_event;
		}
		aHandler[ptrFunction.$$guid] = ptrFunction;
	}
}
cmnAdd_event.guid = 1;

function cmnSet_cookie( sName, vValue, dExpires ){
   document.cookie = sName + "=" + escape( vValue )
	   + ( dExpires == null ? "" : ( "; expires=" + dExpires.toGMTString() ) )
	   + "; path=/";
}

function cmnGet_cookie( sName ){
	return cmnPairs_string_get_value( document.cookie, sName );
}

function cmnPairs_string_get_value( sText, sName, sFrom, sBefore ){
	var sValue = "";
	if( sText ){
		if( !sFrom ) sFrom = "=";
		if( !sBefore ) sBefore = ";";
		sText = sText.replace( new RegExp( "(" + sBefore + ")\\s+", "g" ), "$1" );
		var iStart = sText.indexOf( sBefore + sName + sFrom );
		if( iStart >= 0 ){
			iStart += ( sBefore.length + sName.length + sFrom.length );
		}else{
			iStart = sText.indexOf( sName + sFrom );
			if( iStart == 0 ){
				iStart += ( sName.length + sFrom.length );
			}else{
				iStart = -1;
			}
		}
		if( iStart >= 0 ){
			var iEnd = sText.indexOf( sBefore, iStart );
			if( iEnd < 0 ){
				iEnd = sText.length;
			}
			sValue = sText.substring( iStart, iEnd );
		}
	}
	return sValue;
}

function ShowDescription(iDescrNum) {
	var oDescription = document.getElementById("block_" + iDescrNum);
	if(cmnMatch_class(oDescription, "hidden")){
		cmnSet_class( oDescription, " ", "hidden" );
		document.getElementById("footer").style.top = document.getElementById("footer").parentNode.offsetHeight - 37 + "px";
	}
	else{
		cmnSet_class( oDescription, "hidden", " " );
		document.getElementById("footer").style.top = document.getElementById("footer").parentNode.offsetHeight - 37 + "px";
	}
}