function PrintInNewPage(Value1)
 {
     var NewPage = window.open('test.htm', '_blank');
     NewPage.document.writeln("<html>");
     NewPage.document.writeln("<head>");
     NewPage.document.writeln("<link -------------------- >");
     NewPage.document.writeln("</head>");
     NewPage.document.writeln("<body style='direction:rtl;text-align:right;'>");
     NewPage.document.writeln("<center><div id='test' style='text-align:justify;line-height:25px;padding:10px;width:650px;border:1px solid #999999;font-family:tahoma;'>");
     NewPage.document.writeln(Value1);
     NewPage.document.writeln("</div></center>");

    NewPage.document.writeln("<!--[if IE ]>");
      NewPage.document.writeln("<object id='factory'  classid='clsid:1663ED61-23EB-11D2-B92F-008048FDD814' codebase='other/smsx.cab'  viewastext></object>");
        NewPage.document.writeln("<script language='javascript'>");
        NewPage.document.writeln("function Print(){");
          NewPage.document.writeln("factory.printing.header = '';");
          NewPage.document.writeln("factory.printing.footer = '';");
          NewPage.document.writeln("factory.printing.portrait = true;");
          NewPage.document.writeln("factory.printing.leftMargin = 1;");
          NewPage.document.writeln("factory.printing.topMargin = 1;");
          NewPage.document.writeln("factory.printing.rightMargin = 1;");
          NewPage.document.writeln("factory.printing.bottomMargin = 1;");
          NewPage.document.writeln("factory.printing.Preview();");
        NewPage.document.writeln("}Print();");
      NewPage.document.writeln("</script>");
    NewPage.document.writeln("<![endif]-->");
    NewPage.document.writeln("<![if !IE]>");
      NewPage.document.writeln("<script language='javascript'> window.print();</script>");
    NewPage.document.writeln("<![endif]>");
     NewPage.document.writeln("</body>");
     NewPage.document.writeln("</html>");
     NewPage.window.print();
     return false;
 }
