var bodyNodes = document.body.innerHTML;
var lnkPrintId = "lnkPrint";
var oPaddingLeft;
var oBgColor;

function togglePrint( theprintCmd )
{
  if ( theprintCmd.tagName == "A" )
  {
  	for( var i = 0; i < theprintCmd.childNodes.length; i++ )
    {
  		if ( theprintCmd.childNodes[i].nodeType == 3 )
  		{
				if ( theprintCmd.id.length == 0 )
				{
					theprintCmd.id = "lnkPrint";
				}
  			if ( theprintCmd.childNodes[i].nodeValue.toLowerCase() == "print" )
  			{										
  				theprintCmd.childNodes[i].nodeValue = "Normal View";				
  				printMe();
  			}
  			else
  			{
 					document.body.innerHTML = bodyNodes;
					document.body.style.backgroundColor = oBgColor;
					document.body.style.paddingLeft = oPaddingLeft;
					document.getElementById( lnkPrintId ).childNodes[i].nodeValue = "Print";
  			}
  		}
    }
  }
  else
  {
  	printMe();  
  }
}

function printMe()
{
  var contentNode = document.getElementById('dvContent').cloneNode(true);
  var footerNode = document.getElementById('dvFooter').cloneNode(true);
	
	bodyNodes = document.body.innerHTML;
	oPaddingLeft = document.body.style.paddingLeft;
	oBgColor = document.body.style.backgroundColor;
		
 	document.body.innerHTML = "";	
  document.body.appendChild( contentNode );
  document.body.appendChild( footerNode );
 	document.body.style.paddingLeft = "25px;";
	document.body.style.backgroundColor = "white"; 
	
	window.print();
}