Print();

function getRequestVar(istr) {

        var xstr = window.location.href;
        var xloc = xstr.indexOf('?'), yloc = 0;

        istr += '=';

        if(xloc == -1) return '';
        else {
                xloc = xstr.indexOf(istr, xloc) + istr.length;
                yloc = xstr.indexOf('&', xloc)!= -1?
                        xstr.indexOf('&', xloc) : xstr.indexOf('#', xloc);
                if(yloc == -1) xstr = xstr.substring(xloc);
                else xstr = xstr.substring(xloc, yloc);
        }

        return xstr;
}

function Print() {
	var query;
	var title;
	var hiddenStyle;
	title = document.URL;
	query = title.indexOf('?');

	
	if (getRequestVar('prfview') == 'yes') {
		var requestedJSP = getRequestJsp();

		if(requestedJSP == 'homepage.jsp'){
			//Added for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');
		}else if(requestedJSP == 'overview.jsp'){
			//Added for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added  for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');			
		}else if(requestedJSP == 'prod_summary.jsp'){
			//Added  for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added  for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');			
		}else if(requestedJSP == 'learning_summary.jsp'){
			//Added  for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added  for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');			
		}else if(requestedJSP == 'training_information.jsp'){
			//Added  for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added  for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');			
		}else if(requestedJSP == 'event_calendar.jsp'){
			//Added for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added  for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');			
		}else if(requestedJSP == 'taxonomy.jsp'){
			//Added for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');
		} else if(requestedJSP == 'application.jsp'){
			//Added for Search History Start Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/pbar_printerfriendly.css" type="text/css"/>');
			//Added for Search History End Jan 28 ,2008
			document.write('<link rel="stylesheet" href="/shared/stylesheets/toplevel_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/phase2_printerfriendly.css" type="text/css" />');
			//Added for ASP redesign Start May 12 ,2009 
			document.write('<link rel="stylesheet" href="/files/abstract/misc/TOPLEVEL_DELTA_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/shared/stylesheets/serpstyles_printerfriendly.css" type="text/css"/>');
			document.write('<link rel="stylesheet" href="/search/stylesheets/style_printerfriendly.css" type="text/css"/>');			
			//Added for ASP redesign End May 12 ,2009 
		}
	}
} 

function printPage() {
	////Added for Search History Start Jan 28 ,2008
	//print_page_metrics();
	call_pbar_metrics('pb_print_page');
	//Added for Search History Start Jan 28 ,2008
	var param = "&prfview=yes";
	new_url = window.location.href + param;
	var obj = window.open(new_url,'SRWindow','resizable=yes,menubar=yes,scrollbars=yes,toolbar=no,status=yes,location=yes');
	obj.focus();
}

function getRequestJsp () {
	var str = new String();
	str = window.location.href;
	str = str.substring(str.lastIndexOf("/") + 1,str.indexOf("?"));	
	return(str);
}


function displayPrinterFriendlyMessage() {
	var query;
	var title;
	var hiddenStyle;
	title = document.URL;
	query = title.indexOf('?');

	
	if (getRequestVar('prfview') == 'yes') {
		var requestedJSP = getRequestJsp();
		var printerFriendlyMessage;
		var printerFriendlyMessage_Text;
		var printerFriendlyMessage_Header;
		if(requestedJSP == 'homepage.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}else if(requestedJSP == 'overview.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}else if(requestedJSP == 'prod_summary.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print the information under other tabs (Software and Tools, Buy/Parametrics), close this window, select a Tab, and click Export to Excel. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}else if(requestedJSP == 'learning_summary.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print (Orientation tab only). To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}else if(requestedJSP == 'training_information.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}else if(requestedJSP == 'event_calendar.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}else if(requestedJSP == 'taxonomy.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print the tables, close this window and click Export to Excel. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		} else if(requestedJSP == 'application.jsp'){
			printerFriendlyMessage = document.getElementById("previewMessage");
			printerFriendlyMessage_Header = document.createElement('h5');
			//Modified for ASP redesign Start  May 12 , 2009
			printerFriendlyMessage_Text = document.createTextNode('This is a preview of the page you are about to print. To print the information under other tabs (Software and Tools), close this window, select a Tab, and click Export to Excel. To print this view, use the Print command in your browser (in the File menu, choose Print).');
			//Modified for ASP redesign End  May 12 , 2009

			printerFriendlyMessage.appendChild(printerFriendlyMessage_Header);
			printerFriendlyMessage_Header.appendChild(printerFriendlyMessage_Text);
		}
	}
} 

