function viewprint() {
var tag1 = "start"+"view";
var tag2 = "end"+"view";
var postag1 = 0;
var postag2 = 0;
var corpslen;
var i=0;
var tmppostag1 = 0;
var tmppostag2 = 0;
var t1=0;
var corps = "";
var theader = "";
var ico = '<a href="javascript:window.print();">Imprimer</a>';
var win_opt= "toolbar=0,location=0,directories=0,status=0,menubar=1,";
win_opt += "scrollbars=1,resizable=1,copyhistory=0,width=1000,height=800";

theader = document.getElementsByTagName("head")[0].innerHTML;
if(document.getElementById("anact-print-header")){
entete=  document.getElementById("anact-print-header").innerHTML;
}
if(document.getElementById("anact-print-footer")){
footer=  document.getElementById("anact-print-footer").innerHTML;
}

corps = document.getElementById("anact-page-content").innerHTML;

/*
corpslen =corps.length;
//corps=document.getElementById("anact-page-content").innerHTML;

tmppostag1 =corps.indexOf(tag1);
i=tmppostag1;
if(tmppostag1<corpslen){
while((t1<2)&&(i<corpslen)){

if(corps.charAt(i)==">"){
t1++;
}
i++;
}
}
tmppostag1=i;
postag1=tmppostag1;

tmppostag2=corps.indexOf(tag2);
i=tmppostag2;
t1=0;
if(tmppostag2<corpslen){
while((t1<1)&&(i>0)){
if(corps.charAt(i)=="<"){
t1++;
}
i--;
}
}



tmppostag2=i+1;


postag2=tmppostag2;

corps = corps.substring(postag1,postag2);
*/
//document.getElementById("tte").value+=corps;


NewWindow= window.open("","Impression",win_opt);
doctypee='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
NewWindow.document.write(doctypee+"<HTML><BODY>"+theader+"</HEAD><BODY>"+ico + "<BR>"+'<div class="anact-page">'+entete+'<div class="anact-page-content" id="anact-page-content">'+corps+"</div>"+footer+"</div><style>  .anact-page-content{background-color:#ffffff;border:1px solid #ededed;} body{background-color:#ffffff} .anact-print-div{display:block}</style></BODY></HTML>");
//NewWindow.document.open();

NewWindow.document.close();

}
