
function breakout_of_frame()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}

function getParameter(name)
{
	parms = getParameters();
	if(parms) {
		for (var i=0;i<parms.length;i++)
		{
			theParm = parms[i].split("=");
			if(theParm[0] == name)
				return theParm[1];
		}
	}
}

function getParameters()
{
	var _c="";
	var _l=document.location.toString().split("?"); /* now _l is the parameters */
	/* document.write("_l="+_l+"<BR>"); */

	var _m ="";
	if(_l[1]) {
	 	_m = _l[1].split("&"); /* now _m is an array of all parameters */
	}
/*
	if(_m[0]) _c="List of parameters:<BR>";
	for (var i=0;i<_m.length;i++)
	{
	  _c+=_m[i]+"<BR>";
	}
	document.write(_c);
*/
	return _m;
}
/*
document.write(getParameter("header") + "<br>");
if( ! (getParameter("header")=="printer") ) {
	document.write("Main Content");
} else {
	document.write("I'm printer frieldly");
}
*/
function PrinterFriendly()
{
	base = document.location.protocol+"//"+document.location.host+ document.location.pathname;
	query = document.location.search;
	newparm = "header=printer";
	if(query == "") {
		query = "?" + newparm;
	} else {
		query += "&" + newparm;
	}
	document.location.href = base + query;
}

function printPage()
{
	var da = (document.all) ? 1 : 0;
	var pr = (window.print) ? 1 : 0;

	if (pr) // NS4, IE5
		window.print()
	else if (da) 	// IE4 (Windows)
		vbPrintPage()
	else // other browsers
	{
		alert("Sorry, your browser doesn't support this feature.");
		return ;
	}

	if (da)
	with (document)
	{
		 if (!pr) with (document)
		{
			  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
			  writeln(''<'' + 'script LANGUAGE="VBScript">');
			  writeln('Sub window_onunload');
			  writeln('  On Error Resume Next');
			  writeln('  Set WB = nothing');
			  writeln('End Sub');
			  writeln('Sub vbPrintPage');
			  writeln('  OLECMDID_PRINT = 6');
			  writeln('  OLECMDEXECOPT_DODEFAULT = 0');
			  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
			  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
			  writeln('  On Error Resume Next');
			  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
			  writeln('End Sub');
			  writeln(''<'' + '/script>');
		}
	}
}
