Here is my function to pdfs. I use a string buffer to take values from the search boxs to make the search parameter for when it opens. I got the code for the buffer online because there isnt anything built in, and im not sure if i'm using it correctly.

Code:
function openPDFWord(thisObj, pdfURL) {
//For Opening PDF files
	function StringBuffer() { 
   		this.buffer = []; 
	} 
	StringBuffer.prototype.append = function append(string) { 
		this.buffer.push(string); 
		return this; 
	};
	StringBuffer.prototype.toString = function toString() { 
		return this.buffer.join(""); 
	}; 
	var searchA = document.getElementById("form1:hiddenAllWord").value;
	var searchE = document.getElementById("form1:hiddenExactPhrase").value;
	var searchT = document.getElementById("form1:hiddenAtLeastOneWord").value;
	if(searchA != null || searchE != null ||searchT != null){
	  if(searchA != null)
	    buf.append(searchA);
	  if(searchE != null)
	    buf.append(searchE);
	  if(searchT != null)
	    buf.append(searchT);
	}
	search = buf.toString();
	if (search != null) {
		search = "#search=%22" + search + "%22";
		return search;
	} else
		search = null;
	formTitleId = thisObj.id.substr(0,thisObj.id.lastIndexOf(':')) + ":hiddenFormTitle";
	formTitle = document.getElementById(formTitleId).value;
	globalHTML="<html><head><title>" + formTitle + "</title></head>"
		+"<frameset><frame src='" + pdfURL + "'></frame>"
		+"</frameset></html>";
	window.open("javascript:opener.globalHTML","_blank","resizable=yes,menubar=yes,toolbar=no");
	return false;
}