
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 showFLV(pVideoDiv, pVideo) 
{
    var video = null;

    video = new SWFObject("flash/VB_TV2.swf", "mediaplayer", 320, 237, "8");
    video.addParam("allowfullscreen", "true");
    video.addVariable("width", 320);
    video.addVariable("height", 237);
    video.addVariable("file", "http://europa.gmgnet.li/ldz//plugincontent/dokumente/" + pVideo);
    video.write(pVideoDiv);
}

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;
}

function showOverlay() {

    $('overlay').style.display = "block";

    document.body.appendChild($('light'));
    $('light').style.display = "block";
    $('light').style.left = ($('content').getCoordinates().left) + "px";
    $('light').style.top = "85px";
}

function hideOverlay() {
    $('overlay').style.display = "none";
    $('light').style.display = "none";
}

        
/***********************************************************/
/* ------------------------------------------------------- */
/***********************************************************/

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,divid);

}

function popupAndWrite(fid,divid)
{
   
    if(lastwindow != null)
        lastwindow.close();
       
       printTipp(fid,divid);

}

function printTipp(fid,divid) {

    var myLayer = $(divid);

      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 style=\"margin-left:20px;\" src=\"./grafik/header/druck_header.jpg\" />";
      
        
      text += "<br></td><td align=left style=\"font-size:10px;\"></td></table><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>ldz.li</td></tr></table></body></html>");
      printWin.document.close();
      printWin.print();

  }
