
function IsIE8Browser() {  
    var rv = -1;    
    var ua = navigator.userAgent;    
    var re = new RegExp("Trident\/([0-9]{1,}[\.0-9]{0,})");    if (re.exec(ua) != null) {        rv = parseFloat(RegExp.$1);    }    return (rv == 4);
}

var ie8 = IsIE8Browser();


function popup(querystring,x,y)
{
	var nwl = (screen.width-x)/2;
	var nwh = (screen.height-y)/2;		
	var popup=window.open('popup.aspx?id='+querystring, 'Lageplan', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+x+',height='+y+',left='+nwl+',top='+nwh+'');
}

function catchEnter(evt, buttonid) {
   
    if (evt.key == 'enter') {
        evt.returnValue = false;
        evt.cancel = true;
        var button = $(buttonid);

        if (button != null) {
            button.click();
        }
     
        return false;
    }

    return true;
}



        
/***********************************************************/
/* ------------------------------------------------------- */
/***********************************************************/

var gAutoPrint = false; 
var gSpecialPrint = null;

/*******************/
/* print functions */
/*******************/
var lastwindow = null;

function replaceAll( str, from, to ) 
{
    var idx = str.indexOf(from);
    var i = 0;
    while (idx > -1 && i<100) {
        i++;
        str = str.replace(from, to); 
        idx = str.indexOf(from);
    }
    return str;
}


function printscreen(divid,fid)
{

	var printdiv = $(divid);
	
    if(gSpecialPrint != null)
        printdiv = $(gSpecialPrint);
		
	popupAndWrite(fid);

}

function popupAndWrite(fid)
{
   
    if(lastwindow != null)
        lastwindow.close();
       
       printTipp(fid);

}

function printTipp(fid) {

    var myLayer = $('content');

      today = new Date();

      var strDateTime = today.getDate() + "." + (today.getMonth()+1) + "." + today.getFullYear() + ", " + today.toLocaleTimeString() + " Uhr";
      var parameter = "menubar=yes,toolbar=yes,scrollbars=yes,statusbar=no,location=no,resizable=yes,width=750px,height=520px";
      var printWin = window.open("","printSpecial_"+replaceAll(replaceAll(replaceAll(replaceAll(strDateTime,".","_"),":","_")," ","_"),",",""),parameter);

      var text = "";
      text += "<table width=100%><tr><td class=printheader style=\"padding-bottom:4px;\" valign=bottom>";
      
      text += "<img  width=\"800px\" src=\"./grafik/header/druck_header.jpg\" />";


      text += "<br></td><td align=left style=\"font-size:10px;\"></td></table>" + $('ctl00_lblstatus').innerHTML + "<br><br>";
      text += myLayer.innerHTML.replace(/<SCRIPT/gi, "<!-- ").replace(/<\/SCRIPT>/gi, "//--> ");
      printWin.document.open();    
      printWin.document.write("<html><head><link href='./css/print.css' rel='stylesheet' type='text/css'></link></head><style> body {background-color:white;text-align:left;} div {overflow:visible;} .scroll{overflow:visible;} .highlight{color:black;background-color:white;}</style><body><div class='text'><form onsubmit='return false;'>" + text + "</form></div><br><table width=100%><tr><td align=right style=\"font-size:10px;margin-top:0px\">"+strDateTime+", &copy; 2009 <FONT class=titel><SPAN class=text_fett>lgv.li</td></tr></table></body></html>");
      printWin.document.close();
      printWin.print();

  }

