rem: var reg = new RegExp( "&__format=htm[l]{0,1}", "gi" ); if ( action.search( reg ) > -1 ) { action = action.replace( reg, "&__format=pdf" ); } 
add: action = action.replace( reg, "$1=pdf" ); 
context: 	__beh_pdf : function( id )	{			var docObj = document.getElementById( "Document" );		if ( !docObj || birtUtility.trim( docObj.innerHTML ).length <= 0)		{			alert ( "Report document should be generated first." );				return;		}			else		{				var divObj = document.createElement( "DIV" );			document.body.appendChild( divObj );			divObj.style.display = "none";					var formObj = document.createElement( "FORM" );			divObj.appendChild( formObj );			// Replace "html" to "pdf"			var action = window.location.href;			if( action.toLowerCase( ).indexOf( '&__format=' ) < 0 )			{				action = action + "&__format=pdf";			}			else			{				var reg = new RegExp( "&__format=htm[l]{0,1}", "gi" );				if ( action.search( reg ) > -1 )				{					action = action.replace( reg, "&__format=pdf" );				}											}			formObj.action = action;			formObj.method = "post";						formObj.submit( );		}	},
meta: 855	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/855/6d757c5861e23bf23cf2b963c6d5b43e802ad26f/BirtReportDocument.js/clean/viewer/org.eclipse.birt.report.viewer/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js